Fixed whitespace and semi-colons

This commit is contained in:
Peter Wagenet
2012-02-08 19:42:39 -08:00
parent cb9db98642
commit 2ea95ca08d
3 changed files with 52 additions and 52 deletions
+14 -14
View File
@@ -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);