diff options
author | Ryan Lewis <ryanharrisonlewis@gmail.com> | 2015-12-13 20:42:13 -0800 |
---|---|---|
committer | Ryan Lewis <ryanharrisonlewis@gmail.com> | 2015-12-13 20:42:13 -0800 |
commit | 21bf95c92a1c04fd8a31742c1ea21ccb2d195c9c (patch) | |
tree | a120f52441e2f62ecb61696a4f67fdc1c15273b4 /lib/handlebars/compiler/compiler.js | |
parent | cc0b239aafefdef0342334b90f3c9b3ac6b19cea (diff) | |
parent | a6121cae797161f74bdd5a25e0c56379992557d7 (diff) | |
download | handlebars.js-21bf95c92a1c04fd8a31742c1ea21ccb2d195c9c.zip handlebars.js-21bf95c92a1c04fd8a31742c1ea21ccb2d195c9c.tar.gz handlebars.js-21bf95c92a1c04fd8a31742c1ea21ccb2d195c9c.tar.bz2 |
Merge branch 'master' of https://github.com/ryanmurakami/handlebars.js
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r-- | lib/handlebars/compiler/compiler.js | 61 |
1 files changed, 2 insertions, 59 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 987d0d4..040e99a 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -49,8 +49,6 @@ Compiler.prototype = { this.opcodes = []; this.children = []; this.options = options; - this.stringParams = options.stringParams; - this.trackIds = options.trackIds; options.blockParams = options.blockParams || []; @@ -393,49 +391,7 @@ Compiler.prototype = { }, pushParam: function(val) { - let value = val.value != null ? val.value : val.original || ''; - - if (this.stringParams) { - if (value.replace) { - value = value - .replace(/^(\.?\.\/)*/g, '') - .replace(/\//g, '.'); - } - - if (val.depth) { - this.addDepth(val.depth); - } - this.opcode('getContext', val.depth || 0); - this.opcode('pushStringParam', value, val.type); - - if (val.type === 'SubExpression') { - // SubExpressions get evaluated and passed in - // in string params mode. - this.accept(val); - } - } else { - if (this.trackIds) { - let blockParamIndex; - if (val.parts && !AST.helpers.scopedId(val) && !val.depth) { - blockParamIndex = this.blockParamIndex(val.parts[0]); - } - if (blockParamIndex) { - let blockParamChild = val.parts.slice(1).join('.'); - this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild); - } else { - value = val.original || value; - if (value.replace) { - value = value - .replace(/^this(?:\.|$)/, '') - .replace(/^\.\//, '') - .replace(/^\.$/, ''); - } - - this.opcode('pushId', val.type, value); - } - } - this.accept(val); - } + this.accept(val); }, setupFullMustacheParams: function(sexpr, program, inverse, omitEmpty) { @@ -505,25 +461,12 @@ export function compile(input, options = {}, env) { } // Template is only compiled on first use and cached after that point. - function ret(context, execOptions) { + return function(context, execOptions) { if (!compiled) { compiled = compileInput(); } return compiled.call(this, context, execOptions); - } - ret._setup = function(setupOptions) { - if (!compiled) { - compiled = compileInput(); - } - return compiled._setup(setupOptions); - }; - ret._child = function(i, data, blockParams, depths) { - if (!compiled) { - compiled = compileInput(); - } - return compiled._child(i, data, blockParams, depths); }; - return ret; } function argEquals(a, b) { |