Merge pull request #5134 from RReverser/patch-1

Couple of fixes and deprecations in ESTree
This commit is contained in:
Masahiro Wakame
2015-08-03 21:47:02 +09:00
3 changed files with 194 additions and 23 deletions
-2
View File
@@ -59,7 +59,6 @@ expression = withStatement.object;
var switchStatement: ESTree.SwitchStatement;
expression = switchStatement.discriminant;
switchCase = switchStatement.cases[0];
boolean = switchStatement.lexical;
// ReturnStatement
var returnStatement: ESTree.ReturnStatement;
@@ -164,7 +163,6 @@ statement = switchCase.consequent[0];
// CatchClause
string = catchClause.type;
pattern = catchClause.param;
expression = catchClause.guard;
blockStatement = catchClause.body;
// Misc
+20 -21
View File
@@ -22,7 +22,7 @@ declare module ESTree {
}
interface Program extends Node {
body: Array<Statement>;
body: Array<Statement | ModuleDeclaration>;
sourceType: string;
}
@@ -72,7 +72,6 @@ declare module ESTree {
interface SwitchStatement extends Statement {
discriminant: Expression;
cases: Array<SwitchCase>;
lexical: boolean;
}
interface ReturnStatement extends Statement {
@@ -215,7 +214,6 @@ declare module ESTree {
interface CatchClause extends Node {
param: Pattern;
guard: any;
body: BlockStatement;
}
@@ -227,7 +225,7 @@ declare module ESTree {
value?: string | boolean | number | RegExp;
}
interface RegexLiteral extends Literal {
interface RegExpLiteral extends Literal {
regex: {
pattern: string;
flags: string;
@@ -258,6 +256,7 @@ declare module ESTree {
interface YieldExpression extends Expression {
argument?: Expression;
delegate: boolean;
}
interface TemplateLiteral extends Expression {
@@ -274,7 +273,7 @@ declare module ESTree {
tail: boolean;
value: {
cooked: string;
value: string;
raw: string;
};
}
@@ -312,7 +311,7 @@ declare module ESTree {
}
interface MethodDefinition extends Node {
key: Identifier;
key: Expression;
value: FunctionExpression;
kind: string;
computed: boolean;
@@ -330,40 +329,40 @@ declare module ESTree {
property: Identifier;
}
interface ImportDeclaration extends Node {
interface ModuleDeclaration extends Node {}
interface ModuleSpecifier extends Node {
local: Identifier;
}
interface ImportDeclaration extends ModuleDeclaration {
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
source: Literal;
}
interface ImportSpecifier {
interface ImportSpecifier extends ModuleSpecifier {
imported: Identifier;
local: Identifier;
}
interface ImportDefaultSpecifier {
local: Identifier;
}
interface ImportDefaultSpecifier extends ModuleSpecifier {}
interface ImportNamespaceSpecifier {
local: Identifier;
}
interface ImportNamespaceSpecifier extends ModuleSpecifier {}
interface ExportNamedDeclaration extends Node {
interface ExportNamedDeclaration extends ModuleDeclaration {
declaration?: Declaration;
specifiers: Array<ExportSpecifier>;
source?: Literal;
}
interface ExportSpecifier {
interface ExportSpecifier extends ModuleSpecifier {
exported: Identifier;
local: Identifier;
}
interface ExportDefaultDeclaration extends Node {
interface ExportDefaultDeclaration extends ModuleDeclaration {
declaration: Declaration | Expression;
}
interface ExportAllDeclaration extends Node {
interface ExportAllDeclaration extends ModuleDeclaration {
source: Literal;
}
}
}
+174
View File
@@ -0,0 +1,174 @@
// Type definitions for ESTree AST extensions for Facebook Flow
// Project: https://github.com/estree/estree
// Definitions by: RReverser <https://github.com/RReverser>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="./estree.d.ts" />
declare module ESTree {
interface FlowTypeAnnotation extends Node {}
interface FlowBaseTypeAnnotation extends FlowTypeAnnotation {}
interface FlowLiteralTypeAnnotation extends FlowTypeAnnotation, Literal {}
interface FlowDeclaration extends Declaration {}
interface AnyTypeAnnotation extends FlowBaseTypeAnnotation {}
interface ArrayTypeAnnotation extends FlowTypeAnnotation {
elementType: FlowTypeAnnotation;
}
interface BooleanLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {}
interface BooleanTypeAnnotation extends FlowBaseTypeAnnotation {}
interface ClassImplements extends Node {
id: Identifier;
typeParameters?: TypeParameterInstantiation;
}
interface ClassProperty {
key: Expression;
value?: Expression;
typeAnnotation?: TypeAnnotation;
computed: boolean;
static: boolean;
}
interface DeclareClass extends FlowDeclaration {
id: Identifier;
typeParameters?: TypeParameterDeclaration;
body: ObjectTypeAnnotation;
extends: Array<InterfaceExtends>;
}
interface DeclareFunction extends FlowDeclaration {
id: Identifier;
}
interface DeclareModule extends FlowDeclaration {
id: Literal | Identifier;
body: BlockStatement;
}
interface DeclareVariable extends FlowDeclaration {
id: Identifier;
}
interface FunctionTypeAnnotation extends FlowTypeAnnotation {
params: Array<FunctionTypeParam>;
returnType: FlowTypeAnnotation;
rest?: FunctionTypeParam;
typeParameters?: TypeParameterDeclaration;
}
interface FunctionTypeParam {
name: Identifier;
typeAnnotation: FlowTypeAnnotation;
optional: boolean;
}
interface GenericTypeAnnotation extends FlowTypeAnnotation {
id: Identifier | QualifiedTypeIdentifier;
typeParameters?: TypeParameterInstantiation;
}
interface InterfaceExtends extends Node {
id: Identifier | QualifiedTypeIdentifier;
typeParameters?: TypeParameterInstantiation;
}
interface InterfaceDeclaration extends FlowDeclaration {
id: Identifier;
typeParameters?: TypeParameterDeclaration;
extends: Array<InterfaceExtends>;
body: ObjectTypeAnnotation;
}
interface IntersectionTypeAnnotation extends FlowTypeAnnotation {
types: Array<FlowTypeAnnotation>;
}
interface MixedTypeAnnotation extends FlowBaseTypeAnnotation {}
interface NullableTypeAnnotation extends FlowTypeAnnotation {
typeAnnotation: TypeAnnotation;
}
interface NumberLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {}
interface NumberTypeAnnotation extends FlowBaseTypeAnnotation {}
interface StringLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {}
interface StringTypeAnnotation extends FlowBaseTypeAnnotation {}
interface TupleTypeAnnotation extends FlowTypeAnnotation {
types: Array<FlowTypeAnnotation>;
}
interface TypeofTypeAnnotation extends FlowTypeAnnotation {
argument: FlowTypeAnnotation;
}
interface TypeAlias extends FlowDeclaration {
id: Identifier;
typeParameters?: TypeParameterDeclaration;
right: FlowTypeAnnotation;
}
interface TypeAnnotation extends Node {
typeAnnotation: FlowTypeAnnotation;
}
interface TypeCastExpression extends Expression {
expression: Expression;
typeAnnotation: TypeAnnotation;
}
interface TypeParameterDeclaration extends Node {
params: Array<Identifier>;
}
interface TypeParameterInstantiation extends Node {
params: Array<FlowTypeAnnotation>;
}
interface ObjectTypeAnnotation extends FlowTypeAnnotation {
properties: Array<ObjectTypeProperty>;
indexers: Array<ObjectTypeIndexer>;
callProperties: Array<ObjectTypeCallProperty>;
}
interface ObjectTypeCallProperty extends Node {
value: FunctionTypeAnnotation;
static: boolean;
}
interface ObjectTypeIndexer extends Node {
id: Identifier;
key: FlowTypeAnnotation;
value: FlowTypeAnnotation;
static: boolean;
}
interface ObjectTypeProperty extends Node {
key: Expression;
value: FlowTypeAnnotation;
optional: boolean;
static: boolean;
}
interface QualifiedTypeIdentifier extends Node {
qualification: Identifier | QualifiedTypeIdentifier;
id: Identifier;
}
interface UnionTypeAnnotation extends FlowTypeAnnotation {
types: Array<FlowTypeAnnotation>;
}
interface VoidTypeAnnotation extends FlowBaseTypeAnnotation {}
}