literal to stringLiteral - fixes T6667

This commit is contained in:
Henry Zhu 2015-11-21 22:25:21 -05:00
parent efa9a1abf2
commit 3a05513e31
4 changed files with 5 additions and 5 deletions

View File

@ -288,7 +288,7 @@ export function valueToNode(value: any): Object {
if (t.isValidIdentifier(key)) {
nodeKey = t.identifier(key);
} else {
nodeKey = t.literal(key);
nodeKey = t.stringLiteral(key);
}
props.push(t.objectProperty(nodeKey, t.valueToNode(value[key])));
}

View File

@ -478,7 +478,7 @@ defineType("ObjectMethod", {
},
key: {
validate(node, key, val) {
let expectedTypes = node.computed ? ["Expression"] : ["Identifier", "Literal"];
let expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral"];
assertNodeType(...expectedTypes)(node, key, val);
}
},
@ -510,7 +510,7 @@ defineType("ObjectProperty", {
},
key: {
validate(node, key, val) {
let expectedTypes = node.computed ? ["Expression"] : ["Identifier", "Literal"];
let expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral"];
assertNodeType(...expectedTypes)(node, key, val);
}
},

View File

@ -254,7 +254,7 @@ defineType("ClassMethod", {
},
key: {
validate(node, key, val) {
let expectedTypes = node.computed ? ["Expression"] : ["Identifier", "Literal"];
let expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral"];
assertNodeType(...expectedTypes)(node, key, val);
}
},

View File

@ -41,7 +41,7 @@ defineType("JSXElement", {
children: {
validate: chain(
assertValueType("array"),
assertEach(assertNodeType("Literal", "JSXExpressionContainer", "JSXElement"))
assertEach(assertNodeType("StringLiteral", "JSXExpressionContainer", "JSXElement"))
)
}
}