Skip to content

Commit

Permalink
Rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
kpdecker committed Jun 4, 2013
1 parent c3ff573 commit 0f278e1
Showing 1 changed file with 51 additions and 49 deletions.
100 changes: 51 additions & 49 deletions dist/handlebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,13 +714,10 @@ Handlebars.AST.PartialNode = function(partialName, context) {
};

Handlebars.AST.BlockNode = function(mustache, program, inverse, close) {
var verifyMatch = function(open, close) {
if(open.original !== close.original) {
throw new Handlebars.Exception(open.original + " doesn't match " + close.original);
}
};
if(mustache.id.original !== close.original) {
throw new Handlebars.Exception(mustache.id.original + " doesn't match " + close.original);
}

verifyMatch(mustache.id, close);
this.type = "block";
this.mustache = mustache;
this.program = program;
Expand Down Expand Up @@ -886,7 +883,6 @@ Handlebars.Utils = {

/*jshint eqnull:true*/
var Compiler = Handlebars.Compiler = function() {};
var JavaScriptCompiler = Handlebars.JavaScriptCompiler = function() {};

// the foundHelper register will disambiguate helper lookup from finding a
// function in a context. This is necessary for mustache compatibility, which
Expand Down Expand Up @@ -1294,10 +1290,57 @@ Compiler.prototype = {
}
};

Handlebars.precompile = function(input, options) {
if (input == null || (typeof input !== 'string' && input.constructor !== Handlebars.AST.ProgramNode)) {
throw new Handlebars.Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input);
}

options = options || {};
if (!('data' in options)) {
options.data = true;
}
var ast = Handlebars.parse(input);
var environment = new Compiler().compile(ast, options);
return new Handlebars.JavaScriptCompiler().compile(environment, options);
};

Handlebars.compile = function(input, options) {
if (input == null || (typeof input !== 'string' && input.constructor !== Handlebars.AST.ProgramNode)) {
throw new Handlebars.Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input);
}

options = options || {};
if (!('data' in options)) {
options.data = true;
}
var compiled;
function compile() {
var ast = Handlebars.parse(input);
var environment = new Compiler().compile(ast, options);
var templateSpec = new Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);
return Handlebars.template(templateSpec);
}

// Template is only compiled on first use and cached after that point.
return function(context, options) {
if (!compiled) {
compiled = compile();
}
return compiled.call(this, context, options);
};
};

;
// lib/handlebars/compiler/javascript-compiler.js
/*jshint eqnull:true*/

var Literal = function(value) {
this.value = value;
};


var JavaScriptCompiler = Handlebars.JavaScriptCompiler = function() {};

JavaScriptCompiler.prototype = {
// PUBLIC API: You can override these methods in a subclass to provide
// alternative compiled forms for name lookup and buffering semantics
Expand Down Expand Up @@ -1359,7 +1402,7 @@ JavaScriptCompiler.prototype = {

this.i = 0;

for(l=opcodes.length; this.i<l; this.i++) {
for(var l=opcodes.length; this.i<l; this.i++) {
opcode = opcodes[this.i];

if(opcode.opcode === 'DECLARE') {
Expand Down Expand Up @@ -2132,47 +2175,6 @@ JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
}
return false;
};

Handlebars.precompile = function(input, options) {
if (input == null || (typeof input !== 'string' && input.constructor !== Handlebars.AST.ProgramNode)) {
throw new Handlebars.Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input);
}

options = options || {};
if (!('data' in options)) {
options.data = true;
}
var ast = Handlebars.parse(input);
var environment = new Compiler().compile(ast, options);
return new JavaScriptCompiler().compile(environment, options);
};

Handlebars.compile = function(input, options) {
if (input == null || (typeof input !== 'string' && input.constructor !== Handlebars.AST.ProgramNode)) {
throw new Handlebars.Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input);
}

options = options || {};
if (!('data' in options)) {
options.data = true;
}
var compiled;
function compile() {
var ast = Handlebars.parse(input);
var environment = new Compiler().compile(ast, options);
var templateSpec = new JavaScriptCompiler().compile(environment, options, undefined, true);
return Handlebars.template(templateSpec);
}

// Template is only compiled on first use and cached after that point.
return function(context, options) {
if (!compiled) {
compiled = compile();
}
return compiled.call(this, context, options);
};
};

;
// lib/handlebars/runtime.js

Expand Down

0 comments on commit 0f278e1

Please sign in to comment.