diff --git a/examples/data-structure/index.vm b/examples/data-structure/index.vm index 7205f96..3ca2421 100644 --- a/examples/data-structure/index.vm +++ b/examples/data-structure/index.vm @@ -6,6 +6,8 @@ $user.favorites[$favIdx] $order.orderId +#undfinedMacro() + #set($temp = 1) #set($addr = $order.addr) $addr.zipCode diff --git a/lib/data/data-direc.js b/lib/data/data-direc.js index d9f9367..b99c1fa 100644 --- a/lib/data/data-direc.js +++ b/lib/data/data-direc.js @@ -167,12 +167,13 @@ module.exports = { var definition = this.template.__macro[name] || this.macro[name] if (!definition) { - this.throwError('Call undefined macro.', node.pos) + logger.warn('Call undefined macro <', name, '>') + return } - var definitionTempl = name in this.template.__macro ? this.template : definition.__template - if (!definition.body) return + var definitionTempl = name in this.template.__macro ? this.template : definition.__template + var ctx = {} var args = node.arguments var argsLen = args.length