Skip to content

Commit 5db3b0d

Browse files
committed
Types for decorators
1 parent 42a0c34 commit 5db3b0d

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

src/compiler/types.ts

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ module ts {
6767
BarBarToken,
6868
QuestionToken,
6969
ColonToken,
70+
AtToken,
7071
// Assignments
7172
EqualsToken,
7273
PlusEqualsToken,
@@ -154,6 +155,7 @@ module ts {
154155
// Signature elements
155156
TypeParameter,
156157
Parameter,
158+
Decorator,
157159
// TypeMember
158160
PropertySignature,
159161
PropertyDeclaration,
@@ -244,6 +246,7 @@ module ts {
244246
ExportDeclaration,
245247
NamedExports,
246248
ExportSpecifier,
249+
IncompleteDeclaration,
247250

248251
// Module references
249252
ExternalModuleReference,
@@ -327,22 +330,25 @@ module ts {
327330
// If this node was parsed in the parameters of a generator.
328331
GeneratorParameter = 1 << 3,
329332

333+
// If this node was parsed as part of a decorator
334+
Decorator = 1 << 4,
335+
330336
// If the parser encountered an error when parsing the code that created this node. Note
331337
// the parser only sets this directly on the node it creates right after encountering the
332338
// error.
333-
ThisNodeHasError = 1 << 4,
339+
ThisNodeHasError = 1 << 5,
334340

335341
// Context flags set directly by the parser.
336-
ParserGeneratedFlags = StrictMode | DisallowIn | Yield | GeneratorParameter | ThisNodeHasError,
342+
ParserGeneratedFlags = StrictMode | DisallowIn | Yield | GeneratorParameter | Decorator | ThisNodeHasError,
337343

338344
// Context flags computed by aggregating child flags upwards.
339345

340346
// Used during incremental parsing to determine if this node or any of its children had an
341347
// error. Computed only once and then cached.
342-
ThisNodeOrAnySubNodesHasError = 1 << 5,
348+
ThisNodeOrAnySubNodesHasError = 1 << 6,
343349

344350
// Used to know if we've computed data from children and cached it in this node.
345-
HasAggregatedChildData = 1 << 6
351+
HasAggregatedChildData = 1 << 7
346352
}
347353

348354
export const enum RelationComparisonResult {
@@ -357,13 +363,14 @@ module ts {
357363
// Specific context the parser was in when this node was created. Normally undefined.
358364
// Only set when the parser was in some interesting context (like async/yield).
359365
parserContextFlags?: ParserContextFlags;
360-
modifiers?: ModifiersArray; // Array of modifiers
361-
id?: number; // Unique id (used to look up NodeLinks)
362-
parent?: Node; // Parent node (initialized by binding)
363-
symbol?: Symbol; // Symbol declared by node (initialized by binding)
364-
locals?: SymbolTable; // Locals associated with node (initialized by binding)
365-
nextContainer?: Node; // Next container in declaration order (initialized by binding)
366-
localSymbol?: Symbol; // Local symbol declared by node (initialized by binding only for exported nodes)
366+
decorators?: NodeArray<Decorator>; // Array of decorators
367+
modifiers?: ModifiersArray; // Array of modifiers
368+
id?: number; // Unique id (used to look up NodeLinks)
369+
parent?: Node; // Parent node (initialized by binding)
370+
symbol?: Symbol; // Symbol declared by node (initialized by binding)
371+
locals?: SymbolTable; // Locals associated with node (initialized by binding)
372+
nextContainer?: Node; // Next container in declaration order (initialized by binding)
373+
localSymbol?: Symbol; // Local symbol declared by node (initialized by binding only for exported nodes)
367374
}
368375

369376
export interface NodeArray<T> extends Array<T>, TextRange {
@@ -397,6 +404,11 @@ module ts {
397404
expression: Expression;
398405
}
399406

407+
export interface Decorator extends Node {
408+
atToken: Node;
409+
expression: LeftHandSideExpression;
410+
}
411+
400412
export interface TypeParameterDeclaration extends Declaration {
401413
name: Identifier;
402414
constraint?: TypeNode;
@@ -687,7 +699,9 @@ module ts {
687699
}
688700

689701
export interface ArrayLiteralExpression extends PrimaryExpression {
702+
openBracketToken: Node;
690703
elements: NodeArray<Expression>;
704+
closeBracketToken: Node;
691705
}
692706

693707
export interface SpreadElementExpression extends Expression {
@@ -707,7 +721,9 @@ module ts {
707721

708722
export interface ElementAccessExpression extends MemberExpression {
709723
expression: LeftHandSideExpression;
724+
openBracketToken: Node;
710725
argumentExpression?: Expression;
726+
closeBracketToken: Node;
711727
}
712728

713729
export interface CallExpression extends LeftHandSideExpression {

0 commit comments

Comments
 (0)