Upgrade prettier to v2
Prettier v2 has the following breaking changes: * enforces spaces between `function` and params * enforces trailing commas by default
This commit is contained in:
committed by
Jay Linski
parent
f6ff3bf52b
commit
e534a911f3
@@ -12,25 +12,25 @@ function JavaScriptCompiler() {}
|
||||
JavaScriptCompiler.prototype = {
|
||||
// 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 */) {
|
||||
nameLookup: function (parent, name /*, type */) {
|
||||
return this.internalNameLookup(parent, name);
|
||||
},
|
||||
depthedLookup: function(name) {
|
||||
depthedLookup: function (name) {
|
||||
return [
|
||||
this.aliasable('container.lookup'),
|
||||
'(depths, ',
|
||||
JSON.stringify(name),
|
||||
')'
|
||||
')',
|
||||
];
|
||||
},
|
||||
|
||||
compilerInfo: function() {
|
||||
compilerInfo: function () {
|
||||
const revision = COMPILER_REVISION,
|
||||
versions = REVISION_CHANGES[revision];
|
||||
return [revision, versions];
|
||||
},
|
||||
|
||||
appendToBuffer: function(source, location, explicit) {
|
||||
appendToBuffer: function (source, location, explicit) {
|
||||
// Force a source as this simplifies the merge logic.
|
||||
if (!isArray(source)) {
|
||||
source = [source];
|
||||
@@ -50,18 +50,18 @@ JavaScriptCompiler.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
initializeBuffer: function() {
|
||||
initializeBuffer: function () {
|
||||
return this.quotedString('');
|
||||
},
|
||||
// END PUBLIC API
|
||||
internalNameLookup: function(parent, name) {
|
||||
internalNameLookup: function (parent, name) {
|
||||
this.lookupPropertyFunctionIsUsed = true;
|
||||
return ['lookupProperty(', parent, ',', JSON.stringify(name), ')'];
|
||||
},
|
||||
|
||||
lookupPropertyFunctionIsUsed: false,
|
||||
|
||||
compile: function(environment, options, context, asObject) {
|
||||
compile: function (environment, options, context, asObject) {
|
||||
this.environment = environment;
|
||||
this.options = options;
|
||||
this.precompile = !asObject;
|
||||
@@ -71,7 +71,7 @@ JavaScriptCompiler.prototype = {
|
||||
this.context = context || {
|
||||
decorators: [],
|
||||
programs: [],
|
||||
environments: []
|
||||
environments: [],
|
||||
};
|
||||
|
||||
this.preamble();
|
||||
@@ -123,7 +123,7 @@ JavaScriptCompiler.prototype = {
|
||||
this.decorators.prepend([
|
||||
'var decorators = container.decorators, ',
|
||||
this.lookupPropertyFunctionVarDeclaration(),
|
||||
';\n'
|
||||
';\n',
|
||||
]);
|
||||
this.decorators.push('return fn;');
|
||||
|
||||
@@ -137,7 +137,7 @@ JavaScriptCompiler.prototype = {
|
||||
'data',
|
||||
'blockParams',
|
||||
'depths',
|
||||
this.decorators.merge()
|
||||
this.decorators.merge(),
|
||||
]);
|
||||
} else {
|
||||
this.decorators.prepend(
|
||||
@@ -154,7 +154,7 @@ JavaScriptCompiler.prototype = {
|
||||
if (!this.isChild) {
|
||||
let ret = {
|
||||
compiler: this.compilerInfo(),
|
||||
main: fn
|
||||
main: fn,
|
||||
};
|
||||
|
||||
if (this.decorators) {
|
||||
@@ -211,7 +211,7 @@ JavaScriptCompiler.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
preamble: function() {
|
||||
preamble: function () {
|
||||
// track the last context pushed into place to allow skipping the
|
||||
// getContext opcode when it would be a noop
|
||||
this.lastContext = 0;
|
||||
@@ -219,7 +219,7 @@ JavaScriptCompiler.prototype = {
|
||||
this.decorators = new CodeGen(this.options.srcName);
|
||||
},
|
||||
|
||||
createFunctionContext: function(asObject) {
|
||||
createFunctionContext: function (asObject) {
|
||||
let varDeclarations = '';
|
||||
|
||||
let locals = this.stackVars.concat(this.registers.list);
|
||||
@@ -234,7 +234,7 @@ JavaScriptCompiler.prototype = {
|
||||
// aliases will not be used, but this case is already being run on the client and
|
||||
// we aren't concern about minimizing the template size.
|
||||
let aliasCount = 0;
|
||||
Object.keys(this.aliases).forEach(alias => {
|
||||
Object.keys(this.aliases).forEach((alias) => {
|
||||
let node = this.aliases[alias];
|
||||
if (node.children && node.referenceCount > 1) {
|
||||
varDeclarations += ', alias' + ++aliasCount + '=' + alias;
|
||||
@@ -268,18 +268,18 @@ JavaScriptCompiler.prototype = {
|
||||
params.join(','),
|
||||
') {\n ',
|
||||
source,
|
||||
'}'
|
||||
'}',
|
||||
]);
|
||||
}
|
||||
},
|
||||
mergeSource: function(varDeclarations) {
|
||||
mergeSource: function (varDeclarations) {
|
||||
let isSimple = this.environment.isSimple,
|
||||
appendOnly = !this.forceBuffer,
|
||||
appendFirst,
|
||||
sourceSeen,
|
||||
bufferStart,
|
||||
bufferEnd;
|
||||
this.source.each(line => {
|
||||
this.source.each((line) => {
|
||||
if (line.appendToBuffer) {
|
||||
if (bufferStart) {
|
||||
line.prepend(' + ');
|
||||
@@ -333,7 +333,7 @@ JavaScriptCompiler.prototype = {
|
||||
return this.source.merge();
|
||||
},
|
||||
|
||||
lookupPropertyFunctionVarDeclaration: function() {
|
||||
lookupPropertyFunctionVarDeclaration: function () {
|
||||
return `
|
||||
lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
||||
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
||||
@@ -353,7 +353,7 @@ JavaScriptCompiler.prototype = {
|
||||
// `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and
|
||||
// replace it on the stack with the result of properly
|
||||
// invoking blockHelperMissing.
|
||||
blockValue: function(name) {
|
||||
blockValue: function (name) {
|
||||
let blockHelperMissing = this.aliasable(
|
||||
'container.hooks.blockHelperMissing'
|
||||
),
|
||||
@@ -372,7 +372,7 @@ JavaScriptCompiler.prototype = {
|
||||
// Compiler value, before: lastHelper=value of last found helper, if any
|
||||
// On stack, after, if no lastHelper: same as [blockValue]
|
||||
// On stack, after, if lastHelper: value
|
||||
ambiguousBlockValue: function() {
|
||||
ambiguousBlockValue: function () {
|
||||
// We're being a bit cheeky and reusing the options value from the prior exec
|
||||
let blockHelperMissing = this.aliasable(
|
||||
'container.hooks.blockHelperMissing'
|
||||
@@ -392,7 +392,7 @@ JavaScriptCompiler.prototype = {
|
||||
current,
|
||||
' = ',
|
||||
this.source.functionCall(blockHelperMissing, 'call', params),
|
||||
'}'
|
||||
'}',
|
||||
]);
|
||||
},
|
||||
|
||||
@@ -402,7 +402,7 @@ JavaScriptCompiler.prototype = {
|
||||
// On stack, after: ...
|
||||
//
|
||||
// Appends the string value of `content` to the current buffer
|
||||
appendContent: function(content) {
|
||||
appendContent: function (content) {
|
||||
if (this.pendingContent) {
|
||||
content = this.pendingContent + content;
|
||||
} else {
|
||||
@@ -421,9 +421,9 @@ JavaScriptCompiler.prototype = {
|
||||
//
|
||||
// If `value` is truthy, or 0, it is coerced into a string and appended
|
||||
// Otherwise, the empty string is appended
|
||||
append: function() {
|
||||
append: function () {
|
||||
if (this.isInline()) {
|
||||
this.replaceStack(current => [' != null ? ', current, ' : ""']);
|
||||
this.replaceStack((current) => [' != null ? ', current, ' : ""']);
|
||||
|
||||
this.pushSource(this.appendToBuffer(this.popStack()));
|
||||
} else {
|
||||
@@ -433,13 +433,13 @@ JavaScriptCompiler.prototype = {
|
||||
local,
|
||||
' != null) { ',
|
||||
this.appendToBuffer(local, undefined, true),
|
||||
' }'
|
||||
' }',
|
||||
]);
|
||||
if (this.environment.isSimple) {
|
||||
this.pushSource([
|
||||
'else { ',
|
||||
this.appendToBuffer("''", undefined, true),
|
||||
' }'
|
||||
' }',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -451,13 +451,13 @@ JavaScriptCompiler.prototype = {
|
||||
// On stack, after: ...
|
||||
//
|
||||
// Escape `value` and append it to the buffer
|
||||
appendEscaped: function() {
|
||||
appendEscaped: function () {
|
||||
this.pushSource(
|
||||
this.appendToBuffer([
|
||||
this.aliasable('container.escapeExpression'),
|
||||
'(',
|
||||
this.popStack(),
|
||||
')'
|
||||
')',
|
||||
])
|
||||
);
|
||||
},
|
||||
@@ -469,7 +469,7 @@ JavaScriptCompiler.prototype = {
|
||||
// Compiler value, after: lastContext=depth
|
||||
//
|
||||
// Set the value of the `lastContext` compiler value to the depth
|
||||
getContext: function(depth) {
|
||||
getContext: function (depth) {
|
||||
this.lastContext = depth;
|
||||
},
|
||||
|
||||
@@ -479,7 +479,7 @@ JavaScriptCompiler.prototype = {
|
||||
// On stack, after: currentContext, ...
|
||||
//
|
||||
// Pushes the value of the current context onto the stack.
|
||||
pushContext: function() {
|
||||
pushContext: function () {
|
||||
this.pushStackLiteral(this.contextName(this.lastContext));
|
||||
},
|
||||
|
||||
@@ -490,7 +490,7 @@ JavaScriptCompiler.prototype = {
|
||||
//
|
||||
// Looks up the value of `name` on the current context and pushes
|
||||
// it onto the stack.
|
||||
lookupOnContext: function(parts, falsy, strict, scoped) {
|
||||
lookupOnContext: function (parts, falsy, strict, scoped) {
|
||||
let i = 0;
|
||||
|
||||
if (!scoped && this.options.compat && !this.lastContext) {
|
||||
@@ -511,7 +511,7 @@ JavaScriptCompiler.prototype = {
|
||||
//
|
||||
// Looks up the value of `parts` on the given block param and pushes
|
||||
// it onto the stack.
|
||||
lookupBlockParam: function(blockParamId, parts) {
|
||||
lookupBlockParam: function (blockParamId, parts) {
|
||||
this.useBlockParams = true;
|
||||
|
||||
this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']);
|
||||
@@ -524,7 +524,7 @@ JavaScriptCompiler.prototype = {
|
||||
// On stack, after: data, ...
|
||||
//
|
||||
// Push the data lookup operator
|
||||
lookupData: function(depth, parts, strict) {
|
||||
lookupData: function (depth, parts, strict) {
|
||||
if (!depth) {
|
||||
this.pushStackLiteral('data');
|
||||
} else {
|
||||
@@ -534,7 +534,7 @@ JavaScriptCompiler.prototype = {
|
||||
this.resolvePath('data', parts, 0, true, strict);
|
||||
},
|
||||
|
||||
resolvePath: function(type, parts, i, falsy, strict) {
|
||||
resolvePath: function (type, parts, i, falsy, strict) {
|
||||
if (this.options.strict || this.options.assumeObjects) {
|
||||
this.push(
|
||||
strictLookup(this.options.strict && strict, this, parts, i, type)
|
||||
@@ -545,7 +545,7 @@ JavaScriptCompiler.prototype = {
|
||||
let len = parts.length;
|
||||
for (; i < len; i++) {
|
||||
/* eslint-disable no-loop-func */
|
||||
this.replaceStack(current => {
|
||||
this.replaceStack((current) => {
|
||||
let lookup = this.nameLookup(current, parts[i], type);
|
||||
// We want to ensure that zero and false are handled properly if the context (falsy flag)
|
||||
// needs to have the special handling for these values.
|
||||
@@ -567,27 +567,27 @@ JavaScriptCompiler.prototype = {
|
||||
//
|
||||
// If the `value` is a lambda, replace it on the stack by
|
||||
// the return value of the lambda
|
||||
resolvePossibleLambda: function() {
|
||||
resolvePossibleLambda: function () {
|
||||
this.push([
|
||||
this.aliasable('container.lambda'),
|
||||
'(',
|
||||
this.popStack(),
|
||||
', ',
|
||||
this.contextName(0),
|
||||
')'
|
||||
')',
|
||||
]);
|
||||
},
|
||||
|
||||
emptyHash: function(omitEmpty) {
|
||||
emptyHash: function (omitEmpty) {
|
||||
this.pushStackLiteral(omitEmpty ? 'undefined' : '{}');
|
||||
},
|
||||
pushHash: function() {
|
||||
pushHash: function () {
|
||||
if (this.hash) {
|
||||
this.hashes.push(this.hash);
|
||||
}
|
||||
this.hash = { values: {} };
|
||||
},
|
||||
popHash: function() {
|
||||
popHash: function () {
|
||||
let hash = this.hash;
|
||||
this.hash = this.hashes.pop();
|
||||
|
||||
@@ -600,7 +600,7 @@ JavaScriptCompiler.prototype = {
|
||||
// On stack, after: quotedString(string), ...
|
||||
//
|
||||
// Push a quoted version of `string` onto the stack
|
||||
pushString: function(string) {
|
||||
pushString: function (string) {
|
||||
this.pushStackLiteral(this.quotedString(string));
|
||||
},
|
||||
|
||||
@@ -612,7 +612,7 @@ JavaScriptCompiler.prototype = {
|
||||
// Pushes a value onto the stack. This operation prevents
|
||||
// the compiler from creating a temporary variable to hold
|
||||
// it.
|
||||
pushLiteral: function(value) {
|
||||
pushLiteral: function (value) {
|
||||
this.pushStackLiteral(value);
|
||||
},
|
||||
|
||||
@@ -624,7 +624,7 @@ JavaScriptCompiler.prototype = {
|
||||
// Push a program expression onto the stack. This takes
|
||||
// a compile-time guid and converts it into a runtime-accessible
|
||||
// expression.
|
||||
pushProgram: function(guid) {
|
||||
pushProgram: function (guid) {
|
||||
if (guid != null) {
|
||||
this.pushStackLiteral(this.programExpression(guid));
|
||||
} else {
|
||||
@@ -649,9 +649,9 @@ JavaScriptCompiler.prototype = {
|
||||
'fn',
|
||||
'props',
|
||||
'container',
|
||||
options
|
||||
options,
|
||||
]),
|
||||
' || fn;'
|
||||
' || fn;',
|
||||
]);
|
||||
},
|
||||
|
||||
@@ -664,7 +664,7 @@ JavaScriptCompiler.prototype = {
|
||||
// and pushes the helper's return value onto the stack.
|
||||
//
|
||||
// If the helper is not found, `helperMissing` is called.
|
||||
invokeHelper: function(paramSize, name, isSimple) {
|
||||
invokeHelper: function (paramSize, name, isSimple) {
|
||||
let nonHelper = this.popStack(),
|
||||
helper = this.setupHelper(paramSize, name);
|
||||
|
||||
@@ -685,7 +685,7 @@ JavaScriptCompiler.prototype = {
|
||||
let functionLookupCode = [
|
||||
'(',
|
||||
this.itemsSeparatedBy(possibleFunctionCalls, '||'),
|
||||
')'
|
||||
')',
|
||||
];
|
||||
let functionCall = this.source.functionCall(
|
||||
functionLookupCode,
|
||||
@@ -695,7 +695,7 @@ JavaScriptCompiler.prototype = {
|
||||
this.push(functionCall);
|
||||
},
|
||||
|
||||
itemsSeparatedBy: function(items, separator) {
|
||||
itemsSeparatedBy: function (items, separator) {
|
||||
let result = [];
|
||||
result.push(items[0]);
|
||||
for (let i = 1; i < items.length; i++) {
|
||||
@@ -710,7 +710,7 @@ JavaScriptCompiler.prototype = {
|
||||
//
|
||||
// This operation is used when the helper is known to exist,
|
||||
// so a `helperMissing` fallback is not required.
|
||||
invokeKnownHelper: function(paramSize, name) {
|
||||
invokeKnownHelper: function (paramSize, name) {
|
||||
let helper = this.setupHelper(paramSize, name);
|
||||
this.push(this.source.functionCall(helper.name, 'call', helper.callParams));
|
||||
},
|
||||
@@ -727,7 +727,7 @@ JavaScriptCompiler.prototype = {
|
||||
// This operation emits more code than the other options,
|
||||
// and can be avoided by passing the `knownHelpers` and
|
||||
// `knownHelpersOnly` flags at compile-time.
|
||||
invokeAmbiguous: function(name, helperCall) {
|
||||
invokeAmbiguous: function (name, helperCall) {
|
||||
this.useRegister('helper');
|
||||
|
||||
let nonHelper = this.popStack();
|
||||
@@ -759,7 +759,7 @@ JavaScriptCompiler.prototype = {
|
||||
this.aliasable('"function"'),
|
||||
' ? ',
|
||||
this.source.functionCall('helper', 'call', helper.callParams),
|
||||
' : helper))'
|
||||
' : helper))',
|
||||
]);
|
||||
},
|
||||
|
||||
@@ -770,7 +770,7 @@ JavaScriptCompiler.prototype = {
|
||||
//
|
||||
// This operation pops off a context, invokes a partial with that context,
|
||||
// and pushes the result of the invocation back.
|
||||
invokePartial: function(isDynamic, name, indent) {
|
||||
invokePartial: function (isDynamic, name, indent) {
|
||||
let params = [],
|
||||
options = this.setupParams(name, 1, params);
|
||||
|
||||
@@ -807,7 +807,7 @@ JavaScriptCompiler.prototype = {
|
||||
// On stack, after: ..., hash, ...
|
||||
//
|
||||
// Pops a value off the stack and assigns it to the current hash
|
||||
assignToHash: function(key) {
|
||||
assignToHash: function (key) {
|
||||
this.hash.values[key] = this.popStack();
|
||||
},
|
||||
|
||||
@@ -815,7 +815,7 @@ JavaScriptCompiler.prototype = {
|
||||
|
||||
compiler: JavaScriptCompiler,
|
||||
|
||||
compileChildren: function(environment, options) {
|
||||
compileChildren: function (environment, options) {
|
||||
let children = environment.children,
|
||||
child,
|
||||
compiler;
|
||||
@@ -853,7 +853,7 @@ JavaScriptCompiler.prototype = {
|
||||
}
|
||||
}
|
||||
},
|
||||
matchExistingProgram: function(child) {
|
||||
matchExistingProgram: function (child) {
|
||||
for (let i = 0, len = this.context.environments.length; i < len; i++) {
|
||||
let environment = this.context.environments[i];
|
||||
if (environment && environment.equals(child)) {
|
||||
@@ -862,7 +862,7 @@ JavaScriptCompiler.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
programExpression: function(guid) {
|
||||
programExpression: function (guid) {
|
||||
let child = this.environment.children[guid],
|
||||
programParams = [child.index, 'data', child.blockParams];
|
||||
|
||||
@@ -876,14 +876,14 @@ JavaScriptCompiler.prototype = {
|
||||
return 'container.program(' + programParams.join(', ') + ')';
|
||||
},
|
||||
|
||||
useRegister: function(name) {
|
||||
useRegister: function (name) {
|
||||
if (!this.registers[name]) {
|
||||
this.registers[name] = true;
|
||||
this.registers.list.push(name);
|
||||
}
|
||||
},
|
||||
|
||||
push: function(expr) {
|
||||
push: function (expr) {
|
||||
if (!(expr instanceof Literal)) {
|
||||
expr = this.source.wrap(expr);
|
||||
}
|
||||
@@ -892,11 +892,11 @@ JavaScriptCompiler.prototype = {
|
||||
return expr;
|
||||
},
|
||||
|
||||
pushStackLiteral: function(item) {
|
||||
pushStackLiteral: function (item) {
|
||||
this.push(new Literal(item));
|
||||
},
|
||||
|
||||
pushSource: function(source) {
|
||||
pushSource: function (source) {
|
||||
if (this.pendingContent) {
|
||||
this.source.push(
|
||||
this.appendToBuffer(
|
||||
@@ -912,7 +912,7 @@ JavaScriptCompiler.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
replaceStack: function(callback) {
|
||||
replaceStack: function (callback) {
|
||||
let prefix = ['('],
|
||||
stack,
|
||||
createdStack,
|
||||
@@ -951,17 +951,17 @@ JavaScriptCompiler.prototype = {
|
||||
this.push(prefix.concat(item, ')'));
|
||||
},
|
||||
|
||||
incrStack: function() {
|
||||
incrStack: function () {
|
||||
this.stackSlot++;
|
||||
if (this.stackSlot > this.stackVars.length) {
|
||||
this.stackVars.push('stack' + this.stackSlot);
|
||||
}
|
||||
return this.topStackName();
|
||||
},
|
||||
topStackName: function() {
|
||||
topStackName: function () {
|
||||
return 'stack' + this.stackSlot;
|
||||
},
|
||||
flushInline: function() {
|
||||
flushInline: function () {
|
||||
let inlineStack = this.inlineStack;
|
||||
this.inlineStack = [];
|
||||
for (let i = 0, len = inlineStack.length; i < len; i++) {
|
||||
@@ -976,11 +976,11 @@ JavaScriptCompiler.prototype = {
|
||||
}
|
||||
}
|
||||
},
|
||||
isInline: function() {
|
||||
isInline: function () {
|
||||
return this.inlineStack.length;
|
||||
},
|
||||
|
||||
popStack: function(wrapped) {
|
||||
popStack: function (wrapped) {
|
||||
let inline = this.isInline(),
|
||||
item = (inline ? this.inlineStack : this.compileStack).pop();
|
||||
|
||||
@@ -998,7 +998,7 @@ JavaScriptCompiler.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
topStack: function() {
|
||||
topStack: function () {
|
||||
let stack = this.isInline() ? this.inlineStack : this.compileStack,
|
||||
item = stack[stack.length - 1];
|
||||
|
||||
@@ -1010,7 +1010,7 @@ JavaScriptCompiler.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
contextName: function(context) {
|
||||
contextName: function (context) {
|
||||
if (this.useDepths && context) {
|
||||
return 'depths[' + context + ']';
|
||||
} else {
|
||||
@@ -1018,15 +1018,15 @@ JavaScriptCompiler.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
quotedString: function(str) {
|
||||
quotedString: function (str) {
|
||||
return this.source.quotedString(str);
|
||||
},
|
||||
|
||||
objectLiteral: function(obj) {
|
||||
objectLiteral: function (obj) {
|
||||
return this.source.objectLiteral(obj);
|
||||
},
|
||||
|
||||
aliasable: function(name) {
|
||||
aliasable: function (name) {
|
||||
let ret = this.aliases[name];
|
||||
if (ret) {
|
||||
ret.referenceCount++;
|
||||
@@ -1040,7 +1040,7 @@ JavaScriptCompiler.prototype = {
|
||||
return ret;
|
||||
},
|
||||
|
||||
setupHelper: function(paramSize, name, blockHelper) {
|
||||
setupHelper: function (paramSize, name, blockHelper) {
|
||||
let params = [],
|
||||
paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper);
|
||||
let foundHelper = this.nameLookup('helpers', name, 'helper'),
|
||||
@@ -1054,11 +1054,11 @@ JavaScriptCompiler.prototype = {
|
||||
params: params,
|
||||
paramsInit: paramsInit,
|
||||
name: foundHelper,
|
||||
callParams: [callContext].concat(params)
|
||||
callParams: [callContext].concat(params),
|
||||
};
|
||||
},
|
||||
|
||||
setupParams: function(helper, paramSize, params) {
|
||||
setupParams: function (helper, paramSize, params) {
|
||||
let options = {},
|
||||
objectArgs = !params,
|
||||
param;
|
||||
@@ -1101,7 +1101,7 @@ JavaScriptCompiler.prototype = {
|
||||
return options;
|
||||
},
|
||||
|
||||
setupHelperArgs: function(helper, paramSize, params, useRegister) {
|
||||
setupHelperArgs: function (helper, paramSize, params, useRegister) {
|
||||
let options = this.setupParams(helper, paramSize, params);
|
||||
options.loc = JSON.stringify(this.source.currentLocation);
|
||||
options = this.objectLiteral(options);
|
||||
@@ -1115,10 +1115,10 @@ JavaScriptCompiler.prototype = {
|
||||
} else {
|
||||
return options;
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
(function() {
|
||||
(function () {
|
||||
const reservedWords = (
|
||||
'break else new var' +
|
||||
' case finally return void' +
|
||||
@@ -1148,7 +1148,7 @@ JavaScriptCompiler.prototype = {
|
||||
/**
|
||||
* @deprecated May be removed in the next major version
|
||||
*/
|
||||
JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
|
||||
JavaScriptCompiler.isValidJavaScriptVariableName = function (name) {
|
||||
return (
|
||||
!JavaScriptCompiler.RESERVED_WORDS[name] &&
|
||||
/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name)
|
||||
@@ -1175,7 +1175,7 @@ function strictLookup(requireTerminal, compiler, parts, i, type) {
|
||||
compiler.quotedString(parts[i]),
|
||||
', ',
|
||||
JSON.stringify(compiler.source.currentLocation),
|
||||
' )'
|
||||
' )',
|
||||
];
|
||||
} else {
|
||||
return stack;
|
||||
|
||||
Reference in New Issue
Block a user