update acorn-to-esprima, add tests for babel/babel-eslint#216
This commit is contained in:
parent
f76be581b3
commit
4249dcd353
@ -414,13 +414,13 @@ exports.parseNoPatch = function (code) {
|
|||||||
ast.tokens.pop();
|
ast.tokens.pop();
|
||||||
|
|
||||||
// convert tokens
|
// convert tokens
|
||||||
ast.tokens = acornToEsprima.toTokens(ast.tokens, tt);
|
ast.tokens = acornToEsprima.toTokens(ast.tokens, tt, code);
|
||||||
|
|
||||||
// add comments
|
// add comments
|
||||||
acornToEsprima.convertComments(ast.comments);
|
acornToEsprima.convertComments(ast.comments);
|
||||||
|
|
||||||
// transform esprima and acorn divergent nodes
|
// transform esprima and acorn divergent nodes
|
||||||
acornToEsprima.toAST(ast, traverse);
|
acornToEsprima.toAST(ast, traverse, code);
|
||||||
|
|
||||||
// ast.program.tokens = ast.tokens;
|
// ast.program.tokens = ast.tokens;
|
||||||
// ast.program.comments = ast.comments;
|
// ast.program.comments = ast.comments;
|
||||||
|
|||||||
@ -330,6 +330,7 @@ describe("acorn-to-esprima", function () {
|
|||||||
].join("\n"));
|
].join("\n"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("babel 6 tests", function () {
|
||||||
it("MethodDefinition", function () {
|
it("MethodDefinition", function () {
|
||||||
parseAndAssertSame([
|
parseAndAssertSame([
|
||||||
"export default class A {",
|
"export default class A {",
|
||||||
@ -402,4 +403,11 @@ describe("acorn-to-esprima", function () {
|
|||||||
it("super outside method", function () {
|
it("super outside method", function () {
|
||||||
parseAndAssertSame("function F() { super(); }");
|
parseAndAssertSame("function F() { super(); }");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("StringLiteral", function () {
|
||||||
|
parseAndAssertSame('');
|
||||||
|
parseAndAssertSame("");
|
||||||
|
parseAndAssertSame("a");
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1296,4 +1296,12 @@ describe("verify", function () {
|
|||||||
[ "1:13 \"x\" was used before it was defined no-use-before-define" ]
|
[ "1:13 \"x\" was used before it was defined no-use-before-define" ]
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("jsx and stringliteral #216", function () {
|
||||||
|
verifyAndAssertMessages(
|
||||||
|
"<div className=''></div>",
|
||||||
|
{},
|
||||||
|
[]
|
||||||
|
)
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user