-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11267,6 +11267,29 @@ module ts { | |
!hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); | ||
} | ||
|
||
function getClassDeclarationVariableId(n: Identifier): number { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
rbuckton
Author
Member
|
||
Debug.assert(!nodeIsSynthesized(n)); | ||
|
||
let isClassDeclaration = n.parent.kind === SyntaxKind.ClassDeclaration; | ||
|
||
let symbol = | ||
(isClassDeclaration ? getSymbolOfNode(n.parent) : undefined) || | ||
getNodeLinks(n).resolvedSymbol || | ||
resolveName(n, n.text, SymbolFlags.Value | SymbolFlags.Alias, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); | ||
|
||
symbol = getExportSymbolOfValueSymbolIfExported(symbol); | ||
|
||
let isClass = symbol && (symbol.flags & SymbolFlags.Class) !== 0; | ||
|
||
if (isClass) { | ||
// side-effect of calling this method: | ||
// assign id to symbol if it was not yet set | ||
getSymbolLinks(symbol); | ||
return symbol.id; | ||
} | ||
return undefined; | ||
} | ||
|
||
function getBlockScopedVariableId(n: Identifier): number { | ||
Debug.assert(!nodeIsSynthesized(n)); | ||
|
||
|
@@ -11309,6 +11332,7 @@ module ts { | |
getConstantValue, | ||
isUnknownIdentifier, | ||
getBlockScopedVariableId, | ||
getClassDeclarationVariableId, | ||
}; | ||
} | ||
|
||
|
1 comment
on commit bd4d7fc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I think the emitter needs a bunch of commenting with code samples. The comments should explain whatever caveats you need to account for, and the code examples are useful because the emitter's source code does not resemble the emitted code.
Why do we need this?