Comparing version 0.11.1-2 to 0.11.1-3
@@ -238,2 +238,3 @@ // Acorn: Loose parser | ||
node.loc = new SourceLocation(pos[1]); | ||
pos = pos[0]; | ||
} else { | ||
@@ -245,3 +246,3 @@ node = new Node(pos); | ||
if (options.ranges) | ||
node.range = [pos[0], 0]; | ||
node.range = [pos, 0]; | ||
return node; | ||
@@ -370,3 +371,3 @@ } | ||
if (token.type === tt._in || isContextual("of")) { | ||
return parseForIn(node, checkLVal(init)); | ||
return parseForIn(node, toAssignable(init)); | ||
} | ||
@@ -438,3 +439,3 @@ return parseFor(node, init); | ||
expect(tt.parenL); | ||
clause.param = parseIdent(); | ||
clause.param = toAssignable(parseExprAtom()); | ||
expect(tt.parenR); | ||
@@ -852,2 +853,3 @@ clause.guard = null; | ||
else if (isStatement) node.id = dummyIdent(); | ||
else node.id = null; | ||
node.superClass = eat(tt._extends) ? parseExpression() : null; | ||
@@ -865,3 +867,3 @@ node.body = startNode(); | ||
if (isClass && semicolon()) continue; | ||
var prop = startNode(), isGenerator; | ||
var prop = startNode(), isGenerator, start; | ||
if (options.ecmaVersion >= 6) { | ||
@@ -871,2 +873,3 @@ if (isClass) { | ||
} else { | ||
start = storeCurrentPos(); | ||
prop.method = false; | ||
@@ -911,3 +914,15 @@ prop.shorthand = false; | ||
prop.kind = "init"; | ||
prop.value = options.ecmaVersion >= 6 ? prop.key : dummyIdent(); | ||
if (options.ecmaVersion >= 6) { | ||
if (eat(tt.eq)) { | ||
var assign = startNodeAt(start); | ||
assign.operator = "="; | ||
assign.left = prop.key; | ||
assign.right = parseMaybeAssign(); | ||
prop.value = finishNode(assign, "AssignmentExpression"); | ||
} else { | ||
prop.value = prop.key; | ||
} | ||
} else { | ||
prop.value = dummyIdent(); | ||
} | ||
prop.shorthand = true; | ||
@@ -1055,3 +1070,10 @@ } | ||
if (node['default']) { | ||
node.declaration = parseExpression(); | ||
var expr = parseMaybeAssign(); | ||
if (expr.id) { | ||
switch (expr.type) { | ||
case "FunctionExpression": expr.type = "FunctionDeclaration"; break; | ||
case "ClassExpression": expr.type = "ClassDeclaration"; break; | ||
} | ||
} | ||
node.declaration = expr; | ||
semicolon(); | ||
@@ -1058,0 +1080,0 @@ } else if (token.type.keyword) { |
@@ -6,3 +6,3 @@ { | ||
"main": "acorn.js", | ||
"version": "0.11.1-2", | ||
"version": "0.11.1-3", | ||
"engines": {"node": ">=0.4.0"}, | ||
@@ -9,0 +9,0 @@ "maintainers": [{"name": "Ingvar Stepanyan", |
8
x.js
@@ -5,3 +5,6 @@ var parse = require('./').parse; | ||
var tests = [ | ||
"<div pre=\"leading\" {...props} />" | ||
"export default function () {}", | ||
"export default function f() {}", | ||
"export default class {}", | ||
"export default class A {}" | ||
]; | ||
@@ -22,4 +25,3 @@ | ||
ecmaVersion: 6, | ||
ranges: true, | ||
loose: false | ||
ranges: true | ||
}; | ||
@@ -26,0 +28,0 @@ try { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2790324
34
94132