diff options
author | Peter Wagenet <peter.wagenet@gmail.com> | 2012-02-08 19:42:39 -0800 |
---|---|---|
committer | Peter Wagenet <peter.wagenet@gmail.com> | 2012-02-08 20:49:49 -0800 |
commit | 2ea95ca08d47bb16ed79e8481c50a1c074dd676e (patch) | |
tree | 3d6000f7df428c34c3ee5b066caac252e25fca10 /lib/handlebars/compiler/compiler.js | |
parent | cb9db98642ef2083e0be1048a0b54ac210c4fcfd (diff) | |
download | handlebars.js-2ea95ca08d47bb16ed79e8481c50a1c074dd676e.zip handlebars.js-2ea95ca08d47bb16ed79e8481c50a1c074dd676e.tar.gz handlebars.js-2ea95ca08d47bb16ed79e8481c50a1c074dd676e.tar.bz2 |
Fixed whitespace and semi-colons
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r-- | lib/handlebars/compiler/compiler.js | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index a630200..336b60d 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -316,13 +316,13 @@ Handlebars.JavaScriptCompiler = function() {}; // PUBLIC API: You can override these methods in a subclass to provide // alternative compiled forms for name lookup and buffering semantics nameLookup: function(parent, name, type) { - if (/^[0-9]+$/.test(name)) { + if (/^[0-9]+$/.test(name)) { return parent + "[" + name + "]"; } else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { - return parent + "." + name; - } - else { - return parent + "['" + name + "']"; + return parent + "." + name; + } + else { + return parent + "['" + name + "']"; } }, @@ -447,7 +447,7 @@ Handlebars.JavaScriptCompiler = function() {}; // Generate minimizer alias mappings if (!this.isChild) { - var aliases = [] + var aliases = []; for (var alias in this.context.aliases) { this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias]; } @@ -540,7 +540,7 @@ Handlebars.JavaScriptCompiler = function() {}; lookup: function(name) { var topStack = this.topStack(); this.source.push(topStack + " = (" + topStack + " === null || " + topStack + " === undefined || " + topStack + " === false ? " + - topStack + " : " + this.nameLookup(topStack, name, 'context') + ");"); + topStack + " : " + this.nameLookup(topStack, name, 'context') + ");"); }, pushStringParam: function(string) { @@ -635,7 +635,7 @@ Handlebars.JavaScriptCompiler = function() {}; this.source.push(nextStack + " = " + id + ".call(" + paramString + ");"); } else { this.context.aliases.functionType = '"function"'; - var condition = program ? "foundHelper && " : "" + var condition = program ? "foundHelper && " : ""; this.source.push("if(" + condition + "typeof " + id + " === functionType) { " + nextStack + " = " + id + ".call(" + paramString + "); }"); } fn.call(this, nextStack, helperMissingString, id); @@ -764,12 +764,12 @@ Handlebars.JavaScriptCompiler = function() {}; compilerWords[reservedWords[i]] = true; } - JavaScriptCompiler.isValidJavaScriptVariableName = function(name) { - if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)) { - return true; - } - return false; - } + JavaScriptCompiler.isValidJavaScriptVariableName = function(name) { + if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)) { + return true; + } + return false; + }; })(Handlebars.Compiler, Handlebars.JavaScriptCompiler); |