fix helpers

pull/1367/head
Rich Harris 7 years ago
parent 32774a821d
commit c0d241d819

@ -42,7 +42,17 @@ export default class Expression {
if (isReference(node, parent)) {
const { name } = flattenReference(node);
if (currentScope && currentScope.has(name) || helpers.has(name) || (name === 'event' && isEventHandler)) return;
if (currentScope.has(name) || (name === 'event' && isEventHandler)) return;
if (compiler.helpers.has(name)) {
let object = node;
while (object.type === 'MemberExpression') object = object.object;
const alias = compiler.templateVars.get(`helpers-${name}`);
if (alias !== name) code.overwrite(object.start, object.end, alias);
return;
}
code.prependRight(node.start, 'ctx.');

Loading…
Cancel
Save