parent
7a3683de2b
commit
879d40989a
21
acorn.js
21
acorn.js
@ -296,7 +296,7 @@
|
||||
// `strict` indicates whether strict mode is on.
|
||||
|
||||
var inFunction, inGenerator, labels, strict,
|
||||
inXJSChild, inXJSTag, inXJSChildExpression;
|
||||
inXJSChild, inXJSTag;
|
||||
|
||||
// This counter is used for checking that arrow expressions did
|
||||
// not contain nested parentheses in argument list.
|
||||
@ -618,9 +618,7 @@
|
||||
tokEnd = tokPos;
|
||||
if (options.locations) tokEndLoc = new Position;
|
||||
tokType = type;
|
||||
if (shouldSkipSpace !== false && !(inXJSChild && tokType !== _braceL)) {
|
||||
skipSpace();
|
||||
}
|
||||
if (shouldSkipSpace !== false) skipSpace();
|
||||
tokVal = val;
|
||||
tokRegexpAllowed = type.beforeExpr;
|
||||
if (options.onToken) {
|
||||
@ -846,7 +844,7 @@
|
||||
case 91: ++tokPos; return finishToken(_bracketL);
|
||||
case 93: ++tokPos; return finishToken(_bracketR);
|
||||
case 123: ++tokPos; return finishToken(_braceL);
|
||||
case 125: ++tokPos; return finishToken(_braceR, undefined, !inXJSChildExpression);
|
||||
case 125: ++tokPos; return finishToken(_braceR, undefined, !inXJSChild);
|
||||
case 58: ++tokPos; return finishToken(_colon);
|
||||
case 63: ++tokPos; return finishToken(_question);
|
||||
|
||||
@ -2549,8 +2547,6 @@
|
||||
function parseObj() {
|
||||
var node = startNode(), first = true, propHash = {};
|
||||
node.properties = [];
|
||||
var origInXJSChildExpression = inXJSChildExpression;
|
||||
inXJSChildExpression = false;
|
||||
next();
|
||||
while (!eat(_braceR)) {
|
||||
if (!first) {
|
||||
@ -2587,7 +2583,6 @@
|
||||
checkPropClash(prop, propHash);
|
||||
node.properties.push(finishNode(prop, "Property"));
|
||||
}
|
||||
inXJSChildExpression = origInXJSChildExpression;
|
||||
return finishNode(node, "ObjectExpression");
|
||||
}
|
||||
|
||||
@ -3153,15 +3148,16 @@
|
||||
|
||||
inXJSTag = false;
|
||||
inXJSChild = false;
|
||||
inXJSChildExpression = origInXJSChild;
|
||||
|
||||
next();
|
||||
node.expression = tokType === _braceR ? parseXJSEmptyExpression() : parseExpression();
|
||||
|
||||
inXJSTag = origInXJSTag;
|
||||
inXJSChild = origInXJSChild;
|
||||
inXJSChildExpression = false;
|
||||
|
||||
if (inXJSChild) {
|
||||
tokPos = tokEnd;
|
||||
}
|
||||
expect(_braceR);
|
||||
return finishNode(node, "XJSExpressionContainer");
|
||||
}
|
||||
@ -3172,14 +3168,13 @@
|
||||
if (tokType === _braceL) {
|
||||
var tokStart1 = tokStart, tokStartLoc1 = tokStartLoc;
|
||||
|
||||
var origInXJSTag = inXJSTag, origInXJSChildExpression = inXJSChildExpression;
|
||||
inXJSTag = inXJSChildExpression = false;
|
||||
var origInXJSTag = inXJSTag;
|
||||
inXJSTag = false;
|
||||
|
||||
next();
|
||||
if (tokType !== _ellipsis) unexpected();
|
||||
var node = parseMaybeUnary();
|
||||
|
||||
inXJSChildExpression = origInXJSChildExpression;
|
||||
inXJSTag = origInXJSTag;
|
||||
|
||||
expect(_braceR);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "acorn-jsx",
|
||||
"description": "Alternative React JSX parser",
|
||||
"main": "acorn.js",
|
||||
"version": "0.9.1-5",
|
||||
"version": "0.9.1-6",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Marijn Haverbeke",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user