mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Fix getting completion details for meta properties (#45031)
* Fix getting completion details for meta properties. * Move inside the worker. * Move ImportMeta handling to completions.ts * Fix property type name for new.target. * Use symbols for ImportMeta completions. * Accept baselines. * Revert lib change. * Revert needless parser change. * Missed these reverts. * Remove now unused `isMetaPropertyExpression` * Move up meta property keyword check to be done in `getSymbolAtLocation` and `getTypeOfNode` * Call `checkNewTargetMetaProperty` directly and handle when it's an error type. * Make meta property expression types synthetic. * Make event.target and import.meta properties readonly * Add a test for go to definition (I think?) * Copy built-in types/values test for go to definition. * Add tests for go to definition when not a module. * Fix "go to definition" for new.target
This commit is contained in:
parent
318930b9e3
commit
03dff41c9f
@ -921,6 +921,7 @@ namespace ts {
|
||||
let deferredGlobalAsyncGeneratorType: GenericType;
|
||||
let deferredGlobalTemplateStringsArrayType: ObjectType;
|
||||
let deferredGlobalImportMetaType: ObjectType;
|
||||
let deferredGlobalImportMetaExpressionType: ObjectType;
|
||||
let deferredGlobalExtractSymbol: Symbol;
|
||||
let deferredGlobalOmitSymbol: Symbol;
|
||||
let deferredGlobalBigIntType: ObjectType;
|
||||
@ -13324,6 +13325,24 @@ namespace ts {
|
||||
return deferredGlobalImportMetaType || (deferredGlobalImportMetaType = getGlobalType("ImportMeta" as __String, /*arity*/ 0, /*reportErrors*/ true)) || emptyObjectType;
|
||||
}
|
||||
|
||||
function getGlobalImportMetaExpressionType() {
|
||||
if (!deferredGlobalImportMetaExpressionType) {
|
||||
// Create a synthetic type `ImportMetaExpression { meta: MetaProperty }`
|
||||
const symbol = createSymbol(SymbolFlags.None, "ImportMetaExpression" as __String);
|
||||
const importMetaType = getGlobalImportMetaType();
|
||||
|
||||
const metaPropertySymbol = createSymbol(SymbolFlags.Property, "meta" as __String, CheckFlags.Readonly);
|
||||
metaPropertySymbol.parent = symbol;
|
||||
metaPropertySymbol.type = importMetaType;
|
||||
|
||||
const members = createSymbolTable([metaPropertySymbol]);
|
||||
symbol.members = members;
|
||||
|
||||
deferredGlobalImportMetaExpressionType = createAnonymousType(symbol, members, emptyArray, emptyArray, emptyArray);
|
||||
}
|
||||
return deferredGlobalImportMetaExpressionType;
|
||||
}
|
||||
|
||||
function getGlobalESSymbolConstructorSymbol(reportErrors: boolean) {
|
||||
return deferredGlobalESSymbolConstructorSymbol || (deferredGlobalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol" as __String, reportErrors));
|
||||
}
|
||||
@ -30465,6 +30484,18 @@ namespace ts {
|
||||
return Debug.assertNever(node.keywordToken);
|
||||
}
|
||||
|
||||
function checkMetaPropertyKeyword(node: MetaProperty): Type {
|
||||
switch (node.keywordToken) {
|
||||
case SyntaxKind.ImportKeyword:
|
||||
return getGlobalImportMetaExpressionType();
|
||||
case SyntaxKind.NewKeyword:
|
||||
const type = checkNewTargetMetaProperty(node);
|
||||
return type === errorType ? errorType : createNewTargetExpressionType(type);
|
||||
default:
|
||||
Debug.assertNever(node.keywordToken);
|
||||
}
|
||||
}
|
||||
|
||||
function checkNewTargetMetaProperty(node: MetaProperty) {
|
||||
const container = getNewTargetContainer(node);
|
||||
if (!container) {
|
||||
@ -30487,7 +30518,6 @@ namespace ts {
|
||||
}
|
||||
const file = getSourceFileOfNode(node);
|
||||
Debug.assert(!!(file.flags & NodeFlags.PossiblyContainsImportMeta), "Containing file is missing import meta node flag.");
|
||||
Debug.assert(!!file.externalModuleIndicator, "Containing file should be a module.");
|
||||
return node.name.escapedText === "meta" ? getGlobalImportMetaType() : errorType;
|
||||
}
|
||||
|
||||
@ -30849,6 +30879,19 @@ namespace ts {
|
||||
return promiseType;
|
||||
}
|
||||
|
||||
function createNewTargetExpressionType(targetType: Type): Type {
|
||||
// Create a synthetic type `NewTargetExpression { target: TargetType; }`
|
||||
const symbol = createSymbol(SymbolFlags.None, "NewTargetExpression" as __String);
|
||||
|
||||
const targetPropertySymbol = createSymbol(SymbolFlags.Property, "target" as __String, CheckFlags.Readonly);
|
||||
targetPropertySymbol.parent = symbol;
|
||||
targetPropertySymbol.type = targetType;
|
||||
|
||||
const members = createSymbolTable([targetPropertySymbol]);
|
||||
symbol.members = members;
|
||||
return createAnonymousType(symbol, members, emptyArray, emptyArray, emptyArray);
|
||||
}
|
||||
|
||||
function getReturnTypeFromBody(func: FunctionLikeDeclaration, checkMode?: CheckMode): Type {
|
||||
if (!func.body) {
|
||||
return errorType;
|
||||
@ -39784,6 +39827,16 @@ namespace ts {
|
||||
return propertyDeclaration;
|
||||
}
|
||||
}
|
||||
else if (isMetaProperty(parent)) {
|
||||
const parentType = getTypeOfNode(parent);
|
||||
const propertyDeclaration = getPropertyOfType(parentType, (node as Identifier).escapedText);
|
||||
if (propertyDeclaration) {
|
||||
return propertyDeclaration;
|
||||
}
|
||||
if (parent.keywordToken === SyntaxKind.NewKeyword) {
|
||||
return checkNewTargetMetaProperty(parent).symbol;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (node.kind) {
|
||||
@ -39858,6 +39911,12 @@ namespace ts {
|
||||
case SyntaxKind.ExportKeyword:
|
||||
return isExportAssignment(node.parent) ? Debug.checkDefined(node.parent.symbol) : undefined;
|
||||
|
||||
case SyntaxKind.ImportKeyword:
|
||||
case SyntaxKind.NewKeyword:
|
||||
return isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : undefined;
|
||||
case SyntaxKind.MetaProperty:
|
||||
return checkExpression(node as Expression).symbol;
|
||||
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
@ -39957,6 +40016,10 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
if (isMetaProperty(node.parent) && node.parent.keywordToken === node.kind) {
|
||||
return checkMetaPropertyKeyword(node.parent);
|
||||
}
|
||||
|
||||
return errorType;
|
||||
}
|
||||
|
||||
|
||||
@ -1355,9 +1355,12 @@ namespace ts.Completions {
|
||||
node = (parent as ModuleDeclaration).name;
|
||||
break;
|
||||
case SyntaxKind.ImportType:
|
||||
case SyntaxKind.MetaProperty:
|
||||
node = parent;
|
||||
break;
|
||||
case SyntaxKind.MetaProperty:
|
||||
node = parent.getFirstToken(sourceFile)!;
|
||||
Debug.assert(node.kind === SyntaxKind.ImportKeyword || node.kind === SyntaxKind.NewKeyword);
|
||||
break;
|
||||
default:
|
||||
// There is nothing that precedes the dot, so this likely just a stray character
|
||||
// or leading into a '...' token. Just bail out instead.
|
||||
@ -1598,12 +1601,6 @@ namespace ts.Completions {
|
||||
}
|
||||
}
|
||||
|
||||
if (isMetaProperty(node) && (node.keywordToken === SyntaxKind.NewKeyword || node.keywordToken === SyntaxKind.ImportKeyword) && contextToken === node.getChildAt(1)) {
|
||||
const completion = (node.keywordToken === SyntaxKind.NewKeyword) ? "target" : "meta";
|
||||
symbols.push(typeChecker.createSymbol(SymbolFlags.Property, escapeLeadingUnderscores(completion)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isTypeLocation) {
|
||||
let type = typeChecker.getTypeAtLocation(node).getNonOptionalType();
|
||||
let insertQuestionDot = false;
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
|
||||
@ -18,6 +19,7 @@
|
||||
|
||||
const size = import.meta.scriptElement.dataset.size || 300;
|
||||
>size : Symbol(size, Decl(example.ts, 5, 7))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
const image = new Image();
|
||||
>image : Symbol(image, Decl(example.ts, 7, 7))
|
||||
@ -54,6 +56,7 @@
|
||||
=== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts ===
|
||||
export let x = import.meta;
|
||||
>x : Symbol(x, Decl(moduleLookingFile01.ts, 0, 10))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
export let y = import.metal;
|
||||
>y : Symbol(y, Decl(moduleLookingFile01.ts, 1, 10))
|
||||
@ -64,6 +67,7 @@ export let z = import.import.import.malkovich;
|
||||
=== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts ===
|
||||
let globalA = import.meta;
|
||||
>globalA : Symbol(globalA, Decl(scriptLookingFile01.ts, 0, 3))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
let globalB = import.metal;
|
||||
>globalB : Symbol(globalB, Decl(scriptLookingFile01.ts, 1, 3))
|
||||
@ -75,8 +79,12 @@ let globalC = import.import.import.malkovich;
|
||||
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
import.meta = foo;
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
|
||||
// @Filename augmentations.ts
|
||||
@ -99,5 +107,6 @@ const { a, b, c } = import.meta.wellKnownProperty;
|
||||
>b : Symbol(b, Decl(assignmentTargets.ts, 10, 10))
|
||||
>c : Symbol(c, Decl(assignmentTargets.ts, 10, 13))
|
||||
>import.meta.wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
|
||||
@ -18,6 +19,7 @@
|
||||
|
||||
const size = import.meta.scriptElement.dataset.size || 300;
|
||||
>size : Symbol(size, Decl(example.ts, 5, 7))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
const image = new Image();
|
||||
>image : Symbol(image, Decl(example.ts, 7, 7))
|
||||
@ -54,6 +56,7 @@
|
||||
=== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts ===
|
||||
export let x = import.meta;
|
||||
>x : Symbol(x, Decl(moduleLookingFile01.ts, 0, 10))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
export let y = import.metal;
|
||||
>y : Symbol(y, Decl(moduleLookingFile01.ts, 1, 10))
|
||||
@ -64,6 +67,7 @@ export let z = import.import.import.malkovich;
|
||||
=== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts ===
|
||||
let globalA = import.meta;
|
||||
>globalA : Symbol(globalA, Decl(scriptLookingFile01.ts, 0, 3))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
let globalB = import.metal;
|
||||
>globalB : Symbol(globalB, Decl(scriptLookingFile01.ts, 1, 3))
|
||||
@ -75,8 +79,12 @@ let globalC = import.import.import.malkovich;
|
||||
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
import.meta = foo;
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
|
||||
// @Filename augmentations.ts
|
||||
@ -99,5 +107,6 @@ const { a, b, c } = import.meta.wellKnownProperty;
|
||||
>b : Symbol(b, Decl(assignmentTargets.ts, 10, 10))
|
||||
>c : Symbol(c, Decl(assignmentTargets.ts, 10, 13))
|
||||
>import.meta.wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
|
||||
@ -18,6 +19,7 @@
|
||||
|
||||
const size = import.meta.scriptElement.dataset.size || 300;
|
||||
>size : Symbol(size, Decl(example.ts, 5, 7))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
const image = new Image();
|
||||
>image : Symbol(image, Decl(example.ts, 7, 7))
|
||||
@ -54,6 +56,7 @@
|
||||
=== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts ===
|
||||
export let x = import.meta;
|
||||
>x : Symbol(x, Decl(moduleLookingFile01.ts, 0, 10))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
export let y = import.metal;
|
||||
>y : Symbol(y, Decl(moduleLookingFile01.ts, 1, 10))
|
||||
@ -64,6 +67,7 @@ export let z = import.import.import.malkovich;
|
||||
=== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts ===
|
||||
let globalA = import.meta;
|
||||
>globalA : Symbol(globalA, Decl(scriptLookingFile01.ts, 0, 3))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
let globalB = import.metal;
|
||||
>globalB : Symbol(globalB, Decl(scriptLookingFile01.ts, 1, 3))
|
||||
@ -75,8 +79,12 @@ let globalC = import.import.import.malkovich;
|
||||
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
import.meta = foo;
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
|
||||
// @Filename augmentations.ts
|
||||
@ -99,5 +107,6 @@ const { a, b, c } = import.meta.wellKnownProperty;
|
||||
>b : Symbol(b, Decl(assignmentTargets.ts, 10, 10))
|
||||
>c : Symbol(c, Decl(assignmentTargets.ts, 10, 13))
|
||||
>import.meta.wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
|
||||
@ -18,6 +19,7 @@
|
||||
|
||||
const size = import.meta.scriptElement.dataset.size || 300;
|
||||
>size : Symbol(size, Decl(example.ts, 5, 7))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
const image = new Image();
|
||||
>image : Symbol(image, Decl(example.ts, 7, 7))
|
||||
@ -54,6 +56,7 @@
|
||||
=== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts ===
|
||||
export let x = import.meta;
|
||||
>x : Symbol(x, Decl(moduleLookingFile01.ts, 0, 10))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
export let y = import.metal;
|
||||
>y : Symbol(y, Decl(moduleLookingFile01.ts, 1, 10))
|
||||
@ -64,6 +67,7 @@ export let z = import.import.import.malkovich;
|
||||
=== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts ===
|
||||
let globalA = import.meta;
|
||||
>globalA : Symbol(globalA, Decl(scriptLookingFile01.ts, 0, 3))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
let globalB = import.metal;
|
||||
>globalB : Symbol(globalB, Decl(scriptLookingFile01.ts, 1, 3))
|
||||
@ -75,8 +79,12 @@ let globalC = import.import.import.malkovich;
|
||||
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
import.meta = foo;
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
|
||||
// @Filename augmentations.ts
|
||||
@ -99,5 +107,6 @@ const { a, b, c } = import.meta.wellKnownProperty;
|
||||
>b : Symbol(b, Decl(assignmentTargets.ts, 10, 10))
|
||||
>c : Symbol(c, Decl(assignmentTargets.ts, 10, 13))
|
||||
>import.meta.wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
|
||||
@ -18,6 +19,7 @@
|
||||
|
||||
const size = import.meta.scriptElement.dataset.size || 300;
|
||||
>size : Symbol(size, Decl(example.ts, 5, 7))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
const image = new Image();
|
||||
>image : Symbol(image, Decl(example.ts, 7, 7))
|
||||
@ -54,6 +56,7 @@
|
||||
=== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts ===
|
||||
export let x = import.meta;
|
||||
>x : Symbol(x, Decl(moduleLookingFile01.ts, 0, 10))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
export let y = import.metal;
|
||||
>y : Symbol(y, Decl(moduleLookingFile01.ts, 1, 10))
|
||||
@ -64,6 +67,7 @@ export let z = import.import.import.malkovich;
|
||||
=== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts ===
|
||||
let globalA = import.meta;
|
||||
>globalA : Symbol(globalA, Decl(scriptLookingFile01.ts, 0, 3))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
let globalB = import.metal;
|
||||
>globalB : Symbol(globalB, Decl(scriptLookingFile01.ts, 1, 3))
|
||||
@ -75,8 +79,12 @@ let globalC = import.import.import.malkovich;
|
||||
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
import.meta = foo;
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
|
||||
// @Filename augmentations.ts
|
||||
@ -99,5 +107,6 @@ const { a, b, c } = import.meta.wellKnownProperty;
|
||||
>b : Symbol(b, Decl(assignmentTargets.ts, 10, 10))
|
||||
>c : Symbol(c, Decl(assignmentTargets.ts, 10, 13))
|
||||
>import.meta.wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
|
||||
@ -18,6 +19,7 @@
|
||||
|
||||
const size = import.meta.scriptElement.dataset.size || 300;
|
||||
>size : Symbol(size, Decl(example.ts, 5, 7))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
const image = new Image();
|
||||
>image : Symbol(image, Decl(example.ts, 7, 7))
|
||||
@ -54,6 +56,7 @@
|
||||
=== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts ===
|
||||
export let x = import.meta;
|
||||
>x : Symbol(x, Decl(moduleLookingFile01.ts, 0, 10))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
export let y = import.metal;
|
||||
>y : Symbol(y, Decl(moduleLookingFile01.ts, 1, 10))
|
||||
@ -64,6 +67,7 @@ export let z = import.import.import.malkovich;
|
||||
=== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts ===
|
||||
let globalA = import.meta;
|
||||
>globalA : Symbol(globalA, Decl(scriptLookingFile01.ts, 0, 3))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
let globalB = import.metal;
|
||||
>globalB : Symbol(globalB, Decl(scriptLookingFile01.ts, 1, 3))
|
||||
@ -75,8 +79,12 @@ let globalC = import.import.import.malkovich;
|
||||
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
import.meta = foo;
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
|
||||
// @Filename augmentations.ts
|
||||
@ -99,5 +107,6 @@ const { a, b, c } = import.meta.wellKnownProperty;
|
||||
>b : Symbol(b, Decl(assignmentTargets.ts, 10, 10))
|
||||
>c : Symbol(c, Decl(assignmentTargets.ts, 10, 13))
|
||||
>import.meta.wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
|
||||
@ -18,6 +19,7 @@
|
||||
|
||||
const size = import.meta.scriptElement.dataset.size || 300;
|
||||
>size : Symbol(size, Decl(example.ts, 5, 7))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
const image = new Image();
|
||||
>image : Symbol(image, Decl(example.ts, 7, 7))
|
||||
@ -54,6 +56,7 @@
|
||||
=== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts ===
|
||||
export let x = import.meta;
|
||||
>x : Symbol(x, Decl(moduleLookingFile01.ts, 0, 10))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
export let y = import.metal;
|
||||
>y : Symbol(y, Decl(moduleLookingFile01.ts, 1, 10))
|
||||
@ -64,6 +67,7 @@ export let z = import.import.import.malkovich;
|
||||
=== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts ===
|
||||
let globalA = import.meta;
|
||||
>globalA : Symbol(globalA, Decl(scriptLookingFile01.ts, 0, 3))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
let globalB = import.metal;
|
||||
>globalB : Symbol(globalB, Decl(scriptLookingFile01.ts, 1, 3))
|
||||
@ -75,8 +79,12 @@ let globalC = import.import.import.malkovich;
|
||||
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
import.meta = foo;
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
|
||||
// @Filename augmentations.ts
|
||||
@ -99,5 +107,6 @@ const { a, b, c } = import.meta.wellKnownProperty;
|
||||
>b : Symbol(b, Decl(assignmentTargets.ts, 10, 10))
|
||||
>c : Symbol(c, Decl(assignmentTargets.ts, 10, 13))
|
||||
>import.meta.wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
>new URL("../hamsters.jpg", import.meta.url).toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
>URL : Symbol(URL, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --))
|
||||
>toString : Symbol(URL.toString, Decl(lib.dom.d.ts, --, --))
|
||||
|
||||
@ -18,6 +19,7 @@
|
||||
|
||||
const size = import.meta.scriptElement.dataset.size || 300;
|
||||
>size : Symbol(size, Decl(example.ts, 5, 7))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
const image = new Image();
|
||||
>image : Symbol(image, Decl(example.ts, 7, 7))
|
||||
@ -54,6 +56,7 @@
|
||||
=== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts ===
|
||||
export let x = import.meta;
|
||||
>x : Symbol(x, Decl(moduleLookingFile01.ts, 0, 10))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
export let y = import.metal;
|
||||
>y : Symbol(y, Decl(moduleLookingFile01.ts, 1, 10))
|
||||
@ -64,6 +67,7 @@ export let z = import.import.import.malkovich;
|
||||
=== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts ===
|
||||
let globalA = import.meta;
|
||||
>globalA : Symbol(globalA, Decl(scriptLookingFile01.ts, 0, 3))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
let globalB = import.metal;
|
||||
>globalB : Symbol(globalB, Decl(scriptLookingFile01.ts, 1, 3))
|
||||
@ -75,8 +79,12 @@ let globalC = import.import.import.malkovich;
|
||||
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
|
||||
import.meta = foo;
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>foo : Symbol(foo, Decl(assignmentTargets.ts, 0, 12))
|
||||
|
||||
// @Filename augmentations.ts
|
||||
@ -99,5 +107,6 @@ const { a, b, c } = import.meta.wellKnownProperty;
|
||||
>b : Symbol(b, Decl(assignmentTargets.ts, 10, 10))
|
||||
>c : Symbol(c, Decl(assignmentTargets.ts, 10, 13))
|
||||
>import.meta.wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(assignmentTargets.ts, 4, 16))
|
||||
>wellKnownProperty : Symbol(ImportMeta.wellKnownProperty, Decl(assignmentTargets.ts, 5, 24))
|
||||
|
||||
|
||||
@ -6,10 +6,12 @@ declare global { interface ImportMeta {foo?: () => void} };
|
||||
|
||||
if (import.meta.foo) {
|
||||
>import.meta.foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16))
|
||||
>foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39))
|
||||
|
||||
import.meta.foo();
|
||||
>import.meta.foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16))
|
||||
>foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39))
|
||||
}
|
||||
|
||||
|
||||
@ -6,10 +6,12 @@ declare global { interface ImportMeta {foo?: () => void} };
|
||||
|
||||
if (import.meta.foo) {
|
||||
>import.meta.foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16))
|
||||
>foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39))
|
||||
|
||||
import.meta.foo();
|
||||
>import.meta.foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16))
|
||||
>foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39))
|
||||
}
|
||||
|
||||
|
||||
@ -6,10 +6,12 @@ declare global { interface ImportMeta {foo?: () => void} };
|
||||
|
||||
if (import.meta.foo) {
|
||||
>import.meta.foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16))
|
||||
>foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39))
|
||||
|
||||
import.meta.foo();
|
||||
>import.meta.foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39))
|
||||
>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16))
|
||||
>foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39))
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
=== tests/cases/compiler/misspelledNewMetaProperty.ts ===
|
||||
function foo(){new.targ}
|
||||
>foo : Symbol(foo, Decl(misspelledNewMetaProperty.ts, 0, 0))
|
||||
>new.targ : Symbol(foo, Decl(misspelledNewMetaProperty.ts, 0, 0))
|
||||
>targ : Symbol(foo, Decl(misspelledNewMetaProperty.ts, 0, 0))
|
||||
|
||||
|
||||
@ -5,15 +5,23 @@ class A {
|
||||
constructor() {
|
||||
const a = new.target;
|
||||
>a : Symbol(a, Decl(newTarget.es5.ts, 2, 13))
|
||||
>new.target : Symbol(A, Decl(newTarget.es5.ts, 0, 0))
|
||||
>target : Symbol(A, Decl(newTarget.es5.ts, 0, 0))
|
||||
|
||||
const b = () => new.target;
|
||||
>b : Symbol(b, Decl(newTarget.es5.ts, 3, 13))
|
||||
>new.target : Symbol(A, Decl(newTarget.es5.ts, 0, 0))
|
||||
>target : Symbol(A, Decl(newTarget.es5.ts, 0, 0))
|
||||
}
|
||||
static c = function () { return new.target; }
|
||||
>c : Symbol(A.c, Decl(newTarget.es5.ts, 4, 5))
|
||||
>new.target : Symbol((Anonymous function), Decl(newTarget.es5.ts, 5, 14))
|
||||
>target : Symbol((Anonymous function), Decl(newTarget.es5.ts, 5, 14))
|
||||
|
||||
d = function () { return new.target; }
|
||||
>d : Symbol(A.d, Decl(newTarget.es5.ts, 5, 49))
|
||||
>new.target : Symbol((Anonymous function), Decl(newTarget.es5.ts, 6, 7))
|
||||
>target : Symbol((Anonymous function), Decl(newTarget.es5.ts, 6, 7))
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
@ -26,9 +34,13 @@ class B extends A {
|
||||
|
||||
const e = new.target;
|
||||
>e : Symbol(e, Decl(newTarget.es5.ts, 12, 13))
|
||||
>new.target : Symbol(B, Decl(newTarget.es5.ts, 7, 1))
|
||||
>target : Symbol(B, Decl(newTarget.es5.ts, 7, 1))
|
||||
|
||||
const f = () => new.target;
|
||||
>f : Symbol(f, Decl(newTarget.es5.ts, 13, 13))
|
||||
>new.target : Symbol(B, Decl(newTarget.es5.ts, 7, 1))
|
||||
>target : Symbol(B, Decl(newTarget.es5.ts, 7, 1))
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,9 +49,13 @@ function f1() {
|
||||
|
||||
const g = new.target;
|
||||
>g : Symbol(g, Decl(newTarget.es5.ts, 18, 9))
|
||||
>new.target : Symbol(f1, Decl(newTarget.es5.ts, 15, 1))
|
||||
>target : Symbol(f1, Decl(newTarget.es5.ts, 15, 1))
|
||||
|
||||
const h = () => new.target;
|
||||
>h : Symbol(h, Decl(newTarget.es5.ts, 19, 9))
|
||||
>new.target : Symbol(f1, Decl(newTarget.es5.ts, 15, 1))
|
||||
>target : Symbol(f1, Decl(newTarget.es5.ts, 15, 1))
|
||||
}
|
||||
|
||||
const f2 = function () {
|
||||
@ -47,9 +63,13 @@ const f2 = function () {
|
||||
|
||||
const i = new.target;
|
||||
>i : Symbol(i, Decl(newTarget.es5.ts, 23, 9))
|
||||
>new.target : Symbol(f2, Decl(newTarget.es5.ts, 22, 10))
|
||||
>target : Symbol(f2, Decl(newTarget.es5.ts, 22, 10))
|
||||
|
||||
const j = () => new.target;
|
||||
>j : Symbol(j, Decl(newTarget.es5.ts, 24, 9))
|
||||
>new.target : Symbol(f2, Decl(newTarget.es5.ts, 22, 10))
|
||||
>target : Symbol(f2, Decl(newTarget.es5.ts, 22, 10))
|
||||
}
|
||||
|
||||
const O = {
|
||||
@ -57,6 +77,8 @@ const O = {
|
||||
|
||||
k: function () { return new.target; }
|
||||
>k : Symbol(k, Decl(newTarget.es5.ts, 27, 11))
|
||||
>new.target : Symbol(k, Decl(newTarget.es5.ts, 28, 6))
|
||||
>target : Symbol(k, Decl(newTarget.es5.ts, 28, 6))
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -5,15 +5,23 @@ class A {
|
||||
constructor() {
|
||||
const a = new.target;
|
||||
>a : Symbol(a, Decl(newTarget.es6.ts, 2, 13))
|
||||
>new.target : Symbol(A, Decl(newTarget.es6.ts, 0, 0))
|
||||
>target : Symbol(A, Decl(newTarget.es6.ts, 0, 0))
|
||||
|
||||
const b = () => new.target;
|
||||
>b : Symbol(b, Decl(newTarget.es6.ts, 3, 13))
|
||||
>new.target : Symbol(A, Decl(newTarget.es6.ts, 0, 0))
|
||||
>target : Symbol(A, Decl(newTarget.es6.ts, 0, 0))
|
||||
}
|
||||
static c = function () { return new.target; }
|
||||
>c : Symbol(A.c, Decl(newTarget.es6.ts, 4, 5))
|
||||
>new.target : Symbol((Anonymous function), Decl(newTarget.es6.ts, 5, 14))
|
||||
>target : Symbol((Anonymous function), Decl(newTarget.es6.ts, 5, 14))
|
||||
|
||||
d = function () { return new.target; }
|
||||
>d : Symbol(A.d, Decl(newTarget.es6.ts, 5, 49))
|
||||
>new.target : Symbol((Anonymous function), Decl(newTarget.es6.ts, 6, 7))
|
||||
>target : Symbol((Anonymous function), Decl(newTarget.es6.ts, 6, 7))
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
@ -26,9 +34,13 @@ class B extends A {
|
||||
|
||||
const e = new.target;
|
||||
>e : Symbol(e, Decl(newTarget.es6.ts, 12, 13))
|
||||
>new.target : Symbol(B, Decl(newTarget.es6.ts, 7, 1))
|
||||
>target : Symbol(B, Decl(newTarget.es6.ts, 7, 1))
|
||||
|
||||
const f = () => new.target;
|
||||
>f : Symbol(f, Decl(newTarget.es6.ts, 13, 13))
|
||||
>new.target : Symbol(B, Decl(newTarget.es6.ts, 7, 1))
|
||||
>target : Symbol(B, Decl(newTarget.es6.ts, 7, 1))
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,9 +49,13 @@ function f1() {
|
||||
|
||||
const g = new.target;
|
||||
>g : Symbol(g, Decl(newTarget.es6.ts, 18, 9))
|
||||
>new.target : Symbol(f1, Decl(newTarget.es6.ts, 15, 1))
|
||||
>target : Symbol(f1, Decl(newTarget.es6.ts, 15, 1))
|
||||
|
||||
const h = () => new.target;
|
||||
>h : Symbol(h, Decl(newTarget.es6.ts, 19, 9))
|
||||
>new.target : Symbol(f1, Decl(newTarget.es6.ts, 15, 1))
|
||||
>target : Symbol(f1, Decl(newTarget.es6.ts, 15, 1))
|
||||
}
|
||||
|
||||
const f2 = function () {
|
||||
@ -47,9 +63,13 @@ const f2 = function () {
|
||||
|
||||
const i = new.target;
|
||||
>i : Symbol(i, Decl(newTarget.es6.ts, 23, 9))
|
||||
>new.target : Symbol(f2, Decl(newTarget.es6.ts, 22, 10))
|
||||
>target : Symbol(f2, Decl(newTarget.es6.ts, 22, 10))
|
||||
|
||||
const j = () => new.target;
|
||||
>j : Symbol(j, Decl(newTarget.es6.ts, 24, 9))
|
||||
>new.target : Symbol(f2, Decl(newTarget.es6.ts, 22, 10))
|
||||
>target : Symbol(f2, Decl(newTarget.es6.ts, 22, 10))
|
||||
}
|
||||
|
||||
const O = {
|
||||
@ -57,6 +77,8 @@ const O = {
|
||||
|
||||
k: function () { return new.target; }
|
||||
>k : Symbol(k, Decl(newTarget.es6.ts, 27, 11))
|
||||
>new.target : Symbol(k, Decl(newTarget.es6.ts, 28, 6))
|
||||
>target : Symbol(k, Decl(newTarget.es6.ts, 28, 6))
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -8,11 +8,15 @@ function f() {
|
||||
|
||||
if (new.target.marked === true) {
|
||||
>new.target.marked : Symbol(f.marked, Decl(newTargetNarrowing.ts, 6, 1))
|
||||
>new.target : Symbol(f, Decl(newTargetNarrowing.ts, 0, 25), Decl(newTargetNarrowing.ts, 6, 1))
|
||||
>target : Symbol(f, Decl(newTargetNarrowing.ts, 0, 25), Decl(newTargetNarrowing.ts, 6, 1))
|
||||
>marked : Symbol(f.marked, Decl(newTargetNarrowing.ts, 6, 1))
|
||||
|
||||
foo(new.target.marked);
|
||||
>foo : Symbol(foo, Decl(newTargetNarrowing.ts, 0, 0))
|
||||
>new.target.marked : Symbol(f.marked, Decl(newTargetNarrowing.ts, 6, 1))
|
||||
>new.target : Symbol(f, Decl(newTargetNarrowing.ts, 0, 25), Decl(newTargetNarrowing.ts, 6, 1))
|
||||
>target : Symbol(f, Decl(newTargetNarrowing.ts, 0, 25), Decl(newTargetNarrowing.ts, 6, 1))
|
||||
>marked : Symbol(f.marked, Decl(newTargetNarrowing.ts, 6, 1))
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,6 +56,8 @@ class C2 extends Base {
|
||||
|
||||
var t = new.target;
|
||||
>t : Symbol(t, Decl(shadowedReservedCompilerDeclarationsWithNoEmit.ts, 29, 11))
|
||||
>new.target : Symbol(C2, Decl(shadowedReservedCompilerDeclarationsWithNoEmit.ts, 23, 1))
|
||||
>target : Symbol(C2, Decl(shadowedReservedCompilerDeclarationsWithNoEmit.ts, 23, 1))
|
||||
|
||||
var y = _newTarget;
|
||||
>y : Symbol(y, Decl(shadowedReservedCompilerDeclarationsWithNoEmit.ts, 30, 11))
|
||||
|
||||
20
tests/cases/fourslash/completionForMetaProperty.ts
Normal file
20
tests/cases/fourslash/completionForMetaProperty.ts
Normal file
@ -0,0 +1,20 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////import./*1*/;
|
||||
////new./*2*/;
|
||||
////function test() { new./*3*/ }
|
||||
|
||||
verify.completions(
|
||||
{
|
||||
marker: "1",
|
||||
exact: [{ name: "meta", text: "(property) ImportMetaExpression.meta: ImportMeta" }]
|
||||
},
|
||||
{
|
||||
marker: "2",
|
||||
exact: []
|
||||
},
|
||||
{
|
||||
marker: "3",
|
||||
exact: [{ name: "target", text: "(property) NewTargetExpression.target: () => void" }]
|
||||
},
|
||||
);
|
||||
17
tests/cases/fourslash/goToDefinitionMetaProperty.ts
Normal file
17
tests/cases/fourslash/goToDefinitionMetaProperty.ts
Normal file
@ -0,0 +1,17 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /a.ts
|
||||
////im/*1*/port.met/*2*/a;
|
||||
////function /*functionDefinition*/f() { n/*3*/ew.[|t/*4*/arget|]; }
|
||||
|
||||
// @Filename: /b.ts
|
||||
////im/*5*/port.m;
|
||||
////class /*classDefinition*/c { constructor() { n/*6*/ew.[|t/*7*/arget|]; } }
|
||||
|
||||
verify.goToDefinition("1", []);
|
||||
verify.goToDefinition("2", []);
|
||||
verify.goToDefinition("3", []);
|
||||
verify.goToDefinition("4", ["functionDefinition"]);
|
||||
verify.goToDefinition("5", []);
|
||||
verify.goToDefinition("6", []);
|
||||
verify.goToDefinition("7", ["classDefinition"]);
|
||||
Loading…
x
Reference in New Issue
Block a user