Marko v3: var name from attr value should be the actual string value

This commit is contained in:
Patrick Steele-Idem 2016-02-11 14:58:07 -07:00
parent 14350fcab4
commit 98b52a3342

View File

@ -32,6 +32,14 @@ function getNestedVariables(elNode, tagDef, codegen) {
}
varName = elNode.getAttributeValue(attrName);
if (varName) {
if (varName.type !== 'Literal' || typeof varName.value !== 'string') {
codegen.addError('The value of the ' + attrName + ' is expected to be a string');
codegen.addError('Attribute ' + possibleNameAttributes.join(' or ') + ' is required');
varName = '_var'; // Let it continue with errors
}
varName = varName.value;
if (!keep) {
elNode.removeAttribute(attrName);
}