diff options
author | Yehuda Katz <wycats@gmail.com> | 2013-01-16 22:43:25 -0800 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2013-01-16 22:43:25 -0800 |
commit | ccd6a22ea5b89afef77651517b8d0b57e5920ea1 (patch) | |
tree | f1c5860a3177ff9f7c4a045d2958bbd6b00b8a03 /lib/handlebars/compiler/ast.js | |
parent | 5e5f0dce9c352f490f1f1e58fd7d0f76dd006cac (diff) | |
download | handlebars.js-ccd6a22ea5b89afef77651517b8d0b57e5920ea1.zip handlebars.js-ccd6a22ea5b89afef77651517b8d0b57e5920ea1.tar.gz handlebars.js-ccd6a22ea5b89afef77651517b8d0b57e5920ea1.tar.bz2 |
Add support for getting types in string mode
This makes it possible to determine whether an
argument was passed as a string or as a path
when implementing helpers in string mode.
Diffstat (limited to 'lib/handlebars/compiler/ast.js')
-rw-r--r-- | lib/handlebars/compiler/ast.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/handlebars/compiler/ast.js b/lib/handlebars/compiler/ast.js index 459b863..a8a6844 100644 --- a/lib/handlebars/compiler/ast.js +++ b/lib/handlebars/compiler/ast.js @@ -88,6 +88,8 @@ var Handlebars = require('./base'); // an ID is simple if it only has one part, and that part is not // `..` or `this`. this.isSimple = parts.length === 1 && !this.isScoped && depth === 0; + + this.stringModeValue = this.string; }; Handlebars.AST.PartialNameNode = function(name) { @@ -103,16 +105,19 @@ var Handlebars = require('./base'); Handlebars.AST.StringNode = function(string) { this.type = "STRING"; this.string = string; + this.stringModeValue = string; }; Handlebars.AST.IntegerNode = function(integer) { this.type = "INTEGER"; this.integer = integer; + this.stringModeValue = Number(integer); }; Handlebars.AST.BooleanNode = function(bool) { this.type = "BOOLEAN"; this.bool = bool; + this.stringModeValue = Boolean(bool); }; Handlebars.AST.CommentNode = function(comment) { |