Skip to content

Commit b3dffff

Browse files
committed
Addressing a bit more CR feedback
1 parent 05c9966 commit b3dffff

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/compiler/checker.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,7 @@ module ts {
16811681
// Return the inferred type for a binding element
16821682
function getTypeForBindingElement(declaration: BindingElement): Type {
16831683
var pattern = <BindingPattern>declaration.parent;
1684-
var parentType = getTypeForVariableDeclaration(<VariableLikeDeclaration>pattern.parent);
1684+
var parentType = getTypeForVariableLikeDeclaration(<VariableLikeDeclaration>pattern.parent);
16851685
// If parent has the unknown (error) type, then so does this binding element
16861686
if (parentType === unknownType) {
16871687
return unknownType;
@@ -1725,7 +1725,7 @@ module ts {
17251725
}
17261726

17271727
// Return the inferred type for a variable, parameter, or property declaration
1728-
function getTypeForVariableDeclaration(declaration: VariableLikeDeclaration): Type {
1728+
function getTypeForVariableLikeDeclaration(declaration: VariableLikeDeclaration): Type {
17291729
// A variable declared in a for..in statement is always of type any
17301730
if (declaration.parent.kind === SyntaxKind.ForInStatement) {
17311731
return anyType;
@@ -1808,8 +1808,8 @@ module ts {
18081808
// Here, the array literal [1, "one"] is contextually typed by the type [any, string], which is the implied type of the
18091809
// binding pattern [x, s = ""]. Because the contextual type is a tuple type, the resulting type of [1, "one"] is the
18101810
// tuple type [number, string]. Thus, the type inferred for 'x' is number and the type inferred for 's' is string.
1811-
function getWidenedTypeForVariableDeclaration(declaration: VariableLikeDeclaration, reportErrors?: boolean): Type {
1812-
var type = getTypeForVariableDeclaration(declaration);
1811+
function getWidenedTypeForVariableLikeDeclaration(declaration: VariableLikeDeclaration, reportErrors?: boolean): Type {
1812+
var type = getTypeForVariableLikeDeclaration(declaration);
18131813
if (type) {
18141814
if (reportErrors) {
18151815
reportErrorsFromWidening(declaration, type);
@@ -1850,7 +1850,7 @@ module ts {
18501850
}
18511851
// Handle variable, parameter or property
18521852
links.type = resolvingType;
1853-
var type = getWidenedTypeForVariableDeclaration(<VariableLikeDeclaration>declaration, /*reportErrors*/ true);
1853+
var type = getWidenedTypeForVariableLikeDeclaration(<VariableLikeDeclaration>declaration, /*reportErrors*/ true);
18541854
if (links.type === resolvingType) {
18551855
links.type = type;
18561856
}
@@ -6970,7 +6970,7 @@ module ts {
69706970
var seenStringIndexer = false;
69716971
for (var i = 0, len = indexSymbol.declarations.length; i < len; ++i) {
69726972
var declaration = <SignatureDeclaration>indexSymbol.declarations[i];
6973-
if (declaration.parameters.length == 1 && declaration.parameters[0].type) {
6973+
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
69746974
switch (declaration.parameters[0].type.kind) {
69756975
case SyntaxKind.StringKeyword:
69766976
if (!seenStringIndexer) {
@@ -7755,7 +7755,7 @@ module ts {
77557755
// For a binding pattern, validate the initializer and exit
77567756
if (isBindingPattern(node.name)) {
77577757
if (node.initializer) {
7758-
checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableDeclaration(node), node, /*headMessage*/ undefined);
7758+
checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined);
77597759
checkParameterInitializer(node);
77607760
}
77617761
return;
@@ -7772,7 +7772,7 @@ module ts {
77727772
else {
77737773
// Node is a secondary declaration, check that type is identical to primary declaration and check that
77747774
// initializer is consistent with type associated with the node
7775-
var declarationType = getWidenedTypeForVariableDeclaration(node);
7775+
var declarationType = getWidenedTypeForVariableLikeDeclaration(node);
77767776
if (type !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(type, declarationType)) {
77777777
error(node.name, Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, declarationNameToString(node.name), typeToString(type), typeToString(declarationType));
77787778
}

src/services/navigationBar.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ module ts.NavigationBar {
224224
function createChildItem(node: Node): ts.NavigationBarItem {
225225
switch (node.kind) {
226226
case SyntaxKind.Parameter:
227-
if (isBindingPattern((<VariableDeclaration>node).name)) {
227+
if (isBindingPattern((<ParameterDeclaration>node).name)) {
228228
break;
229229
}
230230
if ((node.flags & NodeFlags.Modifier) === 0) {

0 commit comments

Comments
 (0)