Merge branch 'master' into 7.0
This commit is contained in:
commit
7bf553a575
@ -18,11 +18,7 @@ pp.estreeParseRegExpLiteral = function ({ pattern, flags }) {
|
||||
};
|
||||
|
||||
pp.estreeParseLiteral = function (value) {
|
||||
const node = this.parseLiteral(value, "Literal");
|
||||
node.raw = node.extra.raw;
|
||||
delete node.extra;
|
||||
|
||||
return node;
|
||||
return this.parseLiteral(value, "Literal");
|
||||
};
|
||||
|
||||
pp.directiveToStmt = function (directive) {
|
||||
@ -177,6 +173,16 @@ export default function (instance) {
|
||||
};
|
||||
});
|
||||
|
||||
instance.extend("parseLiteral", function(inner) {
|
||||
return function (...args) {
|
||||
const node = inner.call(this, ...args);
|
||||
node.raw = node.extra.raw;
|
||||
delete node.extra;
|
||||
|
||||
return node;
|
||||
};
|
||||
});
|
||||
|
||||
instance.extend("parseMethod", function(inner) {
|
||||
return function (node, ...args) {
|
||||
let funcNode = this.startNode();
|
||||
|
||||
1
test/fixtures/estree/flow/string-literal-annotation/actual.js
vendored
Normal file
1
test/fixtures/estree/flow/string-literal-annotation/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
var x: "string";
|
||||
116
test/fixtures/estree/flow/string-literal-annotation/expected.json
vendored
Normal file
116
test/fixtures/estree/flow/string-literal-annotation/expected.json
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 4,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 4,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
},
|
||||
"identifierName": "x"
|
||||
},
|
||||
"name": "x",
|
||||
"typeAnnotation": {
|
||||
"type": "TypeAnnotation",
|
||||
"start": 5,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"typeAnnotation": {
|
||||
"type": "StringLiteralTypeAnnotation",
|
||||
"start": 7,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"value": "string",
|
||||
"raw": "\"string\""
|
||||
}
|
||||
}
|
||||
},
|
||||
"init": null
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user