Flow: interface identifier should be declared in the scope (#10220)
* fix: typo * declare name for flow interface * add test case for export overload function, typescript * test: add test Fixes #10044 * test: update test * test(flow): add multiple declarations regression test * re-enable flow test case # Conflicts: # packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/def-site-variance/input.js # packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-declare-statements/input.js # packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-interfaces-module-and-script/input.js # packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-iterator/input.js * test: disable two flow dupl-decl test * fix: do not declare name for declare function until we figure out a better way * test: duplicate declare function and function would not throw
This commit is contained in:
parent
02f2d17e83
commit
fa5057f9fb
@ -11,13 +11,13 @@ declare class A { static [ indexer: number]: string }
|
|||||||
declare class A { static () : number }
|
declare class A { static () : number }
|
||||||
declare class B { (): number }
|
declare class B { (): number }
|
||||||
declare class A mixins B<T>, C {}
|
declare class A mixins B<T>, C {}
|
||||||
declare type A = string
|
declare type A1 = string
|
||||||
declare type T<U> = { [k:string]: U }
|
declare type T<U> = { [k:string]: U }
|
||||||
declare type B = {
|
declare type B1 = {
|
||||||
fn?: (foo: string) => void,
|
fn?: (foo: string) => void,
|
||||||
}
|
}
|
||||||
declare interface I { foo: string }
|
declare interface I1 { foo: string }
|
||||||
declare interface I<T> { foo: T }
|
declare interface I2<T> { foo: T }
|
||||||
declare module.exports: { foo: string }
|
declare module.exports: { foo: string }
|
||||||
declare opaque type Foo<T>: Bar<T>;
|
declare opaque type Foo<T>: Bar<T>;
|
||||||
declare opaque type ID;
|
declare opaque type ID;
|
||||||
|
|||||||
@ -22,17 +22,17 @@ declare class B {
|
|||||||
(): number
|
(): number
|
||||||
}
|
}
|
||||||
declare class A mixins B<T>, C {}
|
declare class A mixins B<T>, C {}
|
||||||
declare type A = string;
|
declare type A1 = string;
|
||||||
declare type T<U> = {
|
declare type T<U> = {
|
||||||
[k: string]: U
|
[k: string]: U
|
||||||
};
|
};
|
||||||
declare type B = {
|
declare type B1 = {
|
||||||
fn?: (foo: string) => void
|
fn?: (foo: string) => void
|
||||||
};
|
};
|
||||||
declare interface I {
|
declare interface I1 {
|
||||||
foo: string
|
foo: string
|
||||||
}
|
}
|
||||||
declare interface I<T> {
|
declare interface I2<T> {
|
||||||
foo: T
|
foo: T
|
||||||
}
|
}
|
||||||
declare module.exports: {
|
declare module.exports: {
|
||||||
|
|||||||
@ -5,10 +5,10 @@ type T2 = { +p: T };
|
|||||||
type T3 = { -p: T };
|
type T3 = { -p: T };
|
||||||
type T4 = { +[k:K]: V };
|
type T4 = { +[k:K]: V };
|
||||||
type T5 = { -[k:K]: V };
|
type T5 = { -[k:K]: V };
|
||||||
interface I { +p: T }
|
interface I1 { +p: T }
|
||||||
interface I { -p: T }
|
interface I2 { -p: T }
|
||||||
interface I { +[k:K]: V }
|
interface I3 { +[k:K]: V }
|
||||||
interface I { -[k:K]: V }
|
interface I4 { -[k:K]: V }
|
||||||
declare class I { +p: T }
|
declare class I { +p: T }
|
||||||
declare class I { -p: T }
|
declare class I { -p: T }
|
||||||
declare class I { +[k:K]: V }
|
declare class I { +[k:K]: V }
|
||||||
|
|||||||
@ -15,16 +15,16 @@ type T4 = {
|
|||||||
type T5 = {
|
type T5 = {
|
||||||
-[k: K]: V
|
-[k: K]: V
|
||||||
};
|
};
|
||||||
interface I {
|
interface I1 {
|
||||||
+p: T
|
+p: T
|
||||||
}
|
}
|
||||||
interface I {
|
interface I2 {
|
||||||
-p: T
|
-p: T
|
||||||
}
|
}
|
||||||
interface I {
|
interface I3 {
|
||||||
+[k: K]: V
|
+[k: K]: V
|
||||||
}
|
}
|
||||||
interface I {
|
interface I4 {
|
||||||
-[k: K]: V
|
-[k: K]: V
|
||||||
}
|
}
|
||||||
declare class I {
|
declare class I {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
declare class C { static [[foo]]: T }
|
declare class C { static [[foo]]: T }
|
||||||
declare class C { [[foo]]: T }
|
declare class C { [[foo]]: T }
|
||||||
interface I { [[foo]]: X }
|
interface I1 { [[foo]]: X }
|
||||||
interface I { [[foo]](): X }
|
interface I2 { [[foo]](): X }
|
||||||
type T1 = { [[foo]]: X }
|
type T1 = { [[foo]]: X }
|
||||||
type T2 = { [[foo]](): X }
|
type T2 = { [[foo]](): X }
|
||||||
type T3 = { [[foo]]?: X }
|
type T3 = { [[foo]]?: X }
|
||||||
|
|||||||
@ -4,10 +4,10 @@ declare class C {
|
|||||||
declare class C {
|
declare class C {
|
||||||
[[foo]]: T
|
[[foo]]: T
|
||||||
}
|
}
|
||||||
interface I {
|
interface I1 {
|
||||||
[[foo]]: X
|
[[foo]]: X
|
||||||
}
|
}
|
||||||
interface I {
|
interface I2 {
|
||||||
[[foo]]() => X
|
[[foo]]() => X
|
||||||
}
|
}
|
||||||
type T1 = {
|
type T1 = {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
interface A {
|
interface A1 {
|
||||||
@@iterator(): Iterator<File>;
|
@@iterator(): Iterator<File>;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface A {
|
interface A2 {
|
||||||
@@asyncIterator(): Iterator<File>;
|
@@asyncIterator(): Iterator<File>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
interface A {
|
interface A1 {
|
||||||
@@iterator(): Iterator<File>
|
@@iterator(): Iterator<File>
|
||||||
}
|
}
|
||||||
interface A {
|
interface A2 {
|
||||||
@@asyncIterator(): Iterator<File>
|
@@asyncIterator(): Iterator<File>
|
||||||
}
|
}
|
||||||
@ -1975,7 +1975,7 @@ export default class ExpressionParser extends LValParser {
|
|||||||
node.params[i],
|
node.params[i],
|
||||||
BIND_VAR,
|
BIND_VAR,
|
||||||
allowDuplicates ? null : nameHash,
|
allowDuplicates ? null : nameHash,
|
||||||
"function paramter list",
|
"function parameter list",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,8 @@ import {
|
|||||||
type BindingTypes,
|
type BindingTypes,
|
||||||
BIND_NONE,
|
BIND_NONE,
|
||||||
BIND_LEXICAL,
|
BIND_LEXICAL,
|
||||||
|
BIND_VAR,
|
||||||
|
BIND_FUNCTION,
|
||||||
SCOPE_ARROW,
|
SCOPE_ARROW,
|
||||||
SCOPE_OTHER,
|
SCOPE_OTHER,
|
||||||
} from "../util/scopeflags";
|
} from "../util/scopeflags";
|
||||||
@ -270,6 +272,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
|||||||
node.id = this.flowParseTypeAnnotatableIdentifier(
|
node.id = this.flowParseTypeAnnotatableIdentifier(
|
||||||
/*allowPrimitiveOverride*/ true,
|
/*allowPrimitiveOverride*/ true,
|
||||||
);
|
);
|
||||||
|
this.scope.declareName(node.id.name, BIND_VAR, node.id.start);
|
||||||
this.semicolon();
|
this.semicolon();
|
||||||
return this.finishNode(node, "DeclareVariable");
|
return this.finishNode(node, "DeclareVariable");
|
||||||
}
|
}
|
||||||
@ -462,6 +465,12 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
|||||||
): void {
|
): void {
|
||||||
node.id = this.flowParseRestrictedIdentifier(/*liberal*/ !isClass);
|
node.id = this.flowParseRestrictedIdentifier(/*liberal*/ !isClass);
|
||||||
|
|
||||||
|
this.scope.declareName(
|
||||||
|
node.id.name,
|
||||||
|
isClass ? BIND_FUNCTION : BIND_LEXICAL,
|
||||||
|
node.id.start,
|
||||||
|
);
|
||||||
|
|
||||||
if (this.isRelational("<")) {
|
if (this.isRelational("<")) {
|
||||||
node.typeParameters = this.flowParseTypeParameterDeclaration();
|
node.typeParameters = this.flowParseTypeParameterDeclaration();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -0,0 +1,3 @@
|
|||||||
|
interface Foo {}
|
||||||
|
|
||||||
|
export type { Foo }
|
||||||
160
packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-exports/output.json
vendored
Normal file
160
packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-exports/output.json
vendored
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start": 0,
|
||||||
|
"end": 37,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 19
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start": 0,
|
||||||
|
"end": 37,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 19
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "module",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "InterfaceDeclaration",
|
||||||
|
"start": 0,
|
||||||
|
"end": 16,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 10,
|
||||||
|
"end": 13,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13
|
||||||
|
},
|
||||||
|
"identifierName": "Foo"
|
||||||
|
},
|
||||||
|
"name": "Foo"
|
||||||
|
},
|
||||||
|
"typeParameters": null,
|
||||||
|
"extends": [],
|
||||||
|
"implements": [],
|
||||||
|
"mixins": [],
|
||||||
|
"body": {
|
||||||
|
"type": "ObjectTypeAnnotation",
|
||||||
|
"start": 14,
|
||||||
|
"end": 16,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"callProperties": [],
|
||||||
|
"properties": [],
|
||||||
|
"indexers": [],
|
||||||
|
"internalSlots": [],
|
||||||
|
"exact": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ExportNamedDeclaration",
|
||||||
|
"start": 18,
|
||||||
|
"end": 37,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 19
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"specifiers": [
|
||||||
|
{
|
||||||
|
"type": "ExportSpecifier",
|
||||||
|
"start": 32,
|
||||||
|
"end": 35,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 17
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"local": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 32,
|
||||||
|
"end": 35,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 17
|
||||||
|
},
|
||||||
|
"identifierName": "Foo"
|
||||||
|
},
|
||||||
|
"name": "Foo"
|
||||||
|
},
|
||||||
|
"exported": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 32,
|
||||||
|
"end": 35,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 17
|
||||||
|
},
|
||||||
|
"identifierName": "Foo"
|
||||||
|
},
|
||||||
|
"name": "Foo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": null,
|
||||||
|
"exportKind": "type",
|
||||||
|
"declaration": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
2
packages/babel-parser/test/fixtures/flow/multiple-declarations/class/input.js
vendored
Normal file
2
packages/babel-parser/test/fixtures/flow/multiple-declarations/class/input.js
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
declare class C1 {}
|
||||||
|
class C1 {}
|
||||||
8
packages/babel-parser/test/fixtures/flow/multiple-declarations/class/options.json
vendored
Normal file
8
packages/babel-parser/test/fixtures/flow/multiple-declarations/class/options.json
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"sourceType": "module",
|
||||||
|
"plugins": [
|
||||||
|
"jsx",
|
||||||
|
"flow"
|
||||||
|
],
|
||||||
|
"throws": "Identifier 'C1' has already been declared (2:6)"
|
||||||
|
}
|
||||||
6
packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-class/input.js
vendored
Normal file
6
packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-class/input.js
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
declare class C1{}
|
||||||
|
declare class C1{}
|
||||||
|
|
||||||
|
declare module M1 {
|
||||||
|
declare class C1 {}
|
||||||
|
}
|
||||||
253
packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-class/output.json
vendored
Normal file
253
packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-class/output.json
vendored
Normal file
@ -0,0 +1,253 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start": 0,
|
||||||
|
"end": 82,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 6,
|
||||||
|
"column": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start": 0,
|
||||||
|
"end": 82,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 6,
|
||||||
|
"column": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "module",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "DeclareClass",
|
||||||
|
"start": 0,
|
||||||
|
"end": 18,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 14,
|
||||||
|
"end": 16,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16
|
||||||
|
},
|
||||||
|
"identifierName": "C1"
|
||||||
|
},
|
||||||
|
"name": "C1"
|
||||||
|
},
|
||||||
|
"typeParameters": null,
|
||||||
|
"extends": [],
|
||||||
|
"implements": [],
|
||||||
|
"mixins": [],
|
||||||
|
"body": {
|
||||||
|
"type": "ObjectTypeAnnotation",
|
||||||
|
"start": 16,
|
||||||
|
"end": 18,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"callProperties": [],
|
||||||
|
"properties": [],
|
||||||
|
"indexers": [],
|
||||||
|
"internalSlots": [],
|
||||||
|
"exact": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "DeclareClass",
|
||||||
|
"start": 19,
|
||||||
|
"end": 37,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 33,
|
||||||
|
"end": 35,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 16
|
||||||
|
},
|
||||||
|
"identifierName": "C1"
|
||||||
|
},
|
||||||
|
"name": "C1"
|
||||||
|
},
|
||||||
|
"typeParameters": null,
|
||||||
|
"extends": [],
|
||||||
|
"implements": [],
|
||||||
|
"mixins": [],
|
||||||
|
"body": {
|
||||||
|
"type": "ObjectTypeAnnotation",
|
||||||
|
"start": 35,
|
||||||
|
"end": 37,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 16
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"callProperties": [],
|
||||||
|
"properties": [],
|
||||||
|
"indexers": [],
|
||||||
|
"internalSlots": [],
|
||||||
|
"exact": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "DeclareModule",
|
||||||
|
"start": 39,
|
||||||
|
"end": 82,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 4,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 6,
|
||||||
|
"column": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 54,
|
||||||
|
"end": 56,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 4,
|
||||||
|
"column": 15
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 4,
|
||||||
|
"column": 17
|
||||||
|
},
|
||||||
|
"identifierName": "M1"
|
||||||
|
},
|
||||||
|
"name": "M1"
|
||||||
|
},
|
||||||
|
"body": {
|
||||||
|
"type": "BlockStatement",
|
||||||
|
"start": 57,
|
||||||
|
"end": 82,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 4,
|
||||||
|
"column": 18
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 6,
|
||||||
|
"column": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "DeclareClass",
|
||||||
|
"start": 61,
|
||||||
|
"end": 80,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 5,
|
||||||
|
"column": 2
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 5,
|
||||||
|
"column": 21
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 75,
|
||||||
|
"end": 77,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 5,
|
||||||
|
"column": 16
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 5,
|
||||||
|
"column": 18
|
||||||
|
},
|
||||||
|
"identifierName": "C1"
|
||||||
|
},
|
||||||
|
"name": "C1"
|
||||||
|
},
|
||||||
|
"typeParameters": null,
|
||||||
|
"extends": [],
|
||||||
|
"implements": [],
|
||||||
|
"mixins": [],
|
||||||
|
"body": {
|
||||||
|
"type": "ObjectTypeAnnotation",
|
||||||
|
"start": 78,
|
||||||
|
"end": 80,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 5,
|
||||||
|
"column": 19
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 5,
|
||||||
|
"column": 21
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"callProperties": [],
|
||||||
|
"properties": [],
|
||||||
|
"indexers": [],
|
||||||
|
"internalSlots": [],
|
||||||
|
"exact": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"kind": "CommonJS"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
3
packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-function/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-function/input.js
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
declare function F1(): void
|
||||||
|
declare function F1(): void
|
||||||
|
function F1() {}
|
||||||
249
packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-function/output.json
vendored
Normal file
249
packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-function/output.json
vendored
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start": 0,
|
||||||
|
"end": 72,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start": 0,
|
||||||
|
"end": 72,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "module",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "DeclareFunction",
|
||||||
|
"start": 0,
|
||||||
|
"end": 27,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 17,
|
||||||
|
"end": 27,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27
|
||||||
|
},
|
||||||
|
"identifierName": "F1"
|
||||||
|
},
|
||||||
|
"name": "F1",
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TypeAnnotation",
|
||||||
|
"start": 19,
|
||||||
|
"end": 27,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 19
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "FunctionTypeAnnotation",
|
||||||
|
"start": 19,
|
||||||
|
"end": 27,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 19
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeParameters": null,
|
||||||
|
"params": [],
|
||||||
|
"rest": null,
|
||||||
|
"returnType": {
|
||||||
|
"type": "VoidTypeAnnotation",
|
||||||
|
"start": 23,
|
||||||
|
"end": 27,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 23
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"predicate": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "DeclareFunction",
|
||||||
|
"start": 28,
|
||||||
|
"end": 55,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 45,
|
||||||
|
"end": 55,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 27
|
||||||
|
},
|
||||||
|
"identifierName": "F1"
|
||||||
|
},
|
||||||
|
"name": "F1",
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TypeAnnotation",
|
||||||
|
"start": 47,
|
||||||
|
"end": 55,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 19
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "FunctionTypeAnnotation",
|
||||||
|
"start": 47,
|
||||||
|
"end": 55,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 19
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeParameters": null,
|
||||||
|
"params": [],
|
||||||
|
"rest": null,
|
||||||
|
"returnType": {
|
||||||
|
"type": "VoidTypeAnnotation",
|
||||||
|
"start": 51,
|
||||||
|
"end": 55,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 23
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 27
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"predicate": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FunctionDeclaration",
|
||||||
|
"start": 56,
|
||||||
|
"end": 72,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 65,
|
||||||
|
"end": 67,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 9
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 11
|
||||||
|
},
|
||||||
|
"identifierName": "F1"
|
||||||
|
},
|
||||||
|
"name": "F1"
|
||||||
|
},
|
||||||
|
"generator": false,
|
||||||
|
"async": false,
|
||||||
|
"params": [],
|
||||||
|
"body": {
|
||||||
|
"type": "BlockStatement",
|
||||||
|
"start": 70,
|
||||||
|
"end": 72,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": [],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
3
packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-var/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-var/input.js
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
declare var V1;
|
||||||
|
declare var V1;
|
||||||
|
var V1;
|
||||||
150
packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-var/output.json
vendored
Normal file
150
packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-var/output.json
vendored
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start": 0,
|
||||||
|
"end": 39,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 7
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start": 0,
|
||||||
|
"end": 39,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 7
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "module",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "DeclareVariable",
|
||||||
|
"start": 0,
|
||||||
|
"end": 15,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 12,
|
||||||
|
"end": 14,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"identifierName": "V1"
|
||||||
|
},
|
||||||
|
"name": "V1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "DeclareVariable",
|
||||||
|
"start": 16,
|
||||||
|
"end": 31,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 28,
|
||||||
|
"end": 30,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"identifierName": "V1"
|
||||||
|
},
|
||||||
|
"name": "V1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"start": 32,
|
||||||
|
"end": 39,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 7
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"declarations": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarator",
|
||||||
|
"start": 36,
|
||||||
|
"end": 38,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 4
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 6
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 36,
|
||||||
|
"end": 38,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 4
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 6
|
||||||
|
},
|
||||||
|
"identifierName": "V1"
|
||||||
|
},
|
||||||
|
"name": "V1"
|
||||||
|
},
|
||||||
|
"init": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "var"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
2
packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/input.js
vendored
Normal file
2
packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/input.js
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
interface I {};
|
||||||
|
interface I {};
|
||||||
8
packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/options.json
vendored
Normal file
8
packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/options.json
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"sourceType": "module",
|
||||||
|
"plugins": [
|
||||||
|
"jsx",
|
||||||
|
"flow"
|
||||||
|
],
|
||||||
|
"throws": "Identifier 'I' has already been declared (2:10)"
|
||||||
|
}
|
||||||
2
packages/babel-parser/test/fixtures/flow/multiple-declarations/type/input.js
vendored
Normal file
2
packages/babel-parser/test/fixtures/flow/multiple-declarations/type/input.js
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
type T1 = string;
|
||||||
|
type T1 = number;
|
||||||
8
packages/babel-parser/test/fixtures/flow/multiple-declarations/type/options.json
vendored
Normal file
8
packages/babel-parser/test/fixtures/flow/multiple-declarations/type/options.json
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"sourceType": "module",
|
||||||
|
"plugins": [
|
||||||
|
"jsx",
|
||||||
|
"flow"
|
||||||
|
],
|
||||||
|
"throws": "Identifier 'T1' has already been declared (2:5)"
|
||||||
|
}
|
||||||
8
packages/babel-parser/test/fixtures/flow/regression/issue-10044/input.js
vendored
Normal file
8
packages/babel-parser/test/fixtures/flow/regression/issue-10044/input.js
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
declare class C1 {}
|
||||||
|
declare interface I1 {}
|
||||||
|
declare type T1 = number;
|
||||||
|
|
||||||
|
interface I2 {}
|
||||||
|
type T2 = number;
|
||||||
|
|
||||||
|
export type { C1, I1, I2, T1, T2 }
|
||||||
564
packages/babel-parser/test/fixtures/flow/regression/issue-10044/output.json
vendored
Normal file
564
packages/babel-parser/test/fixtures/flow/regression/issue-10044/output.json
vendored
Normal file
@ -0,0 +1,564 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start": 0,
|
||||||
|
"end": 140,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 34
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start": 0,
|
||||||
|
"end": 140,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 34
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "module",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "DeclareClass",
|
||||||
|
"start": 0,
|
||||||
|
"end": 19,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 19
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 14,
|
||||||
|
"end": 16,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16
|
||||||
|
},
|
||||||
|
"identifierName": "C1"
|
||||||
|
},
|
||||||
|
"name": "C1"
|
||||||
|
},
|
||||||
|
"typeParameters": null,
|
||||||
|
"extends": [],
|
||||||
|
"implements": [],
|
||||||
|
"mixins": [],
|
||||||
|
"body": {
|
||||||
|
"type": "ObjectTypeAnnotation",
|
||||||
|
"start": 17,
|
||||||
|
"end": 19,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 19
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"callProperties": [],
|
||||||
|
"properties": [],
|
||||||
|
"indexers": [],
|
||||||
|
"internalSlots": [],
|
||||||
|
"exact": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "DeclareInterface",
|
||||||
|
"start": 20,
|
||||||
|
"end": 43,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 23
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 38,
|
||||||
|
"end": 40,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 18
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 20
|
||||||
|
},
|
||||||
|
"identifierName": "I1"
|
||||||
|
},
|
||||||
|
"name": "I1"
|
||||||
|
},
|
||||||
|
"typeParameters": null,
|
||||||
|
"extends": [],
|
||||||
|
"implements": [],
|
||||||
|
"mixins": [],
|
||||||
|
"body": {
|
||||||
|
"type": "ObjectTypeAnnotation",
|
||||||
|
"start": 41,
|
||||||
|
"end": 43,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 21
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 23
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"callProperties": [],
|
||||||
|
"properties": [],
|
||||||
|
"indexers": [],
|
||||||
|
"internalSlots": [],
|
||||||
|
"exact": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "DeclareTypeAlias",
|
||||||
|
"start": 44,
|
||||||
|
"end": 69,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 25
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 57,
|
||||||
|
"end": 59,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 13
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 15
|
||||||
|
},
|
||||||
|
"identifierName": "T1"
|
||||||
|
},
|
||||||
|
"name": "T1"
|
||||||
|
},
|
||||||
|
"typeParameters": null,
|
||||||
|
"right": {
|
||||||
|
"type": "NumberTypeAnnotation",
|
||||||
|
"start": 62,
|
||||||
|
"end": 68,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 18
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 3,
|
||||||
|
"column": 24
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "InterfaceDeclaration",
|
||||||
|
"start": 71,
|
||||||
|
"end": 86,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 5,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 5,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 81,
|
||||||
|
"end": 83,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 5,
|
||||||
|
"column": 10
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 5,
|
||||||
|
"column": 12
|
||||||
|
},
|
||||||
|
"identifierName": "I2"
|
||||||
|
},
|
||||||
|
"name": "I2"
|
||||||
|
},
|
||||||
|
"typeParameters": null,
|
||||||
|
"extends": [],
|
||||||
|
"implements": [],
|
||||||
|
"mixins": [],
|
||||||
|
"body": {
|
||||||
|
"type": "ObjectTypeAnnotation",
|
||||||
|
"start": 84,
|
||||||
|
"end": 86,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 5,
|
||||||
|
"column": 13
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 5,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"callProperties": [],
|
||||||
|
"properties": [],
|
||||||
|
"indexers": [],
|
||||||
|
"internalSlots": [],
|
||||||
|
"exact": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TypeAlias",
|
||||||
|
"start": 87,
|
||||||
|
"end": 104,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 6,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 6,
|
||||||
|
"column": 17
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 92,
|
||||||
|
"end": 94,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 6,
|
||||||
|
"column": 5
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 6,
|
||||||
|
"column": 7
|
||||||
|
},
|
||||||
|
"identifierName": "T2"
|
||||||
|
},
|
||||||
|
"name": "T2"
|
||||||
|
},
|
||||||
|
"typeParameters": null,
|
||||||
|
"right": {
|
||||||
|
"type": "NumberTypeAnnotation",
|
||||||
|
"start": 97,
|
||||||
|
"end": 103,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 6,
|
||||||
|
"column": 10
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 6,
|
||||||
|
"column": 16
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ExportNamedDeclaration",
|
||||||
|
"start": 106,
|
||||||
|
"end": 140,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 34
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"specifiers": [
|
||||||
|
{
|
||||||
|
"type": "ExportSpecifier",
|
||||||
|
"start": 120,
|
||||||
|
"end": 122,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"local": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 120,
|
||||||
|
"end": 122,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 16
|
||||||
|
},
|
||||||
|
"identifierName": "C1"
|
||||||
|
},
|
||||||
|
"name": "C1"
|
||||||
|
},
|
||||||
|
"exported": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 120,
|
||||||
|
"end": 122,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 16
|
||||||
|
},
|
||||||
|
"identifierName": "C1"
|
||||||
|
},
|
||||||
|
"name": "C1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ExportSpecifier",
|
||||||
|
"start": 124,
|
||||||
|
"end": 126,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 18
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"local": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 124,
|
||||||
|
"end": 126,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 18
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 20
|
||||||
|
},
|
||||||
|
"identifierName": "I1"
|
||||||
|
},
|
||||||
|
"name": "I1"
|
||||||
|
},
|
||||||
|
"exported": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 124,
|
||||||
|
"end": 126,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 18
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 20
|
||||||
|
},
|
||||||
|
"identifierName": "I1"
|
||||||
|
},
|
||||||
|
"name": "I1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ExportSpecifier",
|
||||||
|
"start": 128,
|
||||||
|
"end": 130,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 22
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 24
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"local": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 128,
|
||||||
|
"end": 130,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 22
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 24
|
||||||
|
},
|
||||||
|
"identifierName": "I2"
|
||||||
|
},
|
||||||
|
"name": "I2"
|
||||||
|
},
|
||||||
|
"exported": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 128,
|
||||||
|
"end": 130,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 22
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 24
|
||||||
|
},
|
||||||
|
"identifierName": "I2"
|
||||||
|
},
|
||||||
|
"name": "I2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ExportSpecifier",
|
||||||
|
"start": 132,
|
||||||
|
"end": 134,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 26
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 28
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"local": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 132,
|
||||||
|
"end": 134,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 26
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 28
|
||||||
|
},
|
||||||
|
"identifierName": "T1"
|
||||||
|
},
|
||||||
|
"name": "T1"
|
||||||
|
},
|
||||||
|
"exported": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 132,
|
||||||
|
"end": 134,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 26
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 28
|
||||||
|
},
|
||||||
|
"identifierName": "T1"
|
||||||
|
},
|
||||||
|
"name": "T1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ExportSpecifier",
|
||||||
|
"start": 136,
|
||||||
|
"end": 138,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 30
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 32
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"local": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 136,
|
||||||
|
"end": 138,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 30
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 32
|
||||||
|
},
|
||||||
|
"identifierName": "T2"
|
||||||
|
},
|
||||||
|
"name": "T2"
|
||||||
|
},
|
||||||
|
"exported": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 136,
|
||||||
|
"end": 138,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 30
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 8,
|
||||||
|
"column": 32
|
||||||
|
},
|
||||||
|
"identifierName": "T2"
|
||||||
|
},
|
||||||
|
"name": "T2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": null,
|
||||||
|
"exportKind": "type",
|
||||||
|
"declaration": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"throws": "Identifier 'A' has already been declared (2:12)"
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"throws": "Identifier 'A' has already been declared (2:9)"
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"throws": "Identifier 'A' has already been declared (2:4)"
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"throws": "Identifier 'A' has already been declared (2:14)"
|
|
||||||
}
|
|
||||||
147
packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-class/output.json
vendored
Normal file
147
packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-class/output.json
vendored
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start": 0,
|
||||||
|
"end": 37,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start": 0,
|
||||||
|
"end": 37,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "module",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "DeclareClass",
|
||||||
|
"start": 0,
|
||||||
|
"end": 18,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 14,
|
||||||
|
"end": 15,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 15
|
||||||
|
},
|
||||||
|
"identifierName": "A"
|
||||||
|
},
|
||||||
|
"name": "A"
|
||||||
|
},
|
||||||
|
"typeParameters": null,
|
||||||
|
"extends": [],
|
||||||
|
"implements": [],
|
||||||
|
"mixins": [],
|
||||||
|
"body": {
|
||||||
|
"type": "ObjectTypeAnnotation",
|
||||||
|
"start": 16,
|
||||||
|
"end": 18,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"callProperties": [],
|
||||||
|
"properties": [],
|
||||||
|
"indexers": [],
|
||||||
|
"internalSlots": [],
|
||||||
|
"exact": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "DeclareClass",
|
||||||
|
"start": 19,
|
||||||
|
"end": 37,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 33,
|
||||||
|
"end": 34,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 15
|
||||||
|
},
|
||||||
|
"identifierName": "A"
|
||||||
|
},
|
||||||
|
"name": "A"
|
||||||
|
},
|
||||||
|
"typeParameters": null,
|
||||||
|
"extends": [],
|
||||||
|
"implements": [],
|
||||||
|
"mixins": [],
|
||||||
|
"body": {
|
||||||
|
"type": "ObjectTypeAnnotation",
|
||||||
|
"start": 35,
|
||||||
|
"end": 37,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 16
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"callProperties": [],
|
||||||
|
"properties": [],
|
||||||
|
"indexers": [],
|
||||||
|
"internalSlots": [],
|
||||||
|
"exact": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
178
packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-var/output.json
vendored
Normal file
178
packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-var/output.json
vendored
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start": 0,
|
||||||
|
"end": 50,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 22
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start": 0,
|
||||||
|
"end": 50,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 22
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "module",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "DeclareFunction",
|
||||||
|
"start": 0,
|
||||||
|
"end": 27,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 17,
|
||||||
|
"end": 26,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 26
|
||||||
|
},
|
||||||
|
"identifierName": "A"
|
||||||
|
},
|
||||||
|
"name": "A",
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TypeAnnotation",
|
||||||
|
"start": 18,
|
||||||
|
"end": 26,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 26
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "FunctionTypeAnnotation",
|
||||||
|
"start": 18,
|
||||||
|
"end": 26,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 26
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeParameters": null,
|
||||||
|
"params": [],
|
||||||
|
"rest": null,
|
||||||
|
"returnType": {
|
||||||
|
"type": "VoidTypeAnnotation",
|
||||||
|
"start": 22,
|
||||||
|
"end": 26,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 22
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 26
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"predicate": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "DeclareVariable",
|
||||||
|
"start": 28,
|
||||||
|
"end": 50,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 22
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 40,
|
||||||
|
"end": 49,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 12
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 21
|
||||||
|
},
|
||||||
|
"identifierName": "A"
|
||||||
|
},
|
||||||
|
"name": "A",
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TypeAnnotation",
|
||||||
|
"start": 41,
|
||||||
|
"end": 49,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 13
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 21
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "NumberTypeAnnotation",
|
||||||
|
"start": 43,
|
||||||
|
"end": 49,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 15
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 21
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
7
packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/options.json
vendored
Normal file
7
packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/options.json
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"sourceType": "module",
|
||||||
|
"plugins": [
|
||||||
|
"jsx",
|
||||||
|
"flow"
|
||||||
|
]
|
||||||
|
}
|
||||||
168
packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/output.json
vendored
Normal file
168
packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/output.json
vendored
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start": 0,
|
||||||
|
"end": 43,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start": 0,
|
||||||
|
"end": 43,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "module",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "DeclareFunction",
|
||||||
|
"start": 0,
|
||||||
|
"end": 27,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 17,
|
||||||
|
"end": 26,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 26
|
||||||
|
},
|
||||||
|
"identifierName": "A"
|
||||||
|
},
|
||||||
|
"name": "A",
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TypeAnnotation",
|
||||||
|
"start": 18,
|
||||||
|
"end": 26,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 26
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "FunctionTypeAnnotation",
|
||||||
|
"start": 18,
|
||||||
|
"end": 26,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 26
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeParameters": null,
|
||||||
|
"params": [],
|
||||||
|
"rest": null,
|
||||||
|
"returnType": {
|
||||||
|
"type": "VoidTypeAnnotation",
|
||||||
|
"start": 22,
|
||||||
|
"end": 26,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 22
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 26
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"predicate": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FunctionDeclaration",
|
||||||
|
"start": 28,
|
||||||
|
"end": 43,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 37,
|
||||||
|
"end": 38,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 9
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 10
|
||||||
|
},
|
||||||
|
"identifierName": "A"
|
||||||
|
},
|
||||||
|
"name": "A"
|
||||||
|
},
|
||||||
|
"generator": false,
|
||||||
|
"async": false,
|
||||||
|
"params": [],
|
||||||
|
"body": {
|
||||||
|
"type": "BlockStatement",
|
||||||
|
"start": 41,
|
||||||
|
"end": 43,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 13
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 2,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"body": [],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,2 +1,2 @@
|
|||||||
declare class foo {}
|
declare class foo {}
|
||||||
const foo = 1;
|
const foo1 = 1;
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
var foo = 1;
|
var foo1 = 1;
|
||||||
|
|||||||
@ -4,13 +4,13 @@ declare function foo(): void
|
|||||||
declare function foo(): void;
|
declare function foo(): void;
|
||||||
declare function foo<T>(): void;
|
declare function foo<T>(): void;
|
||||||
declare function foo(x: number, y: string): void;
|
declare function foo(x: number, y: string): void;
|
||||||
declare class A {}
|
declare class A1 {}
|
||||||
declare class A<T> extends B<T> { x: number }
|
declare class A1<T> extends B<T> { x: number }
|
||||||
declare class A { static foo(): number, static x : string }
|
declare class A1 { static foo(): number, static x : string }
|
||||||
declare class A { static [ indexer: number]: string }
|
declare class A1 { static [ indexer: number]: string }
|
||||||
declare class A { static () : number }
|
declare class A1 { static () : number }
|
||||||
declare class A mixins B<T>, C {}
|
declare class A1 mixins B<T>, C {}
|
||||||
declare type A = string
|
declare type A2 = string
|
||||||
declare type T<U> = { [k:string]: U }
|
declare type T<U> = { [k:string]: U }
|
||||||
declare interface I { foo: string }
|
declare interface I1 { foo: string }
|
||||||
declare interface I<T> { foo: T }
|
declare interface I2<T> { foo: T }
|
||||||
|
|||||||
@ -10,22 +10,22 @@
|
|||||||
|
|
||||||
/*:: declare function foo(x: number, y: string): void;*/
|
/*:: declare function foo(x: number, y: string): void;*/
|
||||||
|
|
||||||
/*:: declare class A {}*/
|
/*:: declare class A1 {}*/
|
||||||
|
|
||||||
/*:: declare class A<T> extends B<T> { x: number }*/
|
/*:: declare class A1<T> extends B<T> { x: number }*/
|
||||||
|
|
||||||
/*:: declare class A { static foo(): number, static x : string }*/
|
/*:: declare class A1 { static foo(): number, static x : string }*/
|
||||||
|
|
||||||
/*:: declare class A { static [ indexer: number]: string }*/
|
/*:: declare class A1 { static [ indexer: number]: string }*/
|
||||||
|
|
||||||
/*:: declare class A { static () : number }*/
|
/*:: declare class A1 { static () : number }*/
|
||||||
|
|
||||||
/*:: declare class A mixins B<T>, C {}*/
|
/*:: declare class A1 mixins B<T>, C {}*/
|
||||||
|
|
||||||
/*:: declare type A = string*/
|
/*:: declare type A2 = string*/
|
||||||
|
|
||||||
/*:: declare type T<U> = { [k:string]: U }*/
|
/*:: declare type T<U> = { [k:string]: U }*/
|
||||||
|
|
||||||
/*:: declare interface I { foo: string }*/
|
/*:: declare interface I1 { foo: string }*/
|
||||||
|
|
||||||
/*:: declare interface I<T> { foo: T }*/
|
/*:: declare interface I2<T> { foo: T }*/
|
||||||
|
|||||||
@ -5,10 +5,10 @@ type T1 = { +p: T }
|
|||||||
type T2 = { -p: T }
|
type T2 = { -p: T }
|
||||||
type T3 = { +[k:K]: V }
|
type T3 = { +[k:K]: V }
|
||||||
type T4 = { -[k:K]: V }
|
type T4 = { -[k:K]: V }
|
||||||
interface I { +p: T }
|
interface I1 { +p: T }
|
||||||
interface I { -p: T }
|
interface I2 { -p: T }
|
||||||
interface I { +[k:K]: V }
|
interface I3 { +[k:K]: V }
|
||||||
interface I { -[k:K]: V }
|
interface I4 { -[k:K]: V }
|
||||||
declare class I { +p: T }
|
declare class I { +p: T }
|
||||||
declare class I { -p: T }
|
declare class I { -p: T }
|
||||||
declare class I { +[k:K]: V }
|
declare class I { +[k:K]: V }
|
||||||
|
|||||||
@ -4,14 +4,14 @@ declare function foo(): void
|
|||||||
declare function foo(): void;
|
declare function foo(): void;
|
||||||
declare function foo<T>(): void;
|
declare function foo<T>(): void;
|
||||||
declare function foo(x: number, y: string): void;
|
declare function foo(x: number, y: string): void;
|
||||||
declare class A {}
|
declare class A1 {}
|
||||||
declare class A<T> extends B<T> { x: number }
|
declare class A1<T> extends B<T> { x: number }
|
||||||
declare class A { static foo(): number; static x : string }
|
declare class A1 { static foo(): number; static x : string }
|
||||||
declare class A { static [ indexer: number]: string }
|
declare class A1 { static [ indexer: number]: string }
|
||||||
declare class A { static () : number }
|
declare class A1 { static () : number }
|
||||||
declare class A mixins B<T>, C {}
|
declare class A1 mixins B<T>, C {}
|
||||||
declare type A = string
|
declare type A2 = string
|
||||||
declare type T<U> = { [k:string]: U }
|
declare type T<U> = { [k:string]: U }
|
||||||
declare interface I { foo: string }
|
declare interface I1 { foo: string }
|
||||||
declare interface I<T> { foo: T }
|
declare interface I2<T> { foo: T }
|
||||||
declare module.exports: string;
|
declare module.exports: string;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
interface A {}
|
interface A1 {}
|
||||||
interface A extends B {}
|
interface A2 extends B {}
|
||||||
interface A<T> extends B<T>, C<T> {}
|
interface A3<T> extends B<T>, C<T> {}
|
||||||
interface A { foo: () => number; }
|
interface A4 { foo: () => number; }
|
||||||
interface Dictionary { [index: string]: string; length: number; }
|
interface Dictionary { [index: string]: string; length: number; }
|
||||||
class Foo implements Bar {}
|
class Foo implements Bar {}
|
||||||
class Foo2 extends Bar implements Bat, Man<number> {}
|
class Foo2 extends Bar implements Bat, Man<number> {}
|
||||||
|
|||||||
@ -6,10 +6,10 @@ declare class A {
|
|||||||
@@asyncIterator(): Iterator<File>;
|
@@asyncIterator(): Iterator<File>;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface A {
|
interface A1 {
|
||||||
@@iterator(): Iterator<File>;
|
@@iterator(): Iterator<File>;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface A {
|
interface A2 {
|
||||||
@@asyncIterator(): Iterator<File>;
|
@@asyncIterator(): Iterator<File>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,4 @@
|
|||||||
|
function f(): void;
|
||||||
|
function f(): void {
|
||||||
|
}
|
||||||
|
export { f }
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"plugins": ["transform-typescript"],
|
||||||
|
"sourceType": "module"
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
function f() {}
|
||||||
|
|
||||||
|
export { f };
|
||||||
Loading…
x
Reference in New Issue
Block a user