Comparing version 0.10.0 to 0.11.0
@@ -257,2 +257,10 @@ // Acorn: Loose parser | ||
function finishNodeAt(node, type, pos) { | ||
if (options.locations) { node.loc.end = pos[1]; pos = pos[0]; } | ||
node.type = type; | ||
node.end = pos; | ||
if (options.ranges) node.range[1] = pos; | ||
return node; | ||
} | ||
function dummyIdent() { | ||
@@ -805,7 +813,9 @@ var dummy = startNode(); | ||
function parseTemplateElement() { | ||
var elem = startNode(); | ||
var elem = startNodeAt(options.locations ? [token.start + 1, token.startLoc.offset(1)] : token.start + 1); | ||
elem.value = token.value; | ||
elem.tail = input.charCodeAt(token.end - 1) !== 123; // '{' | ||
var endOff = elem.tail ? 1 : 2; | ||
var endPos = options.locations ? [token.end - endOff, token.endLoc.offset(-endOff)] : token.end - endOff; | ||
next(); | ||
return finishNode(elem, "TemplateElement"); | ||
return finishNodeAt(elem, "TemplateElement", endPos); | ||
} | ||
@@ -900,3 +910,8 @@ | ||
popCx(); | ||
eat(tt.braceR); | ||
if (!eat(tt.braceR)) { | ||
// If there is no closing brace, make the node span to the start | ||
// of the next token (this is useful for Tern) | ||
lastEnd = token.start; | ||
if (options.locations) lastEndLoc = token.startLoc; | ||
} | ||
if (isClass) { | ||
@@ -1131,6 +1146,5 @@ semicolon(); | ||
function parseExprList(close, allowEmpty) { | ||
var indent = curIndent, line = curLineStart, elts = [], continuedLine = nextLineStart; | ||
var indent = curIndent, line = curLineStart, elts = []; | ||
next(); // Opening bracket | ||
if (curLineStart > continuedLine) continuedLine = curLineStart; | ||
while (!closes(close, indent + (curLineStart <= continuedLine ? 1 : 0), line)) { | ||
while (!closes(close, indent + 1, line)) { | ||
if (eat(tt.comma)) { | ||
@@ -1150,5 +1164,10 @@ elts.push(allowEmpty ? null : dummyIdent()); | ||
popCx(); | ||
eat(close); | ||
if (!eat(close)) { | ||
// If there is no closing brace, make the node span to the start | ||
// of the next token (this is useful for Tern) | ||
lastEnd = token.start; | ||
if (options.locations) lastEndLoc = token.startLoc; | ||
} | ||
return elts; | ||
} | ||
}); |
@@ -6,3 +6,3 @@ { | ||
"main": "acorn.js", | ||
"version": "0.10.0", | ||
"version": "0.11.0", | ||
"engines": {"node": ">=0.4.0"}, | ||
@@ -9,0 +9,0 @@ "maintainers": [{"name": "Marijn Haverbeke", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
2751816
91281