Skip to content

Commit bd4d7fc

Browse files
committed
Emit for decorators, updated to ES6 classes.
1 parent 39001f5 commit bd4d7fc

File tree

4 files changed

+438
-27
lines changed

4 files changed

+438
-27
lines changed

src/compiler/checker.ts

+24
Original file line numberDiff line numberDiff line change
@@ -11267,6 +11267,29 @@ module ts {
1126711267
!hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name);
1126811268
}
1126911269

11270+
function getClassDeclarationVariableId(n: Identifier): number {
11271+
Debug.assert(!nodeIsSynthesized(n));
11272+
11273+
let isClassDeclaration = n.parent.kind === SyntaxKind.ClassDeclaration;
11274+
11275+
let symbol =
11276+
(isClassDeclaration ? getSymbolOfNode(n.parent) : undefined) ||
11277+
getNodeLinks(n).resolvedSymbol ||
11278+
resolveName(n, n.text, SymbolFlags.Value | SymbolFlags.Alias, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
11279+
11280+
symbol = getExportSymbolOfValueSymbolIfExported(symbol);
11281+
11282+
let isClass = symbol && (symbol.flags & SymbolFlags.Class) !== 0;
11283+
11284+
if (isClass) {
11285+
// side-effect of calling this method:
11286+
// assign id to symbol if it was not yet set
11287+
getSymbolLinks(symbol);
11288+
return symbol.id;
11289+
}
11290+
return undefined;
11291+
}
11292+
1127011293
function getBlockScopedVariableId(n: Identifier): number {
1127111294
Debug.assert(!nodeIsSynthesized(n));
1127211295

@@ -11309,6 +11332,7 @@ module ts {
1130911332
getConstantValue,
1131011333
isUnknownIdentifier,
1131111334
getBlockScopedVariableId,
11335+
getClassDeclarationVariableId,
1131211336
};
1131311337
}
1131411338

0 commit comments

Comments
 (0)