fix(babel-parser): avoid state.clone() to clone the whole token store (#11029)
* fix(babel-parser): avoid state.clone() to clone the whole token store
Fixed the performance issue on large input when turned on option {tokens: true} and typescript plugin which uses quite a few state.clone().
* test(babel-parser): turn on 2 typescript tests with tokens:true
The output.json is generated by old master to make sure no regression.
* fix(babel-parser): avoid duplicated tokens trapped by mainly typescript/flow plugins
* test(babel-parser): update output.json to latest master result
* chore(babel-parser): improve performance by storing tokensLength in state
This commit is contained in:
parent
740064ced7
commit
9bc04baeb5
@ -67,7 +67,7 @@ export default class StatementParser extends ExpressionParser {
|
|||||||
file.program = this.finishNode(program, "Program");
|
file.program = this.finishNode(program, "Program");
|
||||||
file.comments = this.state.comments;
|
file.comments = this.state.comments;
|
||||||
|
|
||||||
if (this.options.tokens) file.tokens = this.state.tokens;
|
if (this.options.tokens) file.tokens = this.tokens;
|
||||||
|
|
||||||
return this.finishNode(file, "File");
|
return this.finishNode(file, "File");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import type { Options } from "../options";
|
import type { Options } from "../options";
|
||||||
|
import * as N from "../types";
|
||||||
import type { Position } from "../util/location";
|
import type { Position } from "../util/location";
|
||||||
import * as charCodes from "charcodes";
|
import * as charCodes from "charcodes";
|
||||||
import { isIdentifierStart, isIdentifierChar } from "../util/identifier";
|
import { isIdentifierStart, isIdentifierChar } from "../util/identifier";
|
||||||
@ -114,6 +115,9 @@ export default class Tokenizer extends LocationParser {
|
|||||||
|
|
||||||
isLookahead: boolean;
|
isLookahead: boolean;
|
||||||
|
|
||||||
|
// Token store.
|
||||||
|
tokens: Array<Token | N.Comment> = [];
|
||||||
|
|
||||||
constructor(options: Options, input: string) {
|
constructor(options: Options, input: string) {
|
||||||
super();
|
super();
|
||||||
this.state = new State();
|
this.state = new State();
|
||||||
@ -123,13 +127,21 @@ export default class Tokenizer extends LocationParser {
|
|||||||
this.isLookahead = false;
|
this.isLookahead = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pushToken(token: Token | N.Comment) {
|
||||||
|
// Pop out invalid tokens trapped by try-catch parsing.
|
||||||
|
// Those parsing branches are mainly created by typescript and flow plugins.
|
||||||
|
this.tokens.length = this.state.tokensLength;
|
||||||
|
this.tokens.push(token);
|
||||||
|
++this.state.tokensLength;
|
||||||
|
}
|
||||||
|
|
||||||
// Move to the next token
|
// Move to the next token
|
||||||
|
|
||||||
next(): void {
|
next(): void {
|
||||||
if (!this.isLookahead) {
|
if (!this.isLookahead) {
|
||||||
this.checkKeywordEscapes();
|
this.checkKeywordEscapes();
|
||||||
if (this.options.tokens) {
|
if (this.options.tokens) {
|
||||||
this.state.tokens.push(new Token(this.state));
|
this.pushToken(new Token(this.state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +254,7 @@ export default class Tokenizer extends LocationParser {
|
|||||||
loc: new SourceLocation(startLoc, endLoc),
|
loc: new SourceLocation(startLoc, endLoc),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.options.tokens) this.state.tokens.push(comment);
|
if (this.options.tokens) this.pushToken(comment);
|
||||||
this.state.comments.push(comment);
|
this.state.comments.push(comment);
|
||||||
this.addComment(comment);
|
this.addComment(comment);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import * as N from "../types";
|
|||||||
import { Position } from "../util/location";
|
import { Position } from "../util/location";
|
||||||
|
|
||||||
import { types as ct, type TokContext } from "./context";
|
import { types as ct, type TokContext } from "./context";
|
||||||
import type { Token } from "./index";
|
|
||||||
import { types as tt, type TokenType } from "./types";
|
import { types as tt, type TokenType } from "./types";
|
||||||
|
|
||||||
type TopicContextState = {
|
type TopicContextState = {
|
||||||
@ -93,9 +92,6 @@ export default class State {
|
|||||||
yieldPos: number = -1;
|
yieldPos: number = -1;
|
||||||
awaitPos: number = -1;
|
awaitPos: number = -1;
|
||||||
|
|
||||||
// Token store.
|
|
||||||
tokens: Array<Token | N.Comment> = [];
|
|
||||||
|
|
||||||
// Comment store.
|
// Comment store.
|
||||||
comments: Array<N.Comment> = [];
|
comments: Array<N.Comment> = [];
|
||||||
|
|
||||||
@ -153,6 +149,9 @@ export default class State {
|
|||||||
// `export default foo;` and `export { foo as default };`.
|
// `export default foo;` and `export { foo as default };`.
|
||||||
exportedIdentifiers: Array<string> = [];
|
exportedIdentifiers: Array<string> = [];
|
||||||
|
|
||||||
|
// Tokens length in token store
|
||||||
|
tokensLength: number = 0;
|
||||||
|
|
||||||
curPosition(): Position {
|
curPosition(): Position {
|
||||||
return new Position(this.curLine, this.pos - this.lineStart);
|
return new Position(this.curLine, this.pos - this.lineStart);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"sourceType": "module",
|
||||||
|
"plugins": ["typescript"],
|
||||||
|
"tokens": true
|
||||||
|
}
|
||||||
623
packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-tokens-true/output.json
vendored
Normal file
623
packages/babel-parser/test/fixtures/typescript/arrow-function/async-generic-tokens-true/output.json
vendored
Normal file
@ -0,0 +1,623 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start": 0,
|
||||||
|
"end": 24,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 24
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start": 0,
|
||||||
|
"end": 24,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 24
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "module",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ExpressionStatement",
|
||||||
|
"start": 0,
|
||||||
|
"end": 24,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 24
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"expression": {
|
||||||
|
"type": "ArrowFunctionExpression",
|
||||||
|
"start": 0,
|
||||||
|
"end": 23,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 23
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeParameters": {
|
||||||
|
"type": "TSTypeParameterDeclaration",
|
||||||
|
"start": 6,
|
||||||
|
"end": 9,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "TSTypeParameter",
|
||||||
|
"start": 7,
|
||||||
|
"end": 8,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 7
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 8
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "T"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 10,
|
||||||
|
"end": 14,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"identifierName": "a"
|
||||||
|
},
|
||||||
|
"name": "a",
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSTypeAnnotation",
|
||||||
|
"start": 11,
|
||||||
|
"end": 14,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 11
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSTypeReference",
|
||||||
|
"start": 13,
|
||||||
|
"end": 14,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeName": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 13,
|
||||||
|
"end": 14,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"identifierName": "T"
|
||||||
|
},
|
||||||
|
"name": "T"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"returnType": {
|
||||||
|
"type": "TSTypeAnnotation",
|
||||||
|
"start": 15,
|
||||||
|
"end": 18,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 15
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSTypeReference",
|
||||||
|
"start": 17,
|
||||||
|
"end": 18,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeName": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 17,
|
||||||
|
"end": 18,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18
|
||||||
|
},
|
||||||
|
"identifierName": "T"
|
||||||
|
},
|
||||||
|
"name": "T"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": null,
|
||||||
|
"generator": false,
|
||||||
|
"async": true,
|
||||||
|
"body": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 22,
|
||||||
|
"end": 23,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 22
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 23
|
||||||
|
},
|
||||||
|
"identifierName": "a"
|
||||||
|
},
|
||||||
|
"name": "a"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
},
|
||||||
|
"tokens": [
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "name",
|
||||||
|
"beforeExpr": false,
|
||||||
|
"startsExpr": true,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null
|
||||||
|
},
|
||||||
|
"value": "async",
|
||||||
|
"start": 0,
|
||||||
|
"end": 5,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "</>/<=/>=",
|
||||||
|
"beforeExpr": true,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": 7,
|
||||||
|
"updateContext": null
|
||||||
|
},
|
||||||
|
"value": "<",
|
||||||
|
"start": 6,
|
||||||
|
"end": 7,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 7
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "name",
|
||||||
|
"beforeExpr": false,
|
||||||
|
"startsExpr": true,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null
|
||||||
|
},
|
||||||
|
"value": "T",
|
||||||
|
"start": 7,
|
||||||
|
"end": 8,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 7
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "</>/<=/>=",
|
||||||
|
"beforeExpr": true,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": 7,
|
||||||
|
"updateContext": null
|
||||||
|
},
|
||||||
|
"value": ">",
|
||||||
|
"start": 8,
|
||||||
|
"end": 9,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 8
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 9
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "(",
|
||||||
|
"beforeExpr": true,
|
||||||
|
"startsExpr": true,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null
|
||||||
|
},
|
||||||
|
"start": 9,
|
||||||
|
"end": 10,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 9
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "name",
|
||||||
|
"beforeExpr": false,
|
||||||
|
"startsExpr": true,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null
|
||||||
|
},
|
||||||
|
"value": "a",
|
||||||
|
"start": 10,
|
||||||
|
"end": 11,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 10
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 11
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": ":",
|
||||||
|
"beforeExpr": true,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null,
|
||||||
|
"updateContext": null
|
||||||
|
},
|
||||||
|
"start": 11,
|
||||||
|
"end": 12,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 11
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "name",
|
||||||
|
"beforeExpr": false,
|
||||||
|
"startsExpr": true,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null
|
||||||
|
},
|
||||||
|
"value": "T",
|
||||||
|
"start": 13,
|
||||||
|
"end": 14,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 13
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": ")",
|
||||||
|
"beforeExpr": false,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null
|
||||||
|
},
|
||||||
|
"start": 14,
|
||||||
|
"end": 15,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 14
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 15
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": ":",
|
||||||
|
"beforeExpr": true,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null,
|
||||||
|
"updateContext": null
|
||||||
|
},
|
||||||
|
"start": 15,
|
||||||
|
"end": 16,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 15
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "name",
|
||||||
|
"beforeExpr": false,
|
||||||
|
"startsExpr": true,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null
|
||||||
|
},
|
||||||
|
"value": "T",
|
||||||
|
"start": 17,
|
||||||
|
"end": 18,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 18
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "=>",
|
||||||
|
"beforeExpr": true,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null,
|
||||||
|
"updateContext": null
|
||||||
|
},
|
||||||
|
"start": 19,
|
||||||
|
"end": 21,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 19
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 21
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "name",
|
||||||
|
"beforeExpr": false,
|
||||||
|
"startsExpr": true,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null
|
||||||
|
},
|
||||||
|
"value": "a",
|
||||||
|
"start": 22,
|
||||||
|
"end": 23,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 22
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 23
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": ";",
|
||||||
|
"beforeExpr": true,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null,
|
||||||
|
"updateContext": null
|
||||||
|
},
|
||||||
|
"start": 23,
|
||||||
|
"end": 24,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 23
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 24
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "eof",
|
||||||
|
"beforeExpr": false,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null,
|
||||||
|
"updateContext": null
|
||||||
|
},
|
||||||
|
"start": 24,
|
||||||
|
"end": 24,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 24
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 24
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -1,231 +0,0 @@
|
|||||||
{
|
|
||||||
"type": "File",
|
|
||||||
"start": 0,
|
|
||||||
"end": 24,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 0
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 24
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"program": {
|
|
||||||
"type": "Program",
|
|
||||||
"start": 0,
|
|
||||||
"end": 24,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 0
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 24
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"sourceType": "module",
|
|
||||||
"interpreter": null,
|
|
||||||
"body": [
|
|
||||||
{
|
|
||||||
"type": "ExpressionStatement",
|
|
||||||
"start": 0,
|
|
||||||
"end": 24,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 0
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 24
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"expression": {
|
|
||||||
"type": "ArrowFunctionExpression",
|
|
||||||
"start": 0,
|
|
||||||
"end": 23,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 0
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 23
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"typeParameters": {
|
|
||||||
"type": "TSTypeParameterDeclaration",
|
|
||||||
"start": 6,
|
|
||||||
"end": 9,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 6
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 9
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"params": [
|
|
||||||
{
|
|
||||||
"type": "TSTypeParameter",
|
|
||||||
"start": 7,
|
|
||||||
"end": 8,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 7
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 8
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"name": "T"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"params": [
|
|
||||||
{
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 10,
|
|
||||||
"end": 14,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 10
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 14
|
|
||||||
},
|
|
||||||
"identifierName": "a"
|
|
||||||
},
|
|
||||||
"name": "a",
|
|
||||||
"typeAnnotation": {
|
|
||||||
"type": "TSTypeAnnotation",
|
|
||||||
"start": 11,
|
|
||||||
"end": 14,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 11
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 14
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"typeAnnotation": {
|
|
||||||
"type": "TSTypeReference",
|
|
||||||
"start": 13,
|
|
||||||
"end": 14,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 13
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 14
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"typeName": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 13,
|
|
||||||
"end": 14,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 13
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 14
|
|
||||||
},
|
|
||||||
"identifierName": "T"
|
|
||||||
},
|
|
||||||
"name": "T"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"returnType": {
|
|
||||||
"type": "TSTypeAnnotation",
|
|
||||||
"start": 15,
|
|
||||||
"end": 18,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 15
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 18
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"typeAnnotation": {
|
|
||||||
"type": "TSTypeReference",
|
|
||||||
"start": 17,
|
|
||||||
"end": 18,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 17
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 18
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"typeName": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 17,
|
|
||||||
"end": 18,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 17
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 18
|
|
||||||
},
|
|
||||||
"identifierName": "T"
|
|
||||||
},
|
|
||||||
"name": "T"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"id": null,
|
|
||||||
"generator": false,
|
|
||||||
"async": true,
|
|
||||||
"body": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 22,
|
|
||||||
"end": 23,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 22
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 23
|
|
||||||
},
|
|
||||||
"identifierName": "a"
|
|
||||||
},
|
|
||||||
"name": "a"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"directives": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"sourceType": "module",
|
||||||
|
"plugins": ["typescript"],
|
||||||
|
"tokens": true
|
||||||
|
}
|
||||||
804
packages/babel-parser/test/fixtures/typescript/type-alias/generic-complex-tokens-true/output.json
vendored
Normal file
804
packages/babel-parser/test/fixtures/typescript/type-alias/generic-complex-tokens-true/output.json
vendored
Normal file
@ -0,0 +1,804 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start": 0,
|
||||||
|
"end": 52,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 52
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start": 0,
|
||||||
|
"end": 52,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 52
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceType": "module",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "TSTypeAliasDeclaration",
|
||||||
|
"start": 0,
|
||||||
|
"end": 52,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 52
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 5,
|
||||||
|
"end": 6,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 5
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6
|
||||||
|
},
|
||||||
|
"identifierName": "T"
|
||||||
|
},
|
||||||
|
"name": "T"
|
||||||
|
},
|
||||||
|
"typeParameters": {
|
||||||
|
"type": "TSTypeParameterDeclaration",
|
||||||
|
"start": 6,
|
||||||
|
"end": 40,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 40
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "TSTypeParameter",
|
||||||
|
"start": 7,
|
||||||
|
"end": 39,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 7
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 39
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "U",
|
||||||
|
"constraint": {
|
||||||
|
"type": "TSObjectKeyword",
|
||||||
|
"start": 17,
|
||||||
|
"end": 23,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 23
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"default": {
|
||||||
|
"type": "TSTypeLiteral",
|
||||||
|
"start": 26,
|
||||||
|
"end": 39,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 26
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 39
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "TSPropertySignature",
|
||||||
|
"start": 28,
|
||||||
|
"end": 37,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 28
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 37
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 28,
|
||||||
|
"end": 29,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 28
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 29
|
||||||
|
},
|
||||||
|
"identifierName": "x"
|
||||||
|
},
|
||||||
|
"name": "x"
|
||||||
|
},
|
||||||
|
"computed": false,
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSTypeAnnotation",
|
||||||
|
"start": 29,
|
||||||
|
"end": 37,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 29
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 37
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSNumberKeyword",
|
||||||
|
"start": 31,
|
||||||
|
"end": 37,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 31
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 37
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSTypeReference",
|
||||||
|
"start": 43,
|
||||||
|
"end": 51,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 43
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 51
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeName": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 43,
|
||||||
|
"end": 48,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 43
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 48
|
||||||
|
},
|
||||||
|
"identifierName": "Array"
|
||||||
|
},
|
||||||
|
"name": "Array"
|
||||||
|
},
|
||||||
|
"typeParameters": {
|
||||||
|
"type": "TSTypeParameterInstantiation",
|
||||||
|
"start": 48,
|
||||||
|
"end": 51,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 48
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 51
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "TSTypeReference",
|
||||||
|
"start": 49,
|
||||||
|
"end": 50,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 49
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 50
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeName": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start": 49,
|
||||||
|
"end": 50,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 49
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 50
|
||||||
|
},
|
||||||
|
"identifierName": "U"
|
||||||
|
},
|
||||||
|
"name": "U"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
},
|
||||||
|
"tokens": [
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "name",
|
||||||
|
"beforeExpr": false,
|
||||||
|
"startsExpr": true,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null
|
||||||
|
},
|
||||||
|
"value": "type",
|
||||||
|
"start": 0,
|
||||||
|
"end": 4,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 0
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "name",
|
||||||
|
"beforeExpr": false,
|
||||||
|
"startsExpr": true,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null
|
||||||
|
},
|
||||||
|
"value": "T",
|
||||||
|
"start": 5,
|
||||||
|
"end": 6,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 5
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "</>/<=/>=",
|
||||||
|
"beforeExpr": true,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": 7,
|
||||||
|
"updateContext": null
|
||||||
|
},
|
||||||
|
"value": "<",
|
||||||
|
"start": 6,
|
||||||
|
"end": 7,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 6
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 7
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "name",
|
||||||
|
"beforeExpr": false,
|
||||||
|
"startsExpr": true,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null
|
||||||
|
},
|
||||||
|
"value": "U",
|
||||||
|
"start": 7,
|
||||||
|
"end": 8,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 7
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "extends",
|
||||||
|
"keyword": "extends",
|
||||||
|
"beforeExpr": true,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null,
|
||||||
|
"updateContext": null
|
||||||
|
},
|
||||||
|
"value": "extends",
|
||||||
|
"start": 9,
|
||||||
|
"end": 16,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 9
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 16
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "name",
|
||||||
|
"beforeExpr": false,
|
||||||
|
"startsExpr": true,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null
|
||||||
|
},
|
||||||
|
"value": "object",
|
||||||
|
"start": 17,
|
||||||
|
"end": 23,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 17
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 23
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "=",
|
||||||
|
"beforeExpr": true,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": true,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null,
|
||||||
|
"updateContext": null
|
||||||
|
},
|
||||||
|
"value": "=",
|
||||||
|
"start": 24,
|
||||||
|
"end": 25,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 24
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 25
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "{",
|
||||||
|
"beforeExpr": true,
|
||||||
|
"startsExpr": true,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null
|
||||||
|
},
|
||||||
|
"start": 26,
|
||||||
|
"end": 27,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 26
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 27
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "name",
|
||||||
|
"beforeExpr": false,
|
||||||
|
"startsExpr": true,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null
|
||||||
|
},
|
||||||
|
"value": "x",
|
||||||
|
"start": 28,
|
||||||
|
"end": 29,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 28
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 29
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": ":",
|
||||||
|
"beforeExpr": true,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null,
|
||||||
|
"updateContext": null
|
||||||
|
},
|
||||||
|
"start": 29,
|
||||||
|
"end": 30,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 29
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 30
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "name",
|
||||||
|
"beforeExpr": false,
|
||||||
|
"startsExpr": true,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null
|
||||||
|
},
|
||||||
|
"value": "number",
|
||||||
|
"start": 31,
|
||||||
|
"end": 37,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 31
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 37
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "}",
|
||||||
|
"beforeExpr": false,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null
|
||||||
|
},
|
||||||
|
"start": 38,
|
||||||
|
"end": 39,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 38
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 39
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "</>/<=/>=",
|
||||||
|
"beforeExpr": true,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": 7,
|
||||||
|
"updateContext": null
|
||||||
|
},
|
||||||
|
"value": ">",
|
||||||
|
"start": 39,
|
||||||
|
"end": 40,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 39
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 40
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "=",
|
||||||
|
"beforeExpr": true,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": true,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null,
|
||||||
|
"updateContext": null
|
||||||
|
},
|
||||||
|
"value": "=",
|
||||||
|
"start": 41,
|
||||||
|
"end": 42,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 41
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 42
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "name",
|
||||||
|
"beforeExpr": false,
|
||||||
|
"startsExpr": true,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null
|
||||||
|
},
|
||||||
|
"value": "Array",
|
||||||
|
"start": 43,
|
||||||
|
"end": 48,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 43
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 48
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "</>/<=/>=",
|
||||||
|
"beforeExpr": true,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": 7,
|
||||||
|
"updateContext": null
|
||||||
|
},
|
||||||
|
"value": "<",
|
||||||
|
"start": 48,
|
||||||
|
"end": 49,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 48
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 49
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "name",
|
||||||
|
"beforeExpr": false,
|
||||||
|
"startsExpr": true,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null
|
||||||
|
},
|
||||||
|
"value": "U",
|
||||||
|
"start": 49,
|
||||||
|
"end": 50,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 49
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 50
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "</>/<=/>=",
|
||||||
|
"beforeExpr": true,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": 7,
|
||||||
|
"updateContext": null
|
||||||
|
},
|
||||||
|
"value": ">",
|
||||||
|
"start": 50,
|
||||||
|
"end": 51,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 50
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 51
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": ";",
|
||||||
|
"beforeExpr": true,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null,
|
||||||
|
"updateContext": null
|
||||||
|
},
|
||||||
|
"start": 51,
|
||||||
|
"end": 52,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 51
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 52
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": {
|
||||||
|
"label": "eof",
|
||||||
|
"beforeExpr": false,
|
||||||
|
"startsExpr": false,
|
||||||
|
"rightAssociative": false,
|
||||||
|
"isLoop": false,
|
||||||
|
"isAssign": false,
|
||||||
|
"prefix": false,
|
||||||
|
"postfix": false,
|
||||||
|
"binop": null,
|
||||||
|
"updateContext": null
|
||||||
|
},
|
||||||
|
"start": 52,
|
||||||
|
"end": 52,
|
||||||
|
"loc": {
|
||||||
|
"start": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 52
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 1,
|
||||||
|
"column": 52
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -1,276 +0,0 @@
|
|||||||
{
|
|
||||||
"type": "File",
|
|
||||||
"start": 0,
|
|
||||||
"end": 52,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 0
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 52
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"program": {
|
|
||||||
"type": "Program",
|
|
||||||
"start": 0,
|
|
||||||
"end": 52,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 0
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 52
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"sourceType": "module",
|
|
||||||
"interpreter": null,
|
|
||||||
"body": [
|
|
||||||
{
|
|
||||||
"type": "TSTypeAliasDeclaration",
|
|
||||||
"start": 0,
|
|
||||||
"end": 52,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 0
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 52
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"id": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 5,
|
|
||||||
"end": 6,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 5
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 6
|
|
||||||
},
|
|
||||||
"identifierName": "T"
|
|
||||||
},
|
|
||||||
"name": "T"
|
|
||||||
},
|
|
||||||
"typeParameters": {
|
|
||||||
"type": "TSTypeParameterDeclaration",
|
|
||||||
"start": 6,
|
|
||||||
"end": 40,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 6
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 40
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"params": [
|
|
||||||
{
|
|
||||||
"type": "TSTypeParameter",
|
|
||||||
"start": 7,
|
|
||||||
"end": 39,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 7
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 39
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"name": "U",
|
|
||||||
"constraint": {
|
|
||||||
"type": "TSObjectKeyword",
|
|
||||||
"start": 17,
|
|
||||||
"end": 23,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 17
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 23
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"default": {
|
|
||||||
"type": "TSTypeLiteral",
|
|
||||||
"start": 26,
|
|
||||||
"end": 39,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 26
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 39
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"members": [
|
|
||||||
{
|
|
||||||
"type": "TSPropertySignature",
|
|
||||||
"start": 28,
|
|
||||||
"end": 37,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 28
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 37
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"key": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 28,
|
|
||||||
"end": 29,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 28
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 29
|
|
||||||
},
|
|
||||||
"identifierName": "x"
|
|
||||||
},
|
|
||||||
"name": "x"
|
|
||||||
},
|
|
||||||
"computed": false,
|
|
||||||
"typeAnnotation": {
|
|
||||||
"type": "TSTypeAnnotation",
|
|
||||||
"start": 29,
|
|
||||||
"end": 37,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 29
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 37
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"typeAnnotation": {
|
|
||||||
"type": "TSNumberKeyword",
|
|
||||||
"start": 31,
|
|
||||||
"end": 37,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 31
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 37
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"typeAnnotation": {
|
|
||||||
"type": "TSTypeReference",
|
|
||||||
"start": 43,
|
|
||||||
"end": 51,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 43
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 51
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"typeName": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 43,
|
|
||||||
"end": 48,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 43
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 48
|
|
||||||
},
|
|
||||||
"identifierName": "Array"
|
|
||||||
},
|
|
||||||
"name": "Array"
|
|
||||||
},
|
|
||||||
"typeParameters": {
|
|
||||||
"type": "TSTypeParameterInstantiation",
|
|
||||||
"start": 48,
|
|
||||||
"end": 51,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 48
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 51
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"params": [
|
|
||||||
{
|
|
||||||
"type": "TSTypeReference",
|
|
||||||
"start": 49,
|
|
||||||
"end": 50,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 49
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 50
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"typeName": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start": 49,
|
|
||||||
"end": 50,
|
|
||||||
"loc": {
|
|
||||||
"start": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 49
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 1,
|
|
||||||
"column": 50
|
|
||||||
},
|
|
||||||
"identifierName": "U"
|
|
||||||
},
|
|
||||||
"name": "U"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"directives": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user