diff options
author | kpdecker <kpdecker@gmail.com> | 2014-01-17 19:14:36 -0600 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2014-01-17 23:15:17 -0600 |
commit | ace2896ec876104f5bd220744124e7370fe6b9a2 (patch) | |
tree | 93fd30d6e64324e6914fb212310cfdedc3a6d260 /lib/handlebars/compiler/compiler.js | |
parent | 9df919083d4e25512fb6dc6fe1a050e63ad12c80 (diff) | |
download | handlebars.js-ace2896ec876104f5bd220744124e7370fe6b9a2.zip handlebars.js-ace2896ec876104f5bd220744124e7370fe6b9a2.tar.gz handlebars.js-ace2896ec876104f5bd220744124e7370fe6b9a2.tar.bz2 |
Add trackIds compiler flag
Allows helpers that care about where a particular field came from derive this data while maintaining backward compatibility with existing helpers.
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r-- | lib/handlebars/compiler/compiler.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 3f7aa3b..cfcc70a 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -74,6 +74,7 @@ Compiler.prototype = { this.depths = {list: []}; this.options = options; this.stringParams = options.stringParams; + this.trackIds = options.trackIds; // These changes will propagate to the other compiler components var knownHelpers = this.options.knownHelpers; @@ -395,6 +396,9 @@ Compiler.prototype = { this.sexpr(val); } } else { + if (this.trackIds) { + this.opcode('pushId', val.type, val.idName || val.stringModeValue); + } this.accept(val); } }, |