mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Types for decorators
This commit is contained in:
@@ -67,6 +67,7 @@ module ts {
|
||||
BarBarToken,
|
||||
QuestionToken,
|
||||
ColonToken,
|
||||
AtToken,
|
||||
// Assignments
|
||||
EqualsToken,
|
||||
PlusEqualsToken,
|
||||
@@ -154,6 +155,7 @@ module ts {
|
||||
// Signature elements
|
||||
TypeParameter,
|
||||
Parameter,
|
||||
Decorator,
|
||||
// TypeMember
|
||||
PropertySignature,
|
||||
PropertyDeclaration,
|
||||
@@ -244,6 +246,7 @@ module ts {
|
||||
ExportDeclaration,
|
||||
NamedExports,
|
||||
ExportSpecifier,
|
||||
IncompleteDeclaration,
|
||||
|
||||
// Module references
|
||||
ExternalModuleReference,
|
||||
@@ -327,22 +330,25 @@ module ts {
|
||||
// If this node was parsed in the parameters of a generator.
|
||||
GeneratorParameter = 1 << 3,
|
||||
|
||||
// If this node was parsed as part of a decorator
|
||||
Decorator = 1 << 4,
|
||||
|
||||
// If the parser encountered an error when parsing the code that created this node. Note
|
||||
// the parser only sets this directly on the node it creates right after encountering the
|
||||
// error.
|
||||
ThisNodeHasError = 1 << 4,
|
||||
ThisNodeHasError = 1 << 5,
|
||||
|
||||
// Context flags set directly by the parser.
|
||||
ParserGeneratedFlags = StrictMode | DisallowIn | Yield | GeneratorParameter | ThisNodeHasError,
|
||||
ParserGeneratedFlags = StrictMode | DisallowIn | Yield | GeneratorParameter | Decorator | ThisNodeHasError,
|
||||
|
||||
// Context flags computed by aggregating child flags upwards.
|
||||
|
||||
// Used during incremental parsing to determine if this node or any of its children had an
|
||||
// error. Computed only once and then cached.
|
||||
ThisNodeOrAnySubNodesHasError = 1 << 5,
|
||||
ThisNodeOrAnySubNodesHasError = 1 << 6,
|
||||
|
||||
// Used to know if we've computed data from children and cached it in this node.
|
||||
HasAggregatedChildData = 1 << 6
|
||||
HasAggregatedChildData = 1 << 7
|
||||
}
|
||||
|
||||
export const enum RelationComparisonResult {
|
||||
@@ -357,13 +363,14 @@ module ts {
|
||||
// Specific context the parser was in when this node was created. Normally undefined.
|
||||
// Only set when the parser was in some interesting context (like async/yield).
|
||||
parserContextFlags?: ParserContextFlags;
|
||||
modifiers?: ModifiersArray; // Array of modifiers
|
||||
id?: number; // Unique id (used to look up NodeLinks)
|
||||
parent?: Node; // Parent node (initialized by binding)
|
||||
symbol?: Symbol; // Symbol declared by node (initialized by binding)
|
||||
locals?: SymbolTable; // Locals associated with node (initialized by binding)
|
||||
nextContainer?: Node; // Next container in declaration order (initialized by binding)
|
||||
localSymbol?: Symbol; // Local symbol declared by node (initialized by binding only for exported nodes)
|
||||
decorators?: NodeArray<Decorator>; // Array of decorators
|
||||
modifiers?: ModifiersArray; // Array of modifiers
|
||||
id?: number; // Unique id (used to look up NodeLinks)
|
||||
parent?: Node; // Parent node (initialized by binding)
|
||||
symbol?: Symbol; // Symbol declared by node (initialized by binding)
|
||||
locals?: SymbolTable; // Locals associated with node (initialized by binding)
|
||||
nextContainer?: Node; // Next container in declaration order (initialized by binding)
|
||||
localSymbol?: Symbol; // Local symbol declared by node (initialized by binding only for exported nodes)
|
||||
}
|
||||
|
||||
export interface NodeArray<T> extends Array<T>, TextRange {
|
||||
@@ -397,6 +404,11 @@ module ts {
|
||||
expression: Expression;
|
||||
}
|
||||
|
||||
export interface Decorator extends Node {
|
||||
atToken: Node;
|
||||
expression: LeftHandSideExpression;
|
||||
}
|
||||
|
||||
export interface TypeParameterDeclaration extends Declaration {
|
||||
name: Identifier;
|
||||
constraint?: TypeNode;
|
||||
@@ -687,7 +699,9 @@ module ts {
|
||||
}
|
||||
|
||||
export interface ArrayLiteralExpression extends PrimaryExpression {
|
||||
openBracketToken: Node;
|
||||
elements: NodeArray<Expression>;
|
||||
closeBracketToken: Node;
|
||||
}
|
||||
|
||||
export interface SpreadElementExpression extends Expression {
|
||||
@@ -707,7 +721,9 @@ module ts {
|
||||
|
||||
export interface ElementAccessExpression extends MemberExpression {
|
||||
expression: LeftHandSideExpression;
|
||||
openBracketToken: Node;
|
||||
argumentExpression?: Expression;
|
||||
closeBracketToken: Node;
|
||||
}
|
||||
|
||||
export interface CallExpression extends LeftHandSideExpression {
|
||||
|
||||
Reference in New Issue
Block a user