diff options
Diffstat (limited to 'lib/handlebars/compiler/javascript-compiler.js')
-rw-r--r-- | lib/handlebars/compiler/javascript-compiler.js | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js index 0bb1816..d3bd258 100644 --- a/lib/handlebars/compiler/javascript-compiler.js +++ b/lib/handlebars/compiler/javascript-compiler.js @@ -1,18 +1,10 @@ -var compilerbase = require("./base"); +import { COMPILER_REVISION, REVISION_CHANGES } from "../base"; -exports.attach = function(Handlebars) { - -compilerbase.attach(Handlebars); - -// BEGIN(BROWSER) -/*jshint eqnull:true*/ - -var Literal = function(value) { +function Literal(value) { this.value = value; }; - -var JavaScriptCompiler = Handlebars.JavaScriptCompiler = function() {}; +export function JavaScriptCompiler() {}; JavaScriptCompiler.prototype = { // PUBLIC API: You can override these methods in a subclass to provide @@ -51,7 +43,9 @@ JavaScriptCompiler.prototype = { this.environment = environment; this.options = options || {}; - Handlebars.log(Handlebars.logger.DEBUG, this.environment.disassemble() + "\n\n"); + // TODO: a module-compatible logger + // Handlebars.log(Handlebars.logger.DEBUG, this.environment.disassemble() + "\n\n"); + log(this.environment.disassemble() + "\n\n"); this.name = this.environment.name; this.isChild = !!context; @@ -162,8 +156,8 @@ JavaScriptCompiler.prototype = { var source = this.mergeSource(); if (!this.isChild) { - var revision = Handlebars.COMPILER_REVISION, - versions = Handlebars.REVISION_CHANGES[revision]; + var revision = COMPILER_REVISION, + versions = REVISION_CHANGES[revision]; source = "this.compilerInfo = ["+revision+",'"+versions+"'];\n"+source; } @@ -173,7 +167,11 @@ JavaScriptCompiler.prototype = { return Function.apply(this, params); } else { var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\n ' + source + '}'; - Handlebars.log(Handlebars.logger.DEBUG, functionSource + "\n\n"); + + // TODO: a module-compatible logger + //Handlebars.log(Handlebars.logger.DEBUG, functionSource + "\n\n"); + log(functionSource + "\n\n"); + return functionSource; } }, @@ -849,8 +847,6 @@ JavaScriptCompiler.isValidJavaScriptVariableName = function(name) { return false; }; -// END(BROWSER) - -return Handlebars; - -}; +function log(string) { + //console.log(string); +} |