diff --git a/lib/tsc.js b/lib/tsc.js index 6b8181ca9e483b14535154afc5848ac9742a4f41..b02cec7ed174684d180769178e571984c4b147e3 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -53658,14 +53658,35 @@ var ts; return unknownSymbol; } function resolveTypeReferenceName(typeReference, meaning, ignoreErrors) { + var _a; var name = getTypeReferenceName(typeReference); if (!name) { return unknownSymbol; } var symbol = resolveEntityName(name, meaning, ignoreErrors); + if (ts.isIdentifier(name) && name.escapedText === 'Record') { + var sourceFile = ts.getSourceFileOfNode(typeReference); + var declarationSourceFile = ((_a = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]) && ts.getSourceFileOfNode(symbol.declarations[0]); + var isFromStatic = sourceFile && declarationSourceFile && isStaticSourceFile(sourceFile) && isDynamicSourceFile(declarationSourceFile); + if (isFromStatic) { + symbol.isStatic = true; + } + } return symbol && symbol !== unknownSymbol ? symbol : ignoreErrors ? unknownSymbol : getUnresolvedSymbolForEntityName(name); } + function isStaticSourceFile(sourceFile) { + if (sourceFile.fileName.includes('static')) { + return true; + } + return false; + } + function isDynamicSourceFile(sourceFile) { + if (sourceFile.fileName.endsWith('/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/lib.es5.d.ts')) { + return true; + } + return false; + } function getTypeReferenceType(node, symbol) { if (symbol === unknownSymbol) { return errorType; diff --git a/lib/tsserver.js b/lib/tsserver.js index f59533126395a34a5cf54ddcb9bd6b1230d954c1..44c14ec3565a1a0cc101c2f2779ec53be7cf489b 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -64390,14 +64390,35 @@ var ts; return unknownSymbol; } function resolveTypeReferenceName(typeReference, meaning, ignoreErrors) { + var _a; var name = getTypeReferenceName(typeReference); if (!name) { return unknownSymbol; } var symbol = resolveEntityName(name, meaning, ignoreErrors); + if (ts.isIdentifier(name) && name.escapedText === 'Record') { + var sourceFile = ts.getSourceFileOfNode(typeReference); + var declarationSourceFile = ((_a = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]) && ts.getSourceFileOfNode(symbol.declarations[0]); + var isFromStatic = sourceFile && declarationSourceFile && isStaticSourceFile(sourceFile) && isDynamicSourceFile(declarationSourceFile); + if (isFromStatic) { + symbol.isStatic = true; + } + } return symbol && symbol !== unknownSymbol ? symbol : ignoreErrors ? unknownSymbol : getUnresolvedSymbolForEntityName(name); } + function isStaticSourceFile(sourceFile) { + if (sourceFile.fileName.includes('static')) { + return true; + } + return false; + } + function isDynamicSourceFile(sourceFile) { + if (sourceFile.fileName.endsWith('/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/lib.es5.d.ts')) { + return true; + } + return false; + } function getTypeReferenceType(node, symbol) { if (symbol === unknownSymbol) { return errorType; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index f1503e3e90ac77e64947ad5257b3f2d4f83bcef3..469ebff906b1a012f32c19af35a97fc4101f8640 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -64389,14 +64389,35 @@ var ts; return unknownSymbol; } function resolveTypeReferenceName(typeReference, meaning, ignoreErrors) { + var _a; var name = getTypeReferenceName(typeReference); if (!name) { return unknownSymbol; } var symbol = resolveEntityName(name, meaning, ignoreErrors); + if (ts.isIdentifier(name) && name.escapedText === 'Record') { + var sourceFile = ts.getSourceFileOfNode(typeReference); + var declarationSourceFile = ((_a = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]) && ts.getSourceFileOfNode(symbol.declarations[0]); + var isFromStatic = sourceFile && declarationSourceFile && isStaticSourceFile(sourceFile) && isDynamicSourceFile(declarationSourceFile); + if (isFromStatic) { + symbol.isStatic = true; + } + } return symbol && symbol !== unknownSymbol ? symbol : ignoreErrors ? unknownSymbol : getUnresolvedSymbolForEntityName(name); } + function isStaticSourceFile(sourceFile) { + if (sourceFile.fileName.includes('static')) { + return true; + } + return false; + } + function isDynamicSourceFile(sourceFile) { + if (sourceFile.fileName.endsWith('/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/lib.es5.d.ts')) { + return true; + } + return false; + } function getTypeReferenceType(node, symbol) { if (symbol === unknownSymbol) { return errorType; diff --git a/lib/typescript.js b/lib/typescript.js index b3b12717bf1e73f4c8f72e68f250f7804f7591d8..37a66474c548c8e8144343027db74d9e169183f6 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -64380,14 +64380,35 @@ var ts; return unknownSymbol; } function resolveTypeReferenceName(typeReference, meaning, ignoreErrors) { + var _a; var name = getTypeReferenceName(typeReference); if (!name) { return unknownSymbol; } var symbol = resolveEntityName(name, meaning, ignoreErrors); + if (ts.isIdentifier(name) && name.escapedText === 'Record') { + var sourceFile = ts.getSourceFileOfNode(typeReference); + var declarationSourceFile = ((_a = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]) && ts.getSourceFileOfNode(symbol.declarations[0]); + var isFromStatic = sourceFile && declarationSourceFile && isStaticSourceFile(sourceFile) && isDynamicSourceFile(declarationSourceFile); + if (isFromStatic) { + symbol.isStatic = true; + } + } return symbol && symbol !== unknownSymbol ? symbol : ignoreErrors ? unknownSymbol : getUnresolvedSymbolForEntityName(name); } + function isStaticSourceFile(sourceFile) { + if (sourceFile.fileName.includes('static')) { + return true; + } + return false; + } + function isDynamicSourceFile(sourceFile) { + if (sourceFile.fileName.endsWith('/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/lib.es5.d.ts')) { + return true; + } + return false; + } function getTypeReferenceType(node, symbol) { if (symbol === unknownSymbol) { return errorType; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 2c6f5d45c5c63463034907982265d1dbbe88da86..7d23378657d011ec898eb5f1ef8b44f82b689cb7 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -64380,14 +64380,35 @@ var ts; return unknownSymbol; } function resolveTypeReferenceName(typeReference, meaning, ignoreErrors) { + var _a; var name = getTypeReferenceName(typeReference); if (!name) { return unknownSymbol; } var symbol = resolveEntityName(name, meaning, ignoreErrors); + if (ts.isIdentifier(name) && name.escapedText === 'Record') { + var sourceFile = ts.getSourceFileOfNode(typeReference); + var declarationSourceFile = ((_a = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]) && ts.getSourceFileOfNode(symbol.declarations[0]); + var isFromStatic = sourceFile && declarationSourceFile && isStaticSourceFile(sourceFile) && isDynamicSourceFile(declarationSourceFile); + if (isFromStatic) { + symbol.isStatic = true; + } + } return symbol && symbol !== unknownSymbol ? symbol : ignoreErrors ? unknownSymbol : getUnresolvedSymbolForEntityName(name); } + function isStaticSourceFile(sourceFile) { + if (sourceFile.fileName.includes('static')) { + return true; + } + return false; + } + function isDynamicSourceFile(sourceFile) { + if (sourceFile.fileName.endsWith('/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/lib.es5.d.ts')) { + return true; + } + return false; + } function getTypeReferenceType(node, symbol) { if (symbol === unknownSymbol) { return errorType; diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index 8ddf991d82482c29bc14b0ee134954dda788e953..c663b61690dbd80669aa322dc005e8b0b28aeb45 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -64370,14 +64370,35 @@ var ts; return unknownSymbol; } function resolveTypeReferenceName(typeReference, meaning, ignoreErrors) { + var _a; var name = getTypeReferenceName(typeReference); if (!name) { return unknownSymbol; } var symbol = resolveEntityName(name, meaning, ignoreErrors); + if (ts.isIdentifier(name) && name.escapedText === 'Record') { + var sourceFile = ts.getSourceFileOfNode(typeReference); + var declarationSourceFile = ((_a = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]) && ts.getSourceFileOfNode(symbol.declarations[0]); + var isFromStatic = sourceFile && declarationSourceFile && isStaticSourceFile(sourceFile) && isDynamicSourceFile(declarationSourceFile); + if (isFromStatic) { + symbol.isStatic = true; + } + } return symbol && symbol !== unknownSymbol ? symbol : ignoreErrors ? unknownSymbol : getUnresolvedSymbolForEntityName(name); } + function isStaticSourceFile(sourceFile) { + if (sourceFile.fileName.includes('static')) { + return true; + } + return false; + } + function isDynamicSourceFile(sourceFile) { + if (sourceFile.fileName.endsWith('/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/lib.es5.d.ts')) { + return true; + } + return false; + } function getTypeReferenceType(node, symbol) { if (symbol === unknownSymbol) { return errorType; diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0508afc088a43e7eee9ccc2669583ec8e17059b5..8bfcd7c369f78c875614b2c4c176c3985eb5e04f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14125,10 +14125,34 @@ namespace ts { return unknownSymbol; } const symbol = resolveEntityName(name, meaning, ignoreErrors); + + if (isIdentifier(name) && name.escapedText === 'Record') { + const sourceFile = getSourceFileOfNode(typeReference); + const declarationSourceFile = symbol?.declarations?.[0] && getSourceFileOfNode(symbol.declarations[0]); + const isFromStatic = sourceFile && declarationSourceFile && isStaticSourceFile(sourceFile) && isDynamicSourceFile(declarationSourceFile); + if (isFromStatic) { + symbol.isStatic = true; + } + } + return symbol && symbol !== unknownSymbol ? symbol : ignoreErrors ? unknownSymbol : getUnresolvedSymbolForEntityName(name); } + function isStaticSourceFile(sourceFile: SourceFile): boolean { + if (sourceFile.fileName.includes('static')) { + return true; + } + return false; + } + + function isDynamicSourceFile(sourceFile: SourceFile): boolean { + if (sourceFile.fileName.endsWith('/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/lib.es5.d.ts')) { + return true; + } + return false; + } + function getTypeReferenceType(node: NodeWithTypeArguments, symbol: Symbol): Type { if (symbol === unknownSymbol) { return errorType; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 6146439dcf81d7cd50ff132b83d7740988ae0325..c4ae4ad543f2e96775e90f305a2d5a7a47282cab 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5503,6 +5503,7 @@ namespace ts { /* @internal */ isReplaceableByMethod?: boolean; // Can this Javascript class property be replaced by a method symbol? /* @internal */ isAssigned?: boolean; // True if the symbol is a parameter with assignments /* @internal */ assignmentDeclarationMembers?: ESMap; // detected late-bound assignment declarations associated with the symbol + /* @internal */ isStatic?: boolean; // If the symbol is from static file } /* @internal */