mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Fix declaration emit crash (#58872)
This commit is contained in:
@@ -541,6 +541,7 @@ import {
|
||||
isExternalModuleIndicator,
|
||||
isExternalModuleNameRelative,
|
||||
isExternalModuleReference,
|
||||
isExternalModuleSymbol,
|
||||
isExternalOrCommonJsModule,
|
||||
isForInOrOfStatement,
|
||||
isForInStatement,
|
||||
@@ -9002,7 +9003,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
const parentSymbol = nodeSymbol
|
||||
&& isSymbolAccessible(nodeSymbol, context.enclosingDeclaration, meaning, /*shouldComputeAliasesToMakeVisible*/ false).accessibility === SymbolAccessibility.Accessible
|
||||
&& lookupSymbolChain(nodeSymbol, context, meaning, /*yieldModuleSymbol*/ true)[0];
|
||||
if (parentSymbol && parentSymbol.flags & SymbolFlags.Module) {
|
||||
if (parentSymbol && isExternalModuleSymbol(parentSymbol)) {
|
||||
name = getSpecifierForModuleSymbol(parentSymbol, context);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -633,6 +633,15 @@ export function isTransientSymbol(symbol: Symbol): symbol is TransientSymbol {
|
||||
return (symbol.flags & SymbolFlags.Transient) !== 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the symbol is for an external module, as opposed to a namespace.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export function isExternalModuleSymbol(moduleSymbol: Symbol): boolean {
|
||||
return !!(moduleSymbol.flags & SymbolFlags.Module) && (moduleSymbol.escapedName as string).charCodeAt(0) === CharacterCodes.doubleQuote;
|
||||
}
|
||||
|
||||
const stringWriter = createSingleLineStringWriter();
|
||||
|
||||
function createSingleLineStringWriter(): EmitTextWriter {
|
||||
|
||||
@@ -2408,15 +2408,6 @@ export function isTypeKeywordTokenOrIdentifier(node: Node) {
|
||||
return isTypeKeywordToken(node) || isIdentifier(node) && node.text === "type";
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the symbol is for an external module, as opposed to a namespace.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export function isExternalModuleSymbol(moduleSymbol: Symbol): boolean {
|
||||
return !!(moduleSymbol.flags & SymbolFlags.Module) && moduleSymbol.name.charCodeAt(0) === CharacterCodes.doubleQuote;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` the first time it encounters a node and `false` afterwards.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user