Fix space not being skipped after object literal inside expression container.
Fixes #7.
This commit is contained in:
parent
f3f49cee80
commit
7a3683de2b
9
acorn.js
9
acorn.js
@ -2549,6 +2549,8 @@
|
||||
function parseObj() {
|
||||
var node = startNode(), first = true, propHash = {};
|
||||
node.properties = [];
|
||||
var origInXJSChildExpression = inXJSChildExpression;
|
||||
inXJSChildExpression = false;
|
||||
next();
|
||||
while (!eat(_braceR)) {
|
||||
if (!first) {
|
||||
@ -2584,9 +2586,10 @@
|
||||
|
||||
checkPropClash(prop, propHash);
|
||||
node.properties.push(finishNode(prop, "Property"));
|
||||
}
|
||||
}
|
||||
inXJSChildExpression = origInXJSChildExpression;
|
||||
return finishNode(node, "ObjectExpression");
|
||||
}
|
||||
}
|
||||
|
||||
function parsePropertyName(prop) {
|
||||
if (options.ecmaVersion >= 6) {
|
||||
@ -3158,7 +3161,7 @@
|
||||
inXJSTag = origInXJSTag;
|
||||
inXJSChild = origInXJSChild;
|
||||
inXJSChildExpression = false;
|
||||
|
||||
|
||||
expect(_braceR);
|
||||
return finishNode(node, "XJSExpressionContainer");
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "acorn-jsx",
|
||||
"description": "Alternative React JSX parser",
|
||||
"main": "acorn.js",
|
||||
"version": "0.9.1-4",
|
||||
"version": "0.9.1-5",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Marijn Haverbeke",
|
||||
|
||||
@ -3375,6 +3375,72 @@ var fbTestFixture = {
|
||||
}
|
||||
}]
|
||||
}
|
||||
},
|
||||
|
||||
'<div>{ {a} }</div>': {
|
||||
type: "ExpressionStatement",
|
||||
start: 0,
|
||||
end: 18,
|
||||
expression: {
|
||||
type: "XJSElement",
|
||||
start: 0,
|
||||
end: 18,
|
||||
openingElement: {
|
||||
type: "XJSOpeningElement",
|
||||
start: 0,
|
||||
end: 5,
|
||||
attributes: [],
|
||||
name: {
|
||||
type: "XJSIdentifier",
|
||||
start: 1,
|
||||
end: 4,
|
||||
name: "div"
|
||||
},
|
||||
selfClosing: false
|
||||
},
|
||||
closingElement: {
|
||||
type: "XJSClosingElement",
|
||||
start: 12,
|
||||
end: 18,
|
||||
name: {
|
||||
type: "XJSIdentifier",
|
||||
start: 14,
|
||||
end: 17,
|
||||
name: "div"
|
||||
}
|
||||
},
|
||||
children: [{
|
||||
type: "XJSExpressionContainer",
|
||||
start: 5,
|
||||
end: 12,
|
||||
expression: {
|
||||
type: "ObjectExpression",
|
||||
start: 7,
|
||||
end: 10,
|
||||
properties: [{
|
||||
type: "Property",
|
||||
start: 8,
|
||||
end: 9,
|
||||
method: false,
|
||||
shorthand: true,
|
||||
computed: false,
|
||||
key: {
|
||||
type: "Identifier",
|
||||
start: 8,
|
||||
end: 9,
|
||||
name: "a"
|
||||
},
|
||||
kind: "init",
|
||||
value: {
|
||||
type: "Identifier",
|
||||
start: 8,
|
||||
end: 9,
|
||||
name: "a"
|
||||
}
|
||||
}]
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user