Merge branch 'master' into visitor-update
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import Exception from "../exception";
|
||||
import {isArray} from "../utils";
|
||||
import {isArray, indexOf} from "../utils";
|
||||
import AST from "./ast";
|
||||
|
||||
var slice = [].slice;
|
||||
@@ -400,7 +400,7 @@ Compiler.prototype = {
|
||||
blockParamIndex: function(name) {
|
||||
for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) {
|
||||
var blockParams = this.options.blockParams[depth],
|
||||
param = blockParams && blockParams.indexOf(name);
|
||||
param = blockParams && indexOf(blockParams, name);
|
||||
if (blockParams && param >= 0) {
|
||||
return [depth, param];
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ JavaScriptCompiler.prototype = {
|
||||
if (bufferStart) {
|
||||
bufferStart.prepend('return ');
|
||||
bufferEnd.add(';');
|
||||
} else {
|
||||
} else if (!sourceSeen) {
|
||||
this.source.push('return "";');
|
||||
}
|
||||
} else {
|
||||
@@ -263,7 +263,7 @@ JavaScriptCompiler.prototype = {
|
||||
}
|
||||
|
||||
if (varDeclarations) {
|
||||
this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n '));
|
||||
this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n'));
|
||||
}
|
||||
|
||||
return this.source.merge();
|
||||
|
||||
@@ -48,6 +48,16 @@ export var isArray = Array.isArray || function(value) {
|
||||
return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false;
|
||||
};
|
||||
|
||||
// Older IE versions do not directly support indexOf so we must implement our own, sadly.
|
||||
export function indexOf(array, value) {
|
||||
for (var i = 0, len = array.length; i < len; i++) {
|
||||
if (array[i] === value) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
export function escapeExpression(string) {
|
||||
// don't escape SafeStrings, since they're already safe
|
||||
|
||||
+13
-13
@@ -21,37 +21,37 @@
|
||||
"node": ">=0.4.7"
|
||||
},
|
||||
"dependencies": {
|
||||
"optimist": "~0.3",
|
||||
"optimist": "^0.6.1",
|
||||
"source-map": "^0.1.40"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"uglify-js": "~2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"async": "~0.2.9",
|
||||
"async": "^0.9.0",
|
||||
"aws-sdk": "~1.5.0",
|
||||
"benchmark": "~1.0",
|
||||
"dustjs-linkedin": "~2.0.2",
|
||||
"dustjs-linkedin": "^2.0.2",
|
||||
"eco": "~1.1.0-rc-3",
|
||||
"es6-module-packager": "^2.0.0",
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-cli": "~0.1.10",
|
||||
"grunt-contrib-clean": "~0.4.1",
|
||||
"grunt-contrib-concat": "~0.3.0",
|
||||
"grunt-contrib-connect": "~0.5.0",
|
||||
"grunt-contrib-copy": "~0.4.1",
|
||||
"grunt-contrib-clean": "0.x",
|
||||
"grunt-contrib-concat": "0.x",
|
||||
"grunt-contrib-connect": "0.x",
|
||||
"grunt-contrib-copy": "0.x",
|
||||
"grunt-contrib-jshint": "0.x",
|
||||
"grunt-contrib-requirejs": "~0.4.1",
|
||||
"grunt-contrib-uglify": "~0.2.2",
|
||||
"grunt-contrib-watch": "~0.5.3",
|
||||
"grunt-contrib-requirejs": "0.x",
|
||||
"grunt-contrib-uglify": "0.x",
|
||||
"grunt-contrib-watch": "0.x",
|
||||
"grunt-saucelabs": "8.x",
|
||||
"istanbul": "^0.3.0",
|
||||
"jison": "~0.3.0",
|
||||
"keen.io": "0.0.3",
|
||||
"mocha": "~1.20.0",
|
||||
"mustache": "~0.7.2",
|
||||
"semver": "~2.1.0",
|
||||
"underscore": "~1.5.1"
|
||||
"mustache": "0.x",
|
||||
"semver": "^4.0.0",
|
||||
"underscore": "^1.5.1"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"bin": {
|
||||
|
||||
+7
-3
@@ -1,9 +1,13 @@
|
||||
/*global CompilerContext, Handlebars */
|
||||
var SourceMap = require('source-map'),
|
||||
SourceMapConsumer = SourceMap.SourceMapConsumer;
|
||||
try {
|
||||
var SourceMap = require('source-map'),
|
||||
SourceMapConsumer = SourceMap.SourceMapConsumer;
|
||||
} catch (err) {
|
||||
/* NOP for in browser */
|
||||
}
|
||||
|
||||
describe('source-map', function() {
|
||||
if (!Handlebars.precompile) {
|
||||
if (!Handlebars.precompile || !SourceMap) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user