mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge pull request #3636 from Microsoft/semanticBindingPropNames
Enable semantic operations on binding element property names
This commit is contained in:
+30
-9
@@ -2307,6 +2307,7 @@ namespace ts {
|
||||
if (declaration.parent.parent.kind === SyntaxKind.ForInStatement) {
|
||||
return anyType;
|
||||
}
|
||||
|
||||
if (declaration.parent.parent.kind === SyntaxKind.ForOfStatement) {
|
||||
// checkRightHandSideOfForOf will return undefined if the for-of expression type was
|
||||
// missing properties/signatures required to get its iteratedType (like
|
||||
@@ -2314,13 +2315,16 @@ namespace ts {
|
||||
// or it may have led to an error inside getElementTypeOfIterable.
|
||||
return checkRightHandSideOfForOf((<ForOfStatement>declaration.parent.parent).expression) || anyType;
|
||||
}
|
||||
|
||||
if (isBindingPattern(declaration.parent)) {
|
||||
return getTypeForBindingElement(<BindingElement>declaration);
|
||||
}
|
||||
|
||||
// Use type from type annotation if one is present
|
||||
if (declaration.type) {
|
||||
return getTypeFromTypeNode(declaration.type);
|
||||
}
|
||||
|
||||
if (declaration.kind === SyntaxKind.Parameter) {
|
||||
let func = <FunctionLikeDeclaration>declaration.parent;
|
||||
// For a parameter of a set accessor, use the type of the get accessor if one is present
|
||||
@@ -2336,14 +2340,22 @@ namespace ts {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
// Use the type of the initializer expression if one is present
|
||||
if (declaration.initializer) {
|
||||
return checkExpressionCached(declaration.initializer);
|
||||
}
|
||||
|
||||
// If it is a short-hand property assignment, use the type of the identifier
|
||||
if (declaration.kind === SyntaxKind.ShorthandPropertyAssignment) {
|
||||
return checkIdentifier(<Identifier>declaration.name);
|
||||
}
|
||||
|
||||
// If the declaration specifies a binding pattern, use the type implied by the binding pattern
|
||||
if (isBindingPattern(declaration.name)) {
|
||||
return getTypeFromBindingPattern(<BindingPattern>declaration.name);
|
||||
}
|
||||
|
||||
// No type specified and nothing can be inferred
|
||||
return undefined;
|
||||
}
|
||||
@@ -2429,13 +2441,10 @@ namespace ts {
|
||||
// tools see the actual type.
|
||||
return declaration.kind !== SyntaxKind.PropertyAssignment ? getWidenedType(type) : type;
|
||||
}
|
||||
// If no type was specified and nothing could be inferred, and if the declaration specifies a binding pattern, use
|
||||
// the type implied by the binding pattern
|
||||
if (isBindingPattern(declaration.name)) {
|
||||
return getTypeFromBindingPattern(<BindingPattern>declaration.name);
|
||||
}
|
||||
|
||||
// Rest parameters default to type any[], other parameters default to type any
|
||||
type = declaration.dotDotDotToken ? anyArrayType : anyType;
|
||||
|
||||
// Report implicit any errors unless this is a private property within an ambient declaration
|
||||
if (reportErrors && compilerOptions.noImplicitAny) {
|
||||
let root = getRootDeclaration(declaration);
|
||||
@@ -13670,10 +13679,22 @@ namespace ts {
|
||||
return getSymbolOfNode(node.parent);
|
||||
}
|
||||
|
||||
if (node.kind === SyntaxKind.Identifier && isInRightSideOfImportOrExportAssignment(<Identifier>node)) {
|
||||
return node.parent.kind === SyntaxKind.ExportAssignment
|
||||
? getSymbolOfEntityNameOrPropertyAccessExpression(<Identifier>node)
|
||||
: getSymbolOfPartOfRightHandSideOfImportEquals(<Identifier>node);
|
||||
if (node.kind === SyntaxKind.Identifier) {
|
||||
if (isInRightSideOfImportOrExportAssignment(<Identifier>node)) {
|
||||
return node.parent.kind === SyntaxKind.ExportAssignment
|
||||
? getSymbolOfEntityNameOrPropertyAccessExpression(<Identifier>node)
|
||||
: getSymbolOfPartOfRightHandSideOfImportEquals(<Identifier>node);
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.BindingElement &&
|
||||
node.parent.parent.kind === SyntaxKind.ObjectBindingPattern &&
|
||||
node === (<BindingElement>node.parent).propertyName) {
|
||||
let typeOfPattern = getTypeAtLocation(node.parent.parent);
|
||||
let propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, (<Identifier>node).text);
|
||||
|
||||
if (propertyDeclaration) {
|
||||
return propertyDeclaration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (node.kind) {
|
||||
|
||||
@@ -568,7 +568,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function isVariableLike(node: Node): boolean {
|
||||
export function isVariableLike(node: Node): node is VariableLikeDeclaration {
|
||||
if (node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.BindingElement:
|
||||
|
||||
@@ -671,20 +671,20 @@ module FourSlash {
|
||||
|
||||
let completions = this.getCompletionListAtCaret();
|
||||
if ((!completions || completions.entries.length === 0) && negative) {
|
||||
this.raiseError("Completion list is empty at Caret");
|
||||
} else if ((completions && completions.entries.length !== 0) && !negative) {
|
||||
|
||||
this.raiseError("Completion list is empty at caret at position " + this.activeFile.fileName + " " + this.currentCaretPosition);
|
||||
}
|
||||
else if (completions && completions.entries.length !== 0 && !negative) {
|
||||
let errorMsg = "\n" + "Completion List contains: [" + completions.entries[0].name;
|
||||
for (let i = 1; i < completions.entries.length; i++) {
|
||||
errorMsg += ", " + completions.entries[i].name;
|
||||
}
|
||||
errorMsg += "]\n";
|
||||
|
||||
Harness.IO.log(errorMsg);
|
||||
this.raiseError("Completion list is not empty at Caret");
|
||||
this.raiseError("Completion list is not empty at caret at position " + this.activeFile.fileName + " " + this.currentCaretPosition + errorMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public verifyCompletionListAllowsNewIdentifier(negative: boolean) {
|
||||
let completions = this.getCompletionListAtCaret();
|
||||
|
||||
|
||||
@@ -3234,8 +3234,19 @@ namespace ts {
|
||||
// We are *only* completing on properties from the type being destructured.
|
||||
isNewIdentifierLocation = false;
|
||||
|
||||
typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer);
|
||||
existingMembers = (<BindingPattern>objectLikeContainer).elements;
|
||||
let rootDeclaration = getRootDeclaration(objectLikeContainer.parent);
|
||||
if (isVariableLike(rootDeclaration)) {
|
||||
// We don't want to complete using the type acquired by the shape
|
||||
// of the binding pattern; we are only interested in types acquired
|
||||
// through type declaration or inference.
|
||||
if (rootDeclaration.initializer || rootDeclaration.type) {
|
||||
typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer);
|
||||
existingMembers = (<BindingPattern>objectLikeContainer).elements;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Debug.fail("Root declaration is not variable-like.")
|
||||
}
|
||||
}
|
||||
else {
|
||||
Debug.fail("Expected object literal or binding pattern, got " + objectLikeContainer.kind);
|
||||
|
||||
@@ -70,6 +70,7 @@ var p6 = ({ a }) => { };
|
||||
|
||||
var p7 = ({ a: { b } }) => { };
|
||||
>p7 : Symbol(p7, Decl(arrowFunctionExpressions.ts, 21, 3))
|
||||
>a : Symbol(a)
|
||||
>b : Symbol(b, Decl(arrowFunctionExpressions.ts, 21, 16))
|
||||
|
||||
var p8 = ({ a = 1 }) => { };
|
||||
@@ -78,6 +79,7 @@ var p8 = ({ a = 1 }) => { };
|
||||
|
||||
var p9 = ({ a: { b = 1 } = { b: 1 } }) => { };
|
||||
>p9 : Symbol(p9, Decl(arrowFunctionExpressions.ts, 23, 3))
|
||||
>a : Symbol(a)
|
||||
>b : Symbol(b, Decl(arrowFunctionExpressions.ts, 23, 16))
|
||||
>b : Symbol(b, Decl(arrowFunctionExpressions.ts, 23, 28))
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ function bar({a1, b1, c1}: { a1: number, b1: boolean, c1: string }): void { }
|
||||
function baz({a2, b2: {b1, c1}}: { a2: number, b2: { b1: boolean, c1: string } }): void { }
|
||||
>baz : Symbol(baz, Decl(declarationEmitDestructuring1.ts, 2, 77))
|
||||
>a2 : Symbol(a2, Decl(declarationEmitDestructuring1.ts, 3, 14))
|
||||
>b2 : Symbol(b2, Decl(declarationEmitDestructuring1.ts, 3, 46))
|
||||
>b1 : Symbol(b1, Decl(declarationEmitDestructuring1.ts, 3, 23))
|
||||
>c1 : Symbol(c1, Decl(declarationEmitDestructuring1.ts, 3, 26))
|
||||
>a2 : Symbol(a2, Decl(declarationEmitDestructuring1.ts, 3, 34))
|
||||
|
||||
@@ -17,6 +17,7 @@ var [a2, [b2, { x12, y12: c2 }]=["abc", { x12: 10, y12: false }]] = [1, ["hello"
|
||||
>a2 : Symbol(a2, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 5))
|
||||
>b2 : Symbol(b2, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 10))
|
||||
>x12 : Symbol(x12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 15))
|
||||
>y12 : Symbol(y12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 91))
|
||||
>c2 : Symbol(c2, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 20))
|
||||
>x12 : Symbol(x12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 41))
|
||||
>y12 : Symbol(y12, Decl(declarationEmitDestructuringArrayPattern2.ts, 5, 50))
|
||||
|
||||
@@ -21,24 +21,33 @@ var { x6, y6 } = { x6: 5, y6: "hello" };
|
||||
>y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 4, 25))
|
||||
|
||||
var { x7: a1 } = { x7: 5, y7: "hello" };
|
||||
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 18))
|
||||
>a1 : Symbol(a1, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 5))
|
||||
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 18))
|
||||
>y7 : Symbol(y7, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 5, 25))
|
||||
|
||||
var { y8: b1 } = { x8: 5, y8: "hello" };
|
||||
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 25))
|
||||
>b1 : Symbol(b1, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 5))
|
||||
>x8 : Symbol(x8, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 18))
|
||||
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 6, 25))
|
||||
|
||||
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
|
||||
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 26))
|
||||
>a2 : Symbol(a2, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 5))
|
||||
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 33))
|
||||
>b2 : Symbol(b2, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 13))
|
||||
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 26))
|
||||
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 7, 33))
|
||||
|
||||
var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } };
|
||||
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 46))
|
||||
>x11 : Symbol(x11, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 5))
|
||||
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 52))
|
||||
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 57))
|
||||
>y11 : Symbol(y11, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 18))
|
||||
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 69))
|
||||
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 74))
|
||||
>z11 : Symbol(z11, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 31))
|
||||
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 46))
|
||||
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern.ts, 9, 52))
|
||||
|
||||
@@ -21,17 +21,21 @@ var { x6, y6 } = { x6: 5, y6: "hello" };
|
||||
>y6 : Symbol(y6, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 4, 25))
|
||||
|
||||
var { x7: a1 } = { x7: 5, y7: "hello" };
|
||||
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 18))
|
||||
>a1 : Symbol(a1, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 5))
|
||||
>x7 : Symbol(x7, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 18))
|
||||
>y7 : Symbol(y7, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 5, 25))
|
||||
|
||||
var { y8: b1 } = { x8: 5, y8: "hello" };
|
||||
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 25))
|
||||
>b1 : Symbol(b1, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 5))
|
||||
>x8 : Symbol(x8, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 18))
|
||||
>y8 : Symbol(y8, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 6, 25))
|
||||
|
||||
var { x9: a2, y9: b2 } = { x9: 5, y9: "hello" };
|
||||
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 26))
|
||||
>a2 : Symbol(a2, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 5))
|
||||
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 33))
|
||||
>b2 : Symbol(b2, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 13))
|
||||
>x9 : Symbol(x9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 26))
|
||||
>y9 : Symbol(y9, Decl(declarationEmitDestructuringObjectLiteralPattern1.ts, 7, 33))
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
=== tests/cases/compiler/declarationEmitDestructuringObjectLiteralPattern2.ts ===
|
||||
|
||||
var { a: x11, b: { a: y11, b: { a: z11 }}} = { a: 1, b: { a: "hello", b: { a: true } } };
|
||||
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 46))
|
||||
>x11 : Symbol(x11, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 5))
|
||||
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 52))
|
||||
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 57))
|
||||
>y11 : Symbol(y11, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 18))
|
||||
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 69))
|
||||
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 74))
|
||||
>z11 : Symbol(z11, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 31))
|
||||
>a : Symbol(a, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 46))
|
||||
>b : Symbol(b, Decl(declarationEmitDestructuringObjectLiteralPattern2.ts, 1, 52))
|
||||
|
||||
@@ -19,6 +19,7 @@ var { b1, } = { b1:1, };
|
||||
>b1 : Symbol(b1, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 11, 15))
|
||||
|
||||
var { b2: { b21 } = { b21: "string" } } = { b2: { b21: "world" } };
|
||||
>b2 : Symbol(b2, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 12, 44))
|
||||
>b21 : Symbol(b21, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 12, 11))
|
||||
>b21 : Symbol(b21, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 12, 21))
|
||||
>b2 : Symbol(b2, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 12, 44))
|
||||
@@ -32,6 +33,7 @@ var {b4 = 1}: any = { b4: 100000 };
|
||||
>b4 : Symbol(b4, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 14, 21))
|
||||
|
||||
var {b5: { b52 } } = { b5: { b52 } };
|
||||
>b5 : Symbol(b5, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 15, 23))
|
||||
>b52 : Symbol(b52, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 15, 10))
|
||||
>b5 : Symbol(b5, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 15, 23))
|
||||
>b52 : Symbol(b52, Decl(destructuringObjectBindingPatternAndAssignment1ES5.ts, 15, 29))
|
||||
|
||||
@@ -19,6 +19,7 @@ var { b1, } = { b1:1, };
|
||||
>b1 : Symbol(b1, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 11, 15))
|
||||
|
||||
var { b2: { b21 } = { b21: "string" } } = { b2: { b21: "world" } };
|
||||
>b2 : Symbol(b2, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 12, 44))
|
||||
>b21 : Symbol(b21, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 12, 11))
|
||||
>b21 : Symbol(b21, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 12, 21))
|
||||
>b2 : Symbol(b2, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 12, 44))
|
||||
@@ -32,6 +33,7 @@ var {b4 = 1}: any = { b4: 100000 };
|
||||
>b4 : Symbol(b4, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 14, 21))
|
||||
|
||||
var {b5: { b52 } } = { b5: { b52 } };
|
||||
>b5 : Symbol(b5, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 15, 23))
|
||||
>b52 : Symbol(b52, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 15, 10))
|
||||
>b5 : Symbol(b5, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 15, 23))
|
||||
>b52 : Symbol(b52, Decl(destructuringObjectBindingPatternAndAssignment1ES6.ts, 15, 29))
|
||||
|
||||
@@ -17,6 +17,7 @@ var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [["hello"]], true];
|
||||
// The type T associated with a destructuring variable declaration is determined as follows:
|
||||
// Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression.
|
||||
var { b1: { b11 } = { b11: "string" } } = { b1: { b11: "world" } };
|
||||
>b1 : Symbol(b1, Decl(destructuringVariableDeclaration1ES5.ts, 7, 44))
|
||||
>b11 : Symbol(b11, Decl(destructuringVariableDeclaration1ES5.ts, 7, 11))
|
||||
>b11 : Symbol(b11, Decl(destructuringVariableDeclaration1ES5.ts, 7, 21))
|
||||
>b1 : Symbol(b1, Decl(destructuringVariableDeclaration1ES5.ts, 7, 44))
|
||||
@@ -74,6 +75,7 @@ var [d3, d4] = [1, "string", ...temp1];
|
||||
|
||||
// Combining both forms of destructuring,
|
||||
var {e: [e1, e2, e3 = { b1: 1000, b4: 200 }]} = { e: [1, 2, { b1: 4, b4: 0 }] };
|
||||
>e : Symbol(e, Decl(destructuringVariableDeclaration1ES5.ts, 31, 49))
|
||||
>e1 : Symbol(e1, Decl(destructuringVariableDeclaration1ES5.ts, 31, 9))
|
||||
>e2 : Symbol(e2, Decl(destructuringVariableDeclaration1ES5.ts, 31, 12))
|
||||
>e3 : Symbol(e3, Decl(destructuringVariableDeclaration1ES5.ts, 31, 16))
|
||||
@@ -84,8 +86,10 @@ var {e: [e1, e2, e3 = { b1: 1000, b4: 200 }]} = { e: [1, 2, { b1: 4, b4: 0 }] };
|
||||
>b4 : Symbol(b4, Decl(destructuringVariableDeclaration1ES5.ts, 31, 68))
|
||||
|
||||
var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] };
|
||||
>f : Symbol(f, Decl(destructuringVariableDeclaration1ES5.ts, 32, 41))
|
||||
>f1 : Symbol(f1, Decl(destructuringVariableDeclaration1ES5.ts, 32, 9))
|
||||
>f2 : Symbol(f2, Decl(destructuringVariableDeclaration1ES5.ts, 32, 12))
|
||||
>f3 : Symbol(f3, Decl(destructuringVariableDeclaration1ES5.ts, 32, 53))
|
||||
>f4 : Symbol(f4, Decl(destructuringVariableDeclaration1ES5.ts, 32, 18))
|
||||
>f5 : Symbol(f5, Decl(destructuringVariableDeclaration1ES5.ts, 32, 26))
|
||||
>f : Symbol(f, Decl(destructuringVariableDeclaration1ES5.ts, 32, 41))
|
||||
@@ -96,6 +100,7 @@ var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] };
|
||||
// an initializer expression, the type of the initializer expression is required to be assignable
|
||||
// to the widened form of the type associated with the destructuring variable declaration, binding property, or binding element.
|
||||
var {g: {g1 = [undefined, null]}}: { g: { g1: any[] } } = { g: { g1: [1, 2] } };
|
||||
>g : Symbol(g, Decl(destructuringVariableDeclaration1ES5.ts, 37, 36))
|
||||
>g1 : Symbol(g1, Decl(destructuringVariableDeclaration1ES5.ts, 37, 9))
|
||||
>undefined : Symbol(undefined)
|
||||
>g : Symbol(g, Decl(destructuringVariableDeclaration1ES5.ts, 37, 36))
|
||||
@@ -104,6 +109,7 @@ var {g: {g1 = [undefined, null]}}: { g: { g1: any[] } } = { g: { g1: [1, 2] } };
|
||||
>g1 : Symbol(g1, Decl(destructuringVariableDeclaration1ES5.ts, 37, 64))
|
||||
|
||||
var {h: {h1 = [undefined, null]}}: { h: { h1: number[] } } = { h: { h1: [1, 2] } };
|
||||
>h : Symbol(h, Decl(destructuringVariableDeclaration1ES5.ts, 38, 36))
|
||||
>h1 : Symbol(h1, Decl(destructuringVariableDeclaration1ES5.ts, 38, 9))
|
||||
>undefined : Symbol(undefined)
|
||||
>h : Symbol(h, Decl(destructuringVariableDeclaration1ES5.ts, 38, 36))
|
||||
|
||||
@@ -17,6 +17,7 @@ var [a3, [[a4]], a5]: [number, [[string]], boolean] = [1, [["hello"]], true];
|
||||
// The type T associated with a destructuring variable declaration is determined as follows:
|
||||
// Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression.
|
||||
var { b1: { b11 } = { b11: "string" } } = { b1: { b11: "world" } };
|
||||
>b1 : Symbol(b1, Decl(destructuringVariableDeclaration1ES6.ts, 7, 44))
|
||||
>b11 : Symbol(b11, Decl(destructuringVariableDeclaration1ES6.ts, 7, 11))
|
||||
>b11 : Symbol(b11, Decl(destructuringVariableDeclaration1ES6.ts, 7, 21))
|
||||
>b1 : Symbol(b1, Decl(destructuringVariableDeclaration1ES6.ts, 7, 44))
|
||||
@@ -74,6 +75,7 @@ var [d3, d4] = [1, "string", ...temp1];
|
||||
|
||||
// Combining both forms of destructuring,
|
||||
var {e: [e1, e2, e3 = { b1: 1000, b4: 200 }]} = { e: [1, 2, { b1: 4, b4: 0 }] };
|
||||
>e : Symbol(e, Decl(destructuringVariableDeclaration1ES6.ts, 31, 49))
|
||||
>e1 : Symbol(e1, Decl(destructuringVariableDeclaration1ES6.ts, 31, 9))
|
||||
>e2 : Symbol(e2, Decl(destructuringVariableDeclaration1ES6.ts, 31, 12))
|
||||
>e3 : Symbol(e3, Decl(destructuringVariableDeclaration1ES6.ts, 31, 16))
|
||||
@@ -84,8 +86,10 @@ var {e: [e1, e2, e3 = { b1: 1000, b4: 200 }]} = { e: [1, 2, { b1: 4, b4: 0 }] };
|
||||
>b4 : Symbol(b4, Decl(destructuringVariableDeclaration1ES6.ts, 31, 68))
|
||||
|
||||
var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] };
|
||||
>f : Symbol(f, Decl(destructuringVariableDeclaration1ES6.ts, 32, 41))
|
||||
>f1 : Symbol(f1, Decl(destructuringVariableDeclaration1ES6.ts, 32, 9))
|
||||
>f2 : Symbol(f2, Decl(destructuringVariableDeclaration1ES6.ts, 32, 12))
|
||||
>f3 : Symbol(f3, Decl(destructuringVariableDeclaration1ES6.ts, 32, 53))
|
||||
>f4 : Symbol(f4, Decl(destructuringVariableDeclaration1ES6.ts, 32, 18))
|
||||
>f5 : Symbol(f5, Decl(destructuringVariableDeclaration1ES6.ts, 32, 26))
|
||||
>f : Symbol(f, Decl(destructuringVariableDeclaration1ES6.ts, 32, 41))
|
||||
@@ -96,6 +100,7 @@ var {f: [f1, f2, { f3: f4, f5 }, , ]} = { f: [1, 2, { f3: 4, f5: 0 }] };
|
||||
// an initializer expression, the type of the initializer expression is required to be assignable
|
||||
// to the widened form of the type associated with the destructuring variable declaration, binding property, or binding element.
|
||||
var {g: {g1 = [undefined, null]}}: { g: { g1: any[] } } = { g: { g1: [1, 2] } };
|
||||
>g : Symbol(g, Decl(destructuringVariableDeclaration1ES6.ts, 37, 36))
|
||||
>g1 : Symbol(g1, Decl(destructuringVariableDeclaration1ES6.ts, 37, 9))
|
||||
>undefined : Symbol(undefined)
|
||||
>g : Symbol(g, Decl(destructuringVariableDeclaration1ES6.ts, 37, 36))
|
||||
@@ -104,6 +109,7 @@ var {g: {g1 = [undefined, null]}}: { g: { g1: any[] } } = { g: { g1: [1, 2] } };
|
||||
>g1 : Symbol(g1, Decl(destructuringVariableDeclaration1ES6.ts, 37, 64))
|
||||
|
||||
var {h: {h1 = [undefined, null]}}: { h: { h1: number[] } } = { h: { h1: [1, 2] } };
|
||||
>h : Symbol(h, Decl(destructuringVariableDeclaration1ES6.ts, 38, 36))
|
||||
>h1 : Symbol(h1, Decl(destructuringVariableDeclaration1ES6.ts, 38, 9))
|
||||
>undefined : Symbol(undefined)
|
||||
>h : Symbol(h, Decl(destructuringVariableDeclaration1ES6.ts, 38, 36))
|
||||
|
||||
@@ -12,6 +12,7 @@ let [baz] = [];
|
||||
>baz : Symbol(baz, Decl(downlevelLetConst12.ts, 6, 5))
|
||||
|
||||
let {a: baz2} = { a: 1 };
|
||||
>a : Symbol(a, Decl(downlevelLetConst12.ts, 7, 17))
|
||||
>baz2 : Symbol(baz2, Decl(downlevelLetConst12.ts, 7, 5))
|
||||
>a : Symbol(a, Decl(downlevelLetConst12.ts, 7, 17))
|
||||
|
||||
@@ -19,6 +20,7 @@ const [baz3] = []
|
||||
>baz3 : Symbol(baz3, Decl(downlevelLetConst12.ts, 9, 7))
|
||||
|
||||
const {a: baz4} = { a: 1 };
|
||||
>a : Symbol(a, Decl(downlevelLetConst12.ts, 10, 19))
|
||||
>baz4 : Symbol(baz4, Decl(downlevelLetConst12.ts, 10, 7))
|
||||
>a : Symbol(a, Decl(downlevelLetConst12.ts, 10, 19))
|
||||
|
||||
|
||||
@@ -16,10 +16,12 @@ export const [bar2] = [2];
|
||||
>bar2 : Symbol(bar2, Decl(downlevelLetConst13.ts, 7, 14))
|
||||
|
||||
export let {a: bar3} = { a: 1 };
|
||||
>a : Symbol(a, Decl(downlevelLetConst13.ts, 8, 24))
|
||||
>bar3 : Symbol(bar3, Decl(downlevelLetConst13.ts, 8, 12))
|
||||
>a : Symbol(a, Decl(downlevelLetConst13.ts, 8, 24))
|
||||
|
||||
export const {a: bar4} = { a: 1 };
|
||||
>a : Symbol(a, Decl(downlevelLetConst13.ts, 9, 26))
|
||||
>bar4 : Symbol(bar4, Decl(downlevelLetConst13.ts, 9, 14))
|
||||
>a : Symbol(a, Decl(downlevelLetConst13.ts, 9, 26))
|
||||
|
||||
@@ -39,10 +41,12 @@ export module M {
|
||||
>bar6 : Symbol(bar6, Decl(downlevelLetConst13.ts, 15, 18))
|
||||
|
||||
export let {a: bar7} = { a: 1 };
|
||||
>a : Symbol(a, Decl(downlevelLetConst13.ts, 16, 28))
|
||||
>bar7 : Symbol(bar7, Decl(downlevelLetConst13.ts, 16, 16))
|
||||
>a : Symbol(a, Decl(downlevelLetConst13.ts, 16, 28))
|
||||
|
||||
export const {a: bar8} = { a: 1 };
|
||||
>a : Symbol(a, Decl(downlevelLetConst13.ts, 17, 30))
|
||||
>bar8 : Symbol(bar8, Decl(downlevelLetConst13.ts, 17, 18))
|
||||
>a : Symbol(a, Decl(downlevelLetConst13.ts, 17, 30))
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ var z0, z1, z2, z3;
|
||||
>z1 : Symbol(z1, Decl(downlevelLetConst14.ts, 11, 9))
|
||||
|
||||
let {a: z2} = { a: 1 };
|
||||
>a : Symbol(a, Decl(downlevelLetConst14.ts, 13, 19))
|
||||
>z2 : Symbol(z2, Decl(downlevelLetConst14.ts, 13, 9))
|
||||
>a : Symbol(a, Decl(downlevelLetConst14.ts, 13, 19))
|
||||
|
||||
@@ -43,6 +44,7 @@ var z0, z1, z2, z3;
|
||||
>z2 : Symbol(z2, Decl(downlevelLetConst14.ts, 13, 9))
|
||||
|
||||
let {a: z3} = { a: 1 };
|
||||
>a : Symbol(a, Decl(downlevelLetConst14.ts, 15, 19))
|
||||
>z3 : Symbol(z3, Decl(downlevelLetConst14.ts, 15, 9))
|
||||
>a : Symbol(a, Decl(downlevelLetConst14.ts, 15, 19))
|
||||
|
||||
@@ -86,6 +88,7 @@ var y = true;
|
||||
>y : Symbol(y, Decl(downlevelLetConst14.ts, 29, 11))
|
||||
|
||||
let {a: z6} = {a: 1}
|
||||
>a : Symbol(a, Decl(downlevelLetConst14.ts, 30, 23))
|
||||
>z6 : Symbol(z6, Decl(downlevelLetConst14.ts, 30, 13))
|
||||
>a : Symbol(a, Decl(downlevelLetConst14.ts, 30, 23))
|
||||
|
||||
@@ -129,6 +132,7 @@ var z5 = 1;
|
||||
>_z : Symbol(_z, Decl(downlevelLetConst14.ts, 46, 11))
|
||||
|
||||
let {a: _z5} = { a: 1 };
|
||||
>a : Symbol(a, Decl(downlevelLetConst14.ts, 47, 24))
|
||||
>_z5 : Symbol(_z5, Decl(downlevelLetConst14.ts, 47, 13))
|
||||
>a : Symbol(a, Decl(downlevelLetConst14.ts, 47, 24))
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ var z0, z1, z2, z3;
|
||||
>z0 : Symbol(z0, Decl(downlevelLetConst15.ts, 9, 11))
|
||||
|
||||
const [{a: z1}] = [{a: 1}]
|
||||
>a : Symbol(a, Decl(downlevelLetConst15.ts, 11, 24))
|
||||
>z1 : Symbol(z1, Decl(downlevelLetConst15.ts, 11, 12))
|
||||
>a : Symbol(a, Decl(downlevelLetConst15.ts, 11, 24))
|
||||
|
||||
@@ -36,6 +37,7 @@ var z0, z1, z2, z3;
|
||||
>z1 : Symbol(z1, Decl(downlevelLetConst15.ts, 11, 12))
|
||||
|
||||
const {a: z2} = { a: 1 };
|
||||
>a : Symbol(a, Decl(downlevelLetConst15.ts, 13, 21))
|
||||
>z2 : Symbol(z2, Decl(downlevelLetConst15.ts, 13, 11))
|
||||
>a : Symbol(a, Decl(downlevelLetConst15.ts, 13, 21))
|
||||
|
||||
@@ -44,6 +46,8 @@ var z0, z1, z2, z3;
|
||||
>z2 : Symbol(z2, Decl(downlevelLetConst15.ts, 13, 11))
|
||||
|
||||
const {a: {b: z3}} = { a: {b: 1} };
|
||||
>a : Symbol(a, Decl(downlevelLetConst15.ts, 15, 26))
|
||||
>b : Symbol(b, Decl(downlevelLetConst15.ts, 15, 31))
|
||||
>z3 : Symbol(z3, Decl(downlevelLetConst15.ts, 15, 15))
|
||||
>a : Symbol(a, Decl(downlevelLetConst15.ts, 15, 26))
|
||||
>b : Symbol(b, Decl(downlevelLetConst15.ts, 15, 31))
|
||||
@@ -88,6 +92,7 @@ var y = true;
|
||||
>y : Symbol(y, Decl(downlevelLetConst15.ts, 29, 13))
|
||||
|
||||
const {a: z6} = { a: 1 }
|
||||
>a : Symbol(a, Decl(downlevelLetConst15.ts, 30, 25))
|
||||
>z6 : Symbol(z6, Decl(downlevelLetConst15.ts, 30, 15))
|
||||
>a : Symbol(a, Decl(downlevelLetConst15.ts, 30, 25))
|
||||
|
||||
@@ -131,6 +136,7 @@ var z5 = 1;
|
||||
>_z : Symbol(_z, Decl(downlevelLetConst15.ts, 46, 13))
|
||||
|
||||
const {a: _z5} = { a: 1 };
|
||||
>a : Symbol(a, Decl(downlevelLetConst15.ts, 47, 26))
|
||||
>_z5 : Symbol(_z5, Decl(downlevelLetConst15.ts, 47, 15))
|
||||
>a : Symbol(a, Decl(downlevelLetConst15.ts, 47, 26))
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ var p6 = ({ a }) => { };
|
||||
|
||||
var p7 = ({ a: { b } }) => { };
|
||||
>p7 : Symbol(p7, Decl(emitArrowFunctionES6.ts, 15, 3))
|
||||
>a : Symbol(a)
|
||||
>b : Symbol(b, Decl(emitArrowFunctionES6.ts, 15, 16))
|
||||
|
||||
var p8 = ({ a = 1 }) => { };
|
||||
@@ -64,6 +65,7 @@ var p8 = ({ a = 1 }) => { };
|
||||
|
||||
var p9 = ({ a: { b = 1 } = { b: 1 } }) => { };
|
||||
>p9 : Symbol(p9, Decl(emitArrowFunctionES6.ts, 17, 3))
|
||||
>a : Symbol(a)
|
||||
>b : Symbol(b, Decl(emitArrowFunctionES6.ts, 17, 16))
|
||||
>b : Symbol(b, Decl(emitArrowFunctionES6.ts, 17, 28))
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ function f() {
|
||||
>f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments18_ES6.ts, 0, 0))
|
||||
|
||||
var { arguments: args } = { arguments };
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments18_ES6.ts, 2, 31))
|
||||
>args : Symbol(args, Decl(emitArrowFunctionWhenUsingArguments18_ES6.ts, 2, 9))
|
||||
>arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments18_ES6.ts, 2, 31))
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@ var array = [{x: [0], y: {p: ""}}]
|
||||
>p : Symbol(p, Decl(for-of41.ts, 0, 26))
|
||||
|
||||
for (var {x: [a], y: {p}} of array) {
|
||||
>x : Symbol(x, Decl(for-of41.ts, 0, 14))
|
||||
>a : Symbol(a, Decl(for-of41.ts, 1, 14))
|
||||
>y : Symbol(y, Decl(for-of41.ts, 0, 21))
|
||||
>p : Symbol(p, Decl(for-of41.ts, 1, 22))
|
||||
>array : Symbol(array, Decl(for-of41.ts, 0, 3))
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@ var array = [{ x: "", y: 0 }]
|
||||
>y : Symbol(y, Decl(for-of42.ts, 0, 21))
|
||||
|
||||
for (var {x: a, y: b} of array) {
|
||||
>x : Symbol(x, Decl(for-of42.ts, 0, 14))
|
||||
>a : Symbol(a, Decl(for-of42.ts, 1, 10))
|
||||
>y : Symbol(y, Decl(for-of42.ts, 0, 21))
|
||||
>b : Symbol(b, Decl(for-of42.ts, 1, 15))
|
||||
>array : Symbol(array, Decl(for-of42.ts, 0, 3))
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ var x, y, z;
|
||||
|
||||
if (true) {
|
||||
let { x: x } = { x: 0 };
|
||||
>x : Symbol(x, Decl(initializePropertiesWithRenamedLet.ts, 10, 20))
|
||||
>x : Symbol(x, Decl(initializePropertiesWithRenamedLet.ts, 10, 9))
|
||||
>x : Symbol(x, Decl(initializePropertiesWithRenamedLet.ts, 10, 20))
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ let [x] = [1];
|
||||
>x : Symbol(x, Decl(letInNonStrictMode.ts, 0, 5))
|
||||
|
||||
let {a: y} = {a: 1};
|
||||
>a : Symbol(a, Decl(letInNonStrictMode.ts, 1, 14))
|
||||
>y : Symbol(y, Decl(letInNonStrictMode.ts, 1, 5))
|
||||
>a : Symbol(a, Decl(letInNonStrictMode.ts, 1, 14))
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
=== tests/cases/conformance/es6/destructuring/objectBindingPatternKeywordIdentifiers06.ts ===
|
||||
|
||||
var { as: as } = { as: 1 }
|
||||
>as : Symbol(as, Decl(objectBindingPatternKeywordIdentifiers06.ts, 1, 18))
|
||||
>as : Symbol(as, Decl(objectBindingPatternKeywordIdentifiers06.ts, 1, 5))
|
||||
>as : Symbol(as, Decl(objectBindingPatternKeywordIdentifiers06.ts, 1, 18))
|
||||
|
||||
|
||||
@@ -6,7 +6,10 @@ export let [x,y,z] = [1, 2, 3];
|
||||
>z : Symbol(z, Decl(systemModule13.ts, 1, 16))
|
||||
|
||||
export const {a: z0, b: {c: z1}} = {a: true, b: {c: "123"}};
|
||||
>a : Symbol(a, Decl(systemModule13.ts, 2, 36))
|
||||
>z0 : Symbol(z0, Decl(systemModule13.ts, 2, 14))
|
||||
>b : Symbol(b, Decl(systemModule13.ts, 2, 44))
|
||||
>c : Symbol(c, Decl(systemModule13.ts, 2, 49))
|
||||
>z1 : Symbol(z1, Decl(systemModule13.ts, 2, 25))
|
||||
>a : Symbol(a, Decl(systemModule13.ts, 2, 36))
|
||||
>b : Symbol(b, Decl(systemModule13.ts, 2, 44))
|
||||
|
||||
@@ -78,7 +78,10 @@ export let [y] = [1];
|
||||
>y : Symbol(y, Decl(systemModule8.ts, 27, 12))
|
||||
|
||||
export const {a: z0, b: {c: z1}} = {a: true, b: {c: "123"}};
|
||||
>a : Symbol(a, Decl(systemModule8.ts, 28, 36))
|
||||
>z0 : Symbol(z0, Decl(systemModule8.ts, 28, 14))
|
||||
>b : Symbol(b, Decl(systemModule8.ts, 28, 44))
|
||||
>c : Symbol(c, Decl(systemModule8.ts, 28, 49))
|
||||
>z1 : Symbol(z1, Decl(systemModule8.ts, 28, 25))
|
||||
>a : Symbol(a, Decl(systemModule8.ts, 28, 36))
|
||||
>b : Symbol(b, Decl(systemModule8.ts, 28, 44))
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
|
||||
//// function func2({ a, b/*parameter2*/
|
||||
|
||||
test.markers().forEach((m) => {
|
||||
test.markers().forEach(m => {
|
||||
goTo.position(m.position, m.fileName);
|
||||
verify.completionListIsEmpty();
|
||||
});
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// [|property1|]: number;
|
||||
//// property2: string;
|
||||
////}
|
||||
////
|
||||
////var foo: I;
|
||||
////var { [|property1|]: prop1 } = foo;
|
||||
|
||||
let ranges = test.ranges();
|
||||
for (let range of ranges) {
|
||||
goTo.position(range.start);
|
||||
|
||||
verify.referencesCountIs(ranges.length);
|
||||
for (let expectedRange of ranges) {
|
||||
verify.referencesAtPositionContains(expectedRange);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// [|property1|]: number;
|
||||
//// property2: string;
|
||||
////}
|
||||
////
|
||||
////var foo: I;
|
||||
////var { [|property1|]: {} } = foo;
|
||||
|
||||
let ranges = test.ranges();
|
||||
for (let range of ranges) {
|
||||
goTo.position(range.start);
|
||||
|
||||
verify.referencesCountIs(ranges.length);
|
||||
for (let expectedRange of ranges) {
|
||||
verify.referencesAtPositionContains(expectedRange);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// [|property1|]: number;
|
||||
//// property2: string;
|
||||
////}
|
||||
////
|
||||
////var foo: I;
|
||||
////var [{ [|property1|]: prop1 }, { property1, property2 } ] = [foo, foo];
|
||||
|
||||
let ranges = test.ranges();
|
||||
for (let range of ranges) {
|
||||
goTo.position(range.start);
|
||||
|
||||
verify.referencesCountIs(ranges.length);
|
||||
for (let expectedRange of ranges) {
|
||||
verify.referencesAtPositionContains(expectedRange);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// [|property1|]: number;
|
||||
//// property2: string;
|
||||
////}
|
||||
////
|
||||
////function f({ /**/[|property1|]: p1 }: I,
|
||||
//// { /*SHOULD_BE_A_REFERENCE*/property1 }: I,
|
||||
//// { property1: p2 }) {
|
||||
////
|
||||
//// return property1 + 1;
|
||||
////}
|
||||
|
||||
// NOTE: In the future, the identifier at
|
||||
// SHOULD_BE_A_REFERENCE should be in the set of ranges.
|
||||
goTo.marker();
|
||||
|
||||
let ranges = test.ranges();
|
||||
verify.referencesCountIs(ranges.length);
|
||||
for (let expectedRange of ranges) {
|
||||
verify.referencesAtPositionContains(expectedRange);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// property1: number;
|
||||
//// property2: string;
|
||||
////}
|
||||
////
|
||||
////function f({ /**/property1: p }, { property1 }) {
|
||||
//// let x = property1;
|
||||
////}
|
||||
|
||||
goTo.marker();
|
||||
verify.referencesCountIs(0);
|
||||
@@ -0,0 +1,30 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// [|property1|]: number;
|
||||
//// property2: string;
|
||||
////}
|
||||
////
|
||||
////var elems: I[];
|
||||
////for (let { [|property1|]: p } of elems) {
|
||||
////}
|
||||
////for (let { property1 } of elems) {
|
||||
////}
|
||||
////for (var { [|property1|]: p1 } of elems) {
|
||||
////}
|
||||
////var p2;
|
||||
////for ({ property1 : p2 } of elems) {
|
||||
////}
|
||||
|
||||
// Note: if this test ever changes, consider updating
|
||||
// 'quickInfoForObjectBindingElementPropertyName05.ts'
|
||||
|
||||
let ranges = test.ranges();
|
||||
for (let range of ranges) {
|
||||
goTo.position(range.start);
|
||||
|
||||
verify.referencesCountIs(ranges.length);
|
||||
for (let expectedRange of ranges) {
|
||||
verify.referencesAtPositionContains(expectedRange);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////let p, b;
|
||||
////
|
||||
////p, [{ [|a|]: p, b }] = [{ [|a|]: 10, b: true }];
|
||||
|
||||
let ranges = test.ranges();
|
||||
for (let range of ranges) {
|
||||
goTo.position(range.start);
|
||||
|
||||
verify.referencesCountIs(ranges.length);
|
||||
for (let expectedRange of ranges) {
|
||||
verify.referencesAtPositionContains(expectedRange);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// /*SHOULD_BE_A_REFERENCE1*/property1: number;
|
||||
//// property2: string;
|
||||
////}
|
||||
////
|
||||
////function f({ /*SHOULD_BE_A_REFERENCE2*/property1: p1 }: I,
|
||||
//// { /**/[|property1|] }: I,
|
||||
//// { property1: p2 }) {
|
||||
////
|
||||
//// return [|property1|] + 1;
|
||||
////}
|
||||
|
||||
// NOTE: In the future, the identifiers at
|
||||
// SHOULD_BE_A_REFERENCE[1/2] should be in the set of ranges.
|
||||
goTo.marker();
|
||||
|
||||
let ranges = test.ranges();
|
||||
verify.referencesCountIs(ranges.length);
|
||||
for (let expectedRange of ranges) {
|
||||
verify.referencesAtPositionContains(expectedRange);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface Recursive {
|
||||
//// [|next|]?: Recursive;
|
||||
//// value: any;
|
||||
////}
|
||||
////
|
||||
////function f ({ [|next|]: { [|next|]: x} }: Recursive) {
|
||||
////}
|
||||
|
||||
let ranges = test.ranges();
|
||||
for (let range of ranges) {
|
||||
goTo.position(range.start);
|
||||
|
||||
verify.referencesCountIs(ranges.length);
|
||||
for (let expectedRange of ranges) {
|
||||
verify.referencesAtPositionContains(expectedRange);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// /*def*/property1: number;
|
||||
//// property2: string;
|
||||
////}
|
||||
////
|
||||
////var foo: I;
|
||||
////var { /*use*/property1: prop1 } = foo;
|
||||
|
||||
goTo.marker("use");
|
||||
verify.definitionLocationExists();
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("def");
|
||||
@@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// property1: number;
|
||||
//// property2: string;
|
||||
////}
|
||||
////
|
||||
////var foo: I;
|
||||
////var { /**/property1 } = foo;
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs("var property1: number");
|
||||
@@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// property1: number;
|
||||
//// property2: string;
|
||||
////}
|
||||
////
|
||||
////var foo: I;
|
||||
////var { property1: /**/prop1 } = foo;
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs("var prop1: number");
|
||||
@@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// property1: number;
|
||||
//// property2: string;
|
||||
////}
|
||||
////
|
||||
////var foo: I;
|
||||
////var { /**/property1: prop1 } = foo;
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs("(property) I.property1: number");
|
||||
@@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// property1: number;
|
||||
//// property2: string;
|
||||
////}
|
||||
////
|
||||
////var foo: I;
|
||||
////var { /**/property1: {} } = foo;
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs("(property) I.property1: number");
|
||||
@@ -0,0 +1,14 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface Recursive {
|
||||
//// next?: Recursive;
|
||||
//// value: any;
|
||||
////}
|
||||
////
|
||||
////function f ({ /*1*/next: { /*2*/next: x} }: Recursive) {
|
||||
////}
|
||||
|
||||
for (let { position } of test.markers()) {
|
||||
goTo.position(position)
|
||||
verify.quickInfoIs("(property) Recursive.next: Recursive");
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface Recursive {
|
||||
//// next?: Recursive;
|
||||
//// value: any;
|
||||
////}
|
||||
////
|
||||
////function f ({ /*1*/next: { /*2*/next: x} }) {
|
||||
////}
|
||||
|
||||
goTo.marker("1");
|
||||
verify.quickInfoIs(`(property) next: {
|
||||
next: any;
|
||||
}`);
|
||||
|
||||
goTo.marker("2");
|
||||
verify.quickInfoIs("(property) next: any");
|
||||
@@ -0,0 +1,14 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface I {
|
||||
//// [|property1|]: number;
|
||||
//// property2: string;
|
||||
////}
|
||||
////
|
||||
////var foo: I;
|
||||
////var { [|property1|]: prop1 } = foo;
|
||||
|
||||
for (let range of test.ranges()) {
|
||||
goTo.position(range.start);
|
||||
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);
|
||||
}
|
||||
Reference in New Issue
Block a user