mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Merge branch '2' of github.com:jashkenas/coffeescript into 2
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
CoffeeScript.run(...param);
|
||||
}
|
||||
} else {
|
||||
throw new Error("Could not load " + url);
|
||||
throw new Error(`Could not load ${url}`);
|
||||
}
|
||||
if (callback) {
|
||||
return callback(param);
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
options = oparse.parse(args);
|
||||
} catch (error) {
|
||||
e = error;
|
||||
return fatalError("" + e);
|
||||
return fatalError(`${e}`);
|
||||
}
|
||||
ref = options["arguments"];
|
||||
results = [];
|
||||
@@ -76,13 +76,13 @@
|
||||
var cakefilePath, desc, name, relative, spaces, task;
|
||||
relative = path.relative || path.resolve;
|
||||
cakefilePath = path.join(relative(__originalDirname, process.cwd()), 'Cakefile');
|
||||
console.log(cakefilePath + " defines the following tasks:\n");
|
||||
console.log(`${cakefilePath} defines the following tasks:\n`);
|
||||
for (name in tasks) {
|
||||
task = tasks[name];
|
||||
spaces = 20 - name.length;
|
||||
spaces = spaces > 0 ? Array(spaces + 1).join(' ') : '';
|
||||
desc = task.description ? "# " + task.description : '';
|
||||
console.log("cake " + name + spaces + " " + desc);
|
||||
desc = task.description ? `# ${task.description}` : '';
|
||||
console.log(`cake ${name}${spaces} ${desc}`);
|
||||
}
|
||||
if (switches.length) {
|
||||
return console.log(oparse.help());
|
||||
@@ -96,7 +96,7 @@
|
||||
};
|
||||
|
||||
missingTask = function(task) {
|
||||
return fatalError("No such task: " + task);
|
||||
return fatalError(`No such task: ${task}`);
|
||||
};
|
||||
|
||||
cakefileDirectory = function(dir) {
|
||||
@@ -108,7 +108,7 @@
|
||||
if (parent !== dir) {
|
||||
return cakefileDirectory(parent);
|
||||
}
|
||||
throw new Error("Cakefile not found in " + (process.cwd()));
|
||||
throw new Error(`Cakefile not found in ${process.cwd()}`);
|
||||
};
|
||||
|
||||
}).call(this);
|
||||
|
||||
@@ -109,17 +109,17 @@
|
||||
js += fragment.code;
|
||||
}
|
||||
if (options.header) {
|
||||
header = "Generated by CoffeeScript " + this.VERSION;
|
||||
js = "// " + header + "\n" + js;
|
||||
header = `Generated by CoffeeScript ${this.VERSION}`;
|
||||
js = `// ${header}\n${js}`;
|
||||
}
|
||||
if (generateSourceMap) {
|
||||
v3SourceMap = map.generate(options, code);
|
||||
}
|
||||
if (options.inlineMap) {
|
||||
encoded = base64encode(JSON.stringify(v3SourceMap));
|
||||
sourceMapDataURI = "//# sourceMappingURL=data:application/json;base64," + encoded;
|
||||
sourceURL = "//# sourceURL=" + ((ref1 = options.filename) != null ? ref1 : 'coffeescript');
|
||||
js = js + "\n" + sourceMapDataURI + "\n" + sourceURL;
|
||||
sourceMapDataURI = `//# sourceMappingURL=data:application/json;base64,${encoded}`;
|
||||
sourceURL = `//# sourceURL=${(ref1 = options.filename) != null ? ref1 : 'coffeescript'}`;
|
||||
js = `${js}\n${sourceMapDataURI}\n${sourceURL}`;
|
||||
}
|
||||
if (options.sourceMap) {
|
||||
return {
|
||||
@@ -230,7 +230,7 @@
|
||||
fn1 = function(ext) {
|
||||
var base;
|
||||
return (base = require.extensions)[ext] != null ? base[ext] : base[ext] = function() {
|
||||
throw new Error("Use CoffeeScript.register() or require the coffee-script/register module to require " + ext + " files.");
|
||||
throw new Error(`Use CoffeeScript.register() or require the coffee-script/register module to require ${ext} files.`);
|
||||
};
|
||||
};
|
||||
for (i = 0, len = ref.length; i < len; i++) {
|
||||
@@ -301,7 +301,7 @@
|
||||
return helpers.nameWhitespaceCharacter(errorText);
|
||||
}
|
||||
})();
|
||||
return helpers.throwSyntaxError("unexpected " + errorText, errorLoc);
|
||||
return helpers.throwSyntaxError(`unexpected ${errorText}`, errorLoc);
|
||||
};
|
||||
|
||||
formatSourcePosition = function(frame, getSourceMapping) {
|
||||
@@ -314,7 +314,7 @@
|
||||
if (frame.isEval()) {
|
||||
fileName = frame.getScriptNameOrSourceURL();
|
||||
if (!fileName) {
|
||||
fileLocation = (frame.getEvalOrigin()) + ", ";
|
||||
fileLocation = `${frame.getEvalOrigin()}, `;
|
||||
}
|
||||
} else {
|
||||
fileName = frame.getFileName();
|
||||
@@ -323,7 +323,7 @@
|
||||
line = frame.getLineNumber();
|
||||
column = frame.getColumnNumber();
|
||||
source = getSourceMapping(fileName, line, column);
|
||||
fileLocation = source ? fileName + ":" + source[0] + ":" + source[1] : fileName + ":" + line + ":" + column;
|
||||
fileLocation = source ? `${fileName}:${source[0]}:${source[1]}` : `${fileName}:${line}:${column}`;
|
||||
}
|
||||
functionName = frame.getFunctionName();
|
||||
isConstructor = frame.isConstructor();
|
||||
@@ -334,19 +334,19 @@
|
||||
if (functionName) {
|
||||
tp = as = '';
|
||||
if (typeName && functionName.indexOf(typeName)) {
|
||||
tp = typeName + ".";
|
||||
tp = `${typeName}.`;
|
||||
}
|
||||
if (methodName && functionName.indexOf("." + methodName) !== functionName.length - methodName.length - 1) {
|
||||
as = " [as " + methodName + "]";
|
||||
if (methodName && functionName.indexOf(`.${methodName}`) !== functionName.length - methodName.length - 1) {
|
||||
as = ` [as ${methodName}]`;
|
||||
}
|
||||
return "" + tp + functionName + as + " (" + fileLocation + ")";
|
||||
return `${tp}${functionName}${as} (${fileLocation})`;
|
||||
} else {
|
||||
return typeName + "." + (methodName || '<anonymous>') + " (" + fileLocation + ")";
|
||||
return `${typeName}.${methodName || '<anonymous>'} (${fileLocation})`;
|
||||
}
|
||||
} else if (isConstructor) {
|
||||
return "new " + (functionName || '<anonymous>') + " (" + fileLocation + ")";
|
||||
return `new ${functionName || '<anonymous>'} (${fileLocation})`;
|
||||
} else if (functionName) {
|
||||
return functionName + " (" + fileLocation + ")";
|
||||
return `${functionName} (${fileLocation})`;
|
||||
} else {
|
||||
return fileLocation;
|
||||
}
|
||||
@@ -392,11 +392,11 @@
|
||||
if (frame.getFunction() === exports.run) {
|
||||
break;
|
||||
}
|
||||
results.push(" at " + (formatSourcePosition(frame, getSourceMapping)));
|
||||
results.push(` at ${formatSourcePosition(frame, getSourceMapping)}`);
|
||||
}
|
||||
return results;
|
||||
})();
|
||||
return (err.toString()) + "\n" + (frames.join('\n')) + "\n";
|
||||
return `${err.toString()}\n${frames.join('\n')}\n`;
|
||||
};
|
||||
|
||||
}).call(this);
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
_ = match[0], name = match[1], module = match[2];
|
||||
}
|
||||
name || (name = helpers.baseFileName(module, true, useWinPathSep));
|
||||
return name + " = require('" + module + "')";
|
||||
return `${name} = require('${module}')`;
|
||||
}).join(';');
|
||||
};
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
} catch (error) {
|
||||
err = error;
|
||||
if (err.code === 'ENOENT') {
|
||||
console.error("File not found: " + source);
|
||||
console.error(`File not found: ${source}`);
|
||||
process.exit(1);
|
||||
}
|
||||
throw err;
|
||||
@@ -182,7 +182,7 @@
|
||||
ref1 = CoffeeScript.FILE_EXTENSIONS;
|
||||
for (i = 0, len = ref1.length; i < len; i++) {
|
||||
ext = ref1[i];
|
||||
index = path.join(source, "index" + ext);
|
||||
index = path.join(source, `index${ext}`);
|
||||
try {
|
||||
if ((fs.statSync(index)).isFile()) {
|
||||
return index;
|
||||
@@ -194,7 +194,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
console.error("Missing index.coffee or index.litcoffee in " + source);
|
||||
console.error(`Missing index.coffee or index.litcoffee in ${source}`);
|
||||
return process.exit(1);
|
||||
};
|
||||
|
||||
@@ -245,7 +245,7 @@
|
||||
if (CoffeeScript.listeners('failure').length) {
|
||||
return;
|
||||
}
|
||||
message = (err != null ? err.stack : void 0) || ("" + err);
|
||||
message = (err != null ? err.stack : void 0) || `${err}`;
|
||||
if (o.watch) {
|
||||
return printLine(message + '\x07');
|
||||
} else {
|
||||
@@ -420,7 +420,7 @@
|
||||
if (!opts.join) {
|
||||
silentUnlink(outputPath(source, base));
|
||||
silentUnlink(outputPath(source, base, '.js.map'));
|
||||
return timeLog("removed " + source);
|
||||
return timeLog(`removed ${source}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -481,21 +481,21 @@
|
||||
js = ' ';
|
||||
}
|
||||
if (generatedSourceMap) {
|
||||
js = js + "\n//# sourceMappingURL=" + (helpers.baseFileName(sourceMapPath, false, useWinPathSep)) + "\n";
|
||||
js = `${js}\n//# sourceMappingURL=${helpers.baseFileName(sourceMapPath, false, useWinPathSep)}\n`;
|
||||
}
|
||||
fs.writeFile(jsPath, js, function(err) {
|
||||
if (err) {
|
||||
printLine(err.message);
|
||||
return process.exit(1);
|
||||
} else if (opts.compile && opts.watch) {
|
||||
return timeLog("compiled " + sourcePath);
|
||||
return timeLog(`compiled ${sourcePath}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (generatedSourceMap) {
|
||||
return fs.writeFile(sourceMapPath, generatedSourceMap, function(err) {
|
||||
if (err) {
|
||||
printLine("Could not write source map: " + err.message);
|
||||
printLine(`Could not write source map: ${err.message}`);
|
||||
return process.exit(1);
|
||||
}
|
||||
});
|
||||
@@ -515,7 +515,7 @@
|
||||
};
|
||||
|
||||
timeLog = function(message) {
|
||||
return console.log(((new Date).toLocaleTimeString()) + " - " + message);
|
||||
return console.log(`${(new Date).toLocaleTimeString()} - ${message}`);
|
||||
};
|
||||
|
||||
printTokens = function(tokens) {
|
||||
@@ -527,7 +527,7 @@
|
||||
token = tokens[i];
|
||||
tag = token[0];
|
||||
value = token[1].toString().replace(/\n/, '\\n');
|
||||
results.push("[" + tag + " " + value + "]");
|
||||
results.push(`[${tag} ${value}]`);
|
||||
}
|
||||
return results;
|
||||
})();
|
||||
@@ -595,7 +595,7 @@
|
||||
};
|
||||
|
||||
version = function() {
|
||||
return printLine("CoffeeScript version " + CoffeeScript.VERSION);
|
||||
return printLine(`CoffeeScript version ${CoffeeScript.VERSION}`);
|
||||
};
|
||||
|
||||
}).call(this);
|
||||
|
||||
@@ -13,19 +13,19 @@
|
||||
if (!action) {
|
||||
return [patternString, '$$ = $1;', options];
|
||||
}
|
||||
action = (match = unwrap.exec(action)) ? match[1] : "(" + action + "())";
|
||||
action = (match = unwrap.exec(action)) ? match[1] : `(${action}())`;
|
||||
action = action.replace(/\bnew /g, '$&yy.');
|
||||
action = action.replace(/\b(?:Block\.wrap|extend)\b/g, 'yy.$&');
|
||||
addLocationDataFn = function(first, last) {
|
||||
if (!last) {
|
||||
return "yy.addLocationDataFn(@" + first + ")";
|
||||
return `yy.addLocationDataFn(@${first})`;
|
||||
} else {
|
||||
return "yy.addLocationDataFn(@" + first + ", @" + last + ")";
|
||||
return `yy.addLocationDataFn(@${first}, @${last})`;
|
||||
}
|
||||
};
|
||||
action = action.replace(/LOC\(([0-9]*)\)/g, addLocationDataFn('$1'));
|
||||
action = action.replace(/LOC\(([0-9]*),\s*([0-9]*)\)/g, addLocationDataFn('$1', '$2'));
|
||||
return [patternString, "$$ = " + (addLocationDataFn(1, patternCount)) + "(" + action + ");", options];
|
||||
return [patternString, `$$ = ${addLocationDataFn(1, patternCount)}(${action});`, options];
|
||||
};
|
||||
|
||||
grammar = {
|
||||
@@ -798,7 +798,7 @@
|
||||
}
|
||||
}
|
||||
if (name === 'Root') {
|
||||
alt[1] = "return " + alt[1];
|
||||
alt[1] = `return ${alt[1]}`;
|
||||
}
|
||||
results.push(alt);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
exports.invertLiterate = function(code) {
|
||||
var generateRandomToken, i, item, len1, out, ref1, token;
|
||||
generateRandomToken = function() {
|
||||
return "" + (Math.random() * Date.now());
|
||||
return `${Math.random() * Date.now()}`;
|
||||
};
|
||||
while (token === void 0 || code.indexOf(token) !== -1) {
|
||||
token = generateRandomToken();
|
||||
@@ -111,7 +111,7 @@
|
||||
for (i = 0, len1 = ref1.length; i < len1; i++) {
|
||||
item = ref1[i];
|
||||
if (item.type === 'code') {
|
||||
out += item.text + "\n";
|
||||
out += `${item.text}\n`;
|
||||
}
|
||||
}
|
||||
out.replace(token, "\t");
|
||||
@@ -148,7 +148,7 @@
|
||||
locationData = obj;
|
||||
}
|
||||
if (locationData) {
|
||||
return ((locationData.first_line + 1) + ":" + (locationData.first_column + 1) + "-") + ((locationData.last_line + 1) + ":" + (locationData.last_column + 1));
|
||||
return `${locationData.first_line + 1}:${locationData.first_column + 1}-` + `${locationData.last_line + 1}:${locationData.last_column + 1}`;
|
||||
} else {
|
||||
return "No location data";
|
||||
}
|
||||
@@ -218,12 +218,12 @@
|
||||
}
|
||||
if ((ref4 = this.colorful) != null ? ref4 : colorsEnabled) {
|
||||
colorize = function(str) {
|
||||
return "\x1B[1;31m" + str + "\x1B[0m";
|
||||
return `\x1B[1;31m${str}\x1B[0m`;
|
||||
};
|
||||
codeLine = codeLine.slice(0, start) + colorize(codeLine.slice(start, end)) + codeLine.slice(end);
|
||||
marker = colorize(marker);
|
||||
}
|
||||
return filename + ":" + (first_line + 1) + ":" + (first_column + 1) + ": error: " + this.message + "\n" + codeLine + "\n" + marker;
|
||||
return `${filename}:${first_line + 1}:${first_column + 1}: error: ${this.message}\n${codeLine}\n${marker}`;
|
||||
};
|
||||
|
||||
exports.nameWhitespaceCharacter = function(string) {
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
}
|
||||
this.closeIndentation();
|
||||
if (end = this.ends.pop()) {
|
||||
this.error("missing " + end.tag, end.origin[2]);
|
||||
this.error(`missing ${end.tag}`, end.origin[2]);
|
||||
}
|
||||
if (opts.rewrite === false) {
|
||||
return this.tokens;
|
||||
@@ -56,7 +56,7 @@
|
||||
}
|
||||
code = code.replace(/\r/g, '').replace(TRAILING_SPACES, '');
|
||||
if (WHITESPACE.test(code)) {
|
||||
code = "\n" + code;
|
||||
code = `\n${code}`;
|
||||
this.chunkLine--;
|
||||
}
|
||||
if (this.literate) {
|
||||
@@ -133,7 +133,7 @@
|
||||
this.seenFor = false;
|
||||
}
|
||||
if (tag === 'IDENTIFIER' && indexOf.call(RESERVED, id) >= 0) {
|
||||
this.error("reserved word '" + id + "'", {
|
||||
this.error(`reserved word '${id}'`, {
|
||||
length: id.length
|
||||
});
|
||||
}
|
||||
@@ -187,22 +187,22 @@
|
||||
lexedLength = number.length;
|
||||
switch (false) {
|
||||
case !/^0[BOX]/.test(number):
|
||||
this.error("radix prefix in '" + number + "' must be lowercase", {
|
||||
this.error(`radix prefix in '${number}' must be lowercase`, {
|
||||
offset: 1
|
||||
});
|
||||
break;
|
||||
case !/^(?!0x).*E/.test(number):
|
||||
this.error("exponential notation in '" + number + "' must be indicated with a lowercase 'e'", {
|
||||
this.error(`exponential notation in '${number}' must be indicated with a lowercase 'e'`, {
|
||||
offset: number.indexOf('E')
|
||||
});
|
||||
break;
|
||||
case !/^0\d*[89]/.test(number):
|
||||
this.error("decimal literal '" + number + "' must not be prefixed with '0'", {
|
||||
this.error(`decimal literal '${number}' must not be prefixed with '0'`, {
|
||||
length: lexedLength
|
||||
});
|
||||
break;
|
||||
case !/^0\d+/.test(number):
|
||||
this.error("octal literal '" + number + "' must be prefixed with '0o'", {
|
||||
this.error(`octal literal '${number}' must be prefixed with '0o'`, {
|
||||
length: lexedLength
|
||||
});
|
||||
}
|
||||
@@ -269,7 +269,7 @@
|
||||
}
|
||||
}
|
||||
if (indent) {
|
||||
indentRegex = RegExp("\\n" + indent, "g");
|
||||
indentRegex = RegExp(`\\n${indent}`, "g");
|
||||
}
|
||||
this.mergeInterpolationTokens(tokens, {
|
||||
delimiter: delimiter
|
||||
@@ -312,13 +312,13 @@
|
||||
comment = match[0], here = match[1];
|
||||
if (here) {
|
||||
if (match = HERECOMMENT_ILLEGAL.exec(comment)) {
|
||||
this.error("block comments cannot contain " + match[0], {
|
||||
this.error(`block comments cannot contain ${match[0]}`, {
|
||||
offset: match.index,
|
||||
length: match[0].length
|
||||
});
|
||||
}
|
||||
if (here.indexOf('\n') >= 0) {
|
||||
here = here.replace(RegExp("\\n" + (repeat(' ', this.indent)), "g"), '\n');
|
||||
here = here.replace(RegExp(`\\n${repeat(' ', this.indent)}`, "g"), '\n');
|
||||
}
|
||||
this.token('HERECOMMENT', here, 0, comment.length);
|
||||
}
|
||||
@@ -341,7 +341,7 @@
|
||||
var body, closed, end, flags, index, match, origin, prev, ref2, ref3, ref4, regex, tokens;
|
||||
switch (false) {
|
||||
case !(match = REGEX_ILLEGAL.exec(this.chunk)):
|
||||
this.error("regular expressions cannot begin with " + match[2], {
|
||||
this.error(`regular expressions cannot begin with ${match[2]}`, {
|
||||
offset: match.index + match[1].length
|
||||
});
|
||||
break;
|
||||
@@ -377,7 +377,7 @@
|
||||
origin = this.makeToken('REGEX', null, 0, end);
|
||||
switch (false) {
|
||||
case !!VALID_FLAGS.test(flags):
|
||||
this.error("invalid regular expression flags " + flags, {
|
||||
this.error(`invalid regular expression flags ${flags}`, {
|
||||
offset: index,
|
||||
length: flags.length
|
||||
});
|
||||
@@ -386,9 +386,9 @@
|
||||
if (body == null) {
|
||||
body = this.formatHeregex(tokens[0][1]);
|
||||
}
|
||||
this.token('REGEX', "" + (this.makeDelimitedLiteral(body, {
|
||||
this.token('REGEX', `${this.makeDelimitedLiteral(body, {
|
||||
delimiter: '/'
|
||||
})) + flags, 0, end, origin);
|
||||
})}${flags}`, 0, end, origin);
|
||||
break;
|
||||
default:
|
||||
this.token('REGEX_START', '(', 0, 0, origin);
|
||||
@@ -702,7 +702,7 @@
|
||||
offsetInChunk += index;
|
||||
}
|
||||
if (str.slice(0, delimiter.length) !== delimiter) {
|
||||
this.error("missing " + delimiter, {
|
||||
this.error(`missing ${delimiter}`, {
|
||||
length: delimiter.length
|
||||
});
|
||||
}
|
||||
@@ -793,7 +793,7 @@
|
||||
ref2 = this.ends, prev = ref2[ref2.length - 1];
|
||||
if (tag !== (wanted = prev != null ? prev.tag : void 0)) {
|
||||
if ('OUTDENT' !== wanted) {
|
||||
this.error("unmatched " + tag);
|
||||
this.error(`unmatched ${tag}`);
|
||||
}
|
||||
ref3 = this.indents, lastIndent = ref3[ref3.length - 1];
|
||||
this.outdentToken(lastIndent, true);
|
||||
@@ -879,8 +879,8 @@
|
||||
return;
|
||||
}
|
||||
message = octal ? "octal escape sequences are not allowed" : "invalid escape sequence";
|
||||
invalidEscape = "\\" + (octal || hex || unicode);
|
||||
return this.error(message + " " + invalidEscape, {
|
||||
invalidEscape = `\\${octal || hex || unicode}`;
|
||||
return this.error(`${message} ${invalidEscape}`, {
|
||||
offset: ((ref2 = options.offsetInChunk) != null ? ref2 : 0) + match.index + before.length,
|
||||
length: invalidEscape.length
|
||||
});
|
||||
@@ -891,7 +891,7 @@
|
||||
if (body === '' && options.delimiter === '/') {
|
||||
body = '(?:)';
|
||||
}
|
||||
regex = RegExp("(\\\\\\\\)|(\\\\0(?=[1-7]))|\\\\?(" + options.delimiter + ")|\\\\?(?:(\\n)|(\\r)|(\\u2028)|(\\u2029))|(\\\\.)", "g");
|
||||
regex = RegExp(`(\\\\\\\\)|(\\\\0(?=[1-7]))|\\\\?(${options.delimiter})|\\\\?(?:(\\n)|(\\r)|(\\u2028)|(\\u2029))|(\\\\.)`, "g");
|
||||
body = body.replace(regex, function(match, backslash, nul, delimiter, lf, cr, ls, ps, other) {
|
||||
switch (false) {
|
||||
case !backslash:
|
||||
@@ -903,7 +903,7 @@
|
||||
case !nul:
|
||||
return '\\x00';
|
||||
case !delimiter:
|
||||
return "\\" + delimiter;
|
||||
return `\\${delimiter}`;
|
||||
case !lf:
|
||||
return '\\n';
|
||||
case !cr:
|
||||
@@ -914,13 +914,13 @@
|
||||
return '\\u2029';
|
||||
case !other:
|
||||
if (options.double) {
|
||||
return "\\" + other;
|
||||
return `\\${other}`;
|
||||
} else {
|
||||
return other;
|
||||
}
|
||||
}
|
||||
});
|
||||
return "" + options.delimiter + body + options.delimiter;
|
||||
return `${options.delimiter}${body}${options.delimiter}`;
|
||||
};
|
||||
|
||||
Lexer.prototype.error = function(message, options = {}) {
|
||||
@@ -940,11 +940,11 @@
|
||||
isUnassignable = function(name, displayName = name) {
|
||||
switch (false) {
|
||||
case indexOf.call([...JS_KEYWORDS, ...COFFEE_KEYWORDS], name) < 0:
|
||||
return "keyword '" + displayName + "' can't be assigned";
|
||||
return `keyword '${displayName}' can't be assigned`;
|
||||
case indexOf.call(STRICT_PROSCRIBED, name) < 0:
|
||||
return "'" + displayName + "' can't be assigned";
|
||||
return `'${displayName}' can't be assigned`;
|
||||
case indexOf.call(RESERVED, name) < 0:
|
||||
return "reserved word '" + displayName + "' can't be assigned";
|
||||
return `reserved word '${displayName}' can't be assigned`;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,13 +38,13 @@
|
||||
exports.CodeFragment = CodeFragment = (function() {
|
||||
function CodeFragment(parent, code) {
|
||||
var ref3;
|
||||
this.code = "" + code;
|
||||
this.code = `${code}`;
|
||||
this.locationData = parent != null ? parent.locationData : void 0;
|
||||
this.type = (parent != null ? (ref3 = parent.constructor) != null ? ref3.name : void 0 : void 0) || 'unknown';
|
||||
}
|
||||
|
||||
CodeFragment.prototype.toString = function() {
|
||||
return "" + this.code + (this.locationData ? ": " + locationDataToString(this.locationData) : '');
|
||||
return `${this.code}${(this.locationData ? ": " + locationDataToString(this.locationData) : '')}`;
|
||||
};
|
||||
|
||||
return CodeFragment;
|
||||
@@ -142,7 +142,7 @@
|
||||
var me;
|
||||
me = this.unwrapAll();
|
||||
if (res) {
|
||||
return new Call(new Literal(res + ".push"), [me]);
|
||||
return new Call(new Literal(`${res}.push`), [me]);
|
||||
} else {
|
||||
return new Return(me);
|
||||
}
|
||||
@@ -384,7 +384,7 @@
|
||||
node.front = true;
|
||||
fragments = node.compileToFragments(o);
|
||||
if (!node.isStatement(o)) {
|
||||
fragments.unshift(this.makeCode("" + this.tab));
|
||||
fragments.unshift(this.makeCode(`${this.tab}`));
|
||||
fragments.push(this.makeCode(";"));
|
||||
}
|
||||
compiledNodes.push(fragments);
|
||||
@@ -484,17 +484,17 @@
|
||||
if (i) {
|
||||
fragments.push(this.makeCode('\n'));
|
||||
}
|
||||
fragments.push(this.makeCode(this.tab + "var "));
|
||||
fragments.push(this.makeCode(`${this.tab}var `));
|
||||
if (declars) {
|
||||
fragments.push(this.makeCode(scope.declaredVariables().join(', ')));
|
||||
}
|
||||
if (assigns) {
|
||||
if (declars) {
|
||||
fragments.push(this.makeCode(",\n" + (this.tab + TAB)));
|
||||
fragments.push(this.makeCode(`,\n${this.tab + TAB}`));
|
||||
}
|
||||
fragments.push(this.makeCode(scope.assignedVariables().join(",\n" + (this.tab + TAB))));
|
||||
fragments.push(this.makeCode(scope.assignedVariables().join(`,\n${this.tab + TAB}`)));
|
||||
}
|
||||
fragments.push(this.makeCode(";\n" + (this.spaced ? '\n' : '')));
|
||||
fragments.push(this.makeCode(`;\n${(this.spaced ? '\n' : '')}`));
|
||||
} else if (fragments.length && post.length) {
|
||||
fragments.push(this.makeCode("\n"));
|
||||
}
|
||||
@@ -531,7 +531,7 @@
|
||||
};
|
||||
|
||||
Literal.prototype.toString = function() {
|
||||
return " " + (this.isStatement() ? Literal.__super__.toString.call(this, ...arguments) : this.constructor.name) + ": " + this.value;
|
||||
return ` ${(this.isStatement() ? Literal.__super__.toString.call(this, ...arguments) : this.constructor.name)}: ${this.value}`;
|
||||
};
|
||||
|
||||
return Literal;
|
||||
@@ -665,7 +665,7 @@
|
||||
};
|
||||
|
||||
StatementLiteral.prototype.compileNode = function(o) {
|
||||
return [this.makeCode("" + this.tab + this.value + ";")];
|
||||
return [this.makeCode(`${this.tab}${this.value};`)];
|
||||
};
|
||||
|
||||
return StatementLiteral;
|
||||
@@ -754,7 +754,7 @@
|
||||
Return.prototype.compileNode = function(o) {
|
||||
var answer;
|
||||
answer = [];
|
||||
answer.push(this.makeCode(this.tab + ("return" + (this.expression ? " " : ""))));
|
||||
answer.push(this.makeCode(this.tab + `return${(this.expression ? " " : "")}`));
|
||||
if (this.expression) {
|
||||
answer = answer.concat(this.expression.compileToFragments(o, LEVEL_PAREN));
|
||||
}
|
||||
@@ -1010,7 +1010,7 @@
|
||||
Comment.prototype.compileNode = function(o, level) {
|
||||
var code, comment;
|
||||
comment = this.comment.replace(/^(\s*)#(?=\s)/gm, "$1 *");
|
||||
code = "/*" + (multident(comment, this.tab)) + (indexOf.call(comment, '\n') >= 0 ? "\n" + this.tab : '') + " */";
|
||||
code = `/*${multident(comment, this.tab)}${(indexOf.call(comment, '\n') >= 0 ? `\n${this.tab}` : '')} */`;
|
||||
if ((level || o.level) === LEVEL_TOP) {
|
||||
code = o.indent + code;
|
||||
}
|
||||
@@ -1062,7 +1062,7 @@
|
||||
}
|
||||
rite = new Call(rite, this.args);
|
||||
rite.isNew = this.isNew;
|
||||
left = new Literal("typeof " + (left.compile(o)) + " === \"function\"");
|
||||
left = new Literal(`typeof ${left.compile(o)} === \"function\"`);
|
||||
return new If(left, new Value(rite), {
|
||||
soak: true
|
||||
});
|
||||
@@ -1114,7 +1114,7 @@
|
||||
}
|
||||
fragments = [];
|
||||
if (this instanceof SuperCall) {
|
||||
preface = this.superReference(o) + (".call(" + (this.superThis(o)));
|
||||
preface = this.superReference(o) + `.call(${this.superThis(o)}`;
|
||||
if (compiledArgs.length) {
|
||||
preface += ", ";
|
||||
}
|
||||
@@ -1167,7 +1167,7 @@
|
||||
accesses.push(nref != null ? new Index(nref) : name);
|
||||
return (new Value(bref != null ? bref : klass, accesses)).compile(o);
|
||||
} else if (method != null ? method.ctor : void 0) {
|
||||
return method.name + ".__super__.constructor";
|
||||
return `${method.name}.__super__.constructor`;
|
||||
} else {
|
||||
return this.error('cannot call super outside of an instance method.');
|
||||
}
|
||||
@@ -1205,7 +1205,6 @@
|
||||
}
|
||||
|
||||
TaggedTemplateCall.prototype.compileNode = function(o) {
|
||||
o.inTaggedTemplateCall = true;
|
||||
return this.variable.compileToFragments(o, LEVEL_ACCESS).concat(this.args[0].compileToFragments(o, LEVEL_LIST));
|
||||
};
|
||||
|
||||
@@ -1323,23 +1322,23 @@
|
||||
idx = del(o, 'index');
|
||||
idxName = del(o, 'name');
|
||||
namedIndex = idxName && idxName !== idx;
|
||||
varPart = idx + " = " + this.fromC;
|
||||
varPart = `${idx} = ${this.fromC}`;
|
||||
if (this.toC !== this.toVar) {
|
||||
varPart += ", " + this.toC;
|
||||
varPart += `, ${this.toC}`;
|
||||
}
|
||||
if (this.step !== this.stepVar) {
|
||||
varPart += ", " + this.step;
|
||||
varPart += `, ${this.step}`;
|
||||
}
|
||||
ref3 = [idx + " <" + this.equals, idx + " >" + this.equals], lt = ref3[0], gt = ref3[1];
|
||||
condPart = this.stepNum != null ? this.stepNum > 0 ? lt + " " + this.toVar : gt + " " + this.toVar : known ? ((ref4 = [this.fromNum, this.toNum], from = ref4[0], to = ref4[1], ref4), from <= to ? lt + " " + to : gt + " " + to) : (cond = this.stepVar ? this.stepVar + " > 0" : this.fromVar + " <= " + this.toVar, cond + " ? " + lt + " " + this.toVar + " : " + gt + " " + this.toVar);
|
||||
stepPart = this.stepVar ? idx + " += " + this.stepVar : known ? namedIndex ? from <= to ? "++" + idx : "--" + idx : from <= to ? idx + "++" : idx + "--" : namedIndex ? cond + " ? ++" + idx + " : --" + idx : cond + " ? " + idx + "++ : " + idx + "--";
|
||||
ref3 = [`${idx} <${this.equals}`, `${idx} >${this.equals}`], lt = ref3[0], gt = ref3[1];
|
||||
condPart = this.stepNum != null ? this.stepNum > 0 ? `${lt} ${this.toVar}` : `${gt} ${this.toVar}` : known ? ((ref4 = [this.fromNum, this.toNum], from = ref4[0], to = ref4[1], ref4), from <= to ? `${lt} ${to}` : `${gt} ${to}`) : (cond = this.stepVar ? `${this.stepVar} > 0` : `${this.fromVar} <= ${this.toVar}`, `${cond} ? ${lt} ${this.toVar} : ${gt} ${this.toVar}`);
|
||||
stepPart = this.stepVar ? `${idx} += ${this.stepVar}` : known ? namedIndex ? from <= to ? `++${idx}` : `--${idx}` : from <= to ? `${idx}++` : `${idx}--` : namedIndex ? `${cond} ? ++${idx} : --${idx}` : `${cond} ? ${idx}++ : ${idx}--`;
|
||||
if (namedIndex) {
|
||||
varPart = idxName + " = " + varPart;
|
||||
varPart = `${idxName} = ${varPart}`;
|
||||
}
|
||||
if (namedIndex) {
|
||||
stepPart = idxName + " = " + stepPart;
|
||||
stepPart = `${idxName} = ${stepPart}`;
|
||||
}
|
||||
return [this.makeCode(varPart + "; " + condPart + "; " + stepPart)];
|
||||
return [this.makeCode(`${varPart}; ${condPart}; ${stepPart}`)];
|
||||
};
|
||||
|
||||
Range.prototype.compileArray = function(o) {
|
||||
@@ -1354,30 +1353,30 @@
|
||||
if (this.exclusive) {
|
||||
range.pop();
|
||||
}
|
||||
return [this.makeCode("[" + (range.join(', ')) + "]")];
|
||||
return [this.makeCode(`[${range.join(', ')}]`)];
|
||||
}
|
||||
idt = this.tab + TAB;
|
||||
i = o.scope.freeVariable('i', {
|
||||
single: true
|
||||
});
|
||||
result = o.scope.freeVariable('results');
|
||||
pre = "\n" + idt + result + " = [];";
|
||||
pre = `\n${idt}${result} = [];`;
|
||||
if (known) {
|
||||
o.index = i;
|
||||
body = fragmentsToText(this.compileNode(o));
|
||||
} else {
|
||||
vars = (i + " = " + this.fromC) + (this.toC !== this.toVar ? ", " + this.toC : '');
|
||||
cond = this.fromVar + " <= " + this.toVar;
|
||||
body = "var " + vars + "; " + cond + " ? " + i + " <" + this.equals + " " + this.toVar + " : " + i + " >" + this.equals + " " + this.toVar + "; " + cond + " ? " + i + "++ : " + i + "--";
|
||||
vars = `${i} = ${this.fromC}` + (this.toC !== this.toVar ? `, ${this.toC}` : '');
|
||||
cond = `${this.fromVar} <= ${this.toVar}`;
|
||||
body = `var ${vars}; ${cond} ? ${i} <${this.equals} ${this.toVar} : ${i} >${this.equals} ${this.toVar}; ${cond} ? ${i}++ : ${i}--`;
|
||||
}
|
||||
post = "{ " + result + ".push(" + i + "); }\n" + idt + "return " + result + ";\n" + o.indent;
|
||||
post = `{ ${result}.push(${i}); }\n${idt}return ${result};\n${o.indent}`;
|
||||
hasArgs = function(node) {
|
||||
return node != null ? node.contains(isLiteralArguments) : void 0;
|
||||
};
|
||||
if (hasArgs(this.from) || hasArgs(this.to)) {
|
||||
args = ', arguments';
|
||||
}
|
||||
return [this.makeCode("(function() {" + pre + "\n" + idt + "for (" + body + ")" + post + "}).apply(this" + (args != null ? args : '') + ")")];
|
||||
return [this.makeCode(`(function() {${pre}\n${idt}for (${body})${post}}).apply(this${args != null ? args : ''})`)];
|
||||
};
|
||||
|
||||
return Range;
|
||||
@@ -1402,10 +1401,10 @@
|
||||
compiled = to.compileToFragments(o, LEVEL_PAREN);
|
||||
compiledText = fragmentsToText(compiled);
|
||||
if (!(!this.range.exclusive && +compiledText === -1)) {
|
||||
toStr = ', ' + (this.range.exclusive ? compiledText : to.isNumber() ? "" + (+compiledText + 1) : (compiled = to.compileToFragments(o, LEVEL_ACCESS), "+" + (fragmentsToText(compiled)) + " + 1 || 9e9"));
|
||||
toStr = ', ' + (this.range.exclusive ? compiledText : to.isNumber() ? `${+compiledText + 1}` : (compiled = to.compileToFragments(o, LEVEL_ACCESS), `+${fragmentsToText(compiled)} + 1 || 9e9`));
|
||||
}
|
||||
}
|
||||
return [this.makeCode(".slice(" + (fragmentsToText(fromCompiled)) + (toStr || '') + ")")];
|
||||
return [this.makeCode(`.slice(${fragmentsToText(fromCompiled)}${toStr || ''})`)];
|
||||
};
|
||||
|
||||
return Slice;
|
||||
@@ -1437,14 +1436,14 @@
|
||||
idt = o.indent += TAB;
|
||||
lastNoncom = this.lastNonComment(this.properties);
|
||||
answer = [];
|
||||
answer.push(this.makeCode("{" + (props.length === 0 ? '}' : '\n')));
|
||||
answer.push(this.makeCode(`{${(props.length === 0 ? '}' : '\n')}`));
|
||||
for (i = k = 0, len2 = props.length; k < len2; i = ++k) {
|
||||
prop = props[i];
|
||||
join = i === props.length - 1 ? '' : prop === lastNoncom || prop instanceof Comment ? '\n' : ',\n';
|
||||
indent = prop instanceof Comment ? '' : idt;
|
||||
if (prop instanceof Assign) {
|
||||
if (prop.context !== 'object') {
|
||||
prop.operatorToken.error("unexpected " + prop.operatorToken.value);
|
||||
prop.operatorToken.error(`unexpected ${prop.operatorToken.value}`);
|
||||
}
|
||||
if (prop.variable instanceof Value && prop.variable.hasProperties()) {
|
||||
prop.variable.error('invalid object key');
|
||||
@@ -1473,7 +1472,7 @@
|
||||
}
|
||||
}
|
||||
if (props.length !== 0) {
|
||||
answer.push(this.makeCode("\n" + this.tab + "}"));
|
||||
answer.push(this.makeCode(`\n${this.tab}}`));
|
||||
}
|
||||
if (this.front) {
|
||||
return this.wrapInBraces(answer);
|
||||
@@ -1532,8 +1531,8 @@
|
||||
answer.push(...fragments);
|
||||
}
|
||||
if (fragmentsToText(answer).indexOf('\n') >= 0) {
|
||||
answer.unshift(this.makeCode("[\n" + o.indent));
|
||||
answer.push(this.makeCode("\n" + this.tab + "]"));
|
||||
answer.unshift(this.makeCode(`[\n${o.indent}`));
|
||||
answer.push(this.makeCode(`\n${this.tab}]`));
|
||||
} else {
|
||||
answer.unshift(this.makeCode("["));
|
||||
answer.push(this.makeCode("]"));
|
||||
@@ -1591,7 +1590,7 @@
|
||||
}
|
||||
}
|
||||
if (indexOf.call(JS_FORBIDDEN, name) >= 0) {
|
||||
return "_" + name;
|
||||
return `_${name}`;
|
||||
} else {
|
||||
return name;
|
||||
}
|
||||
@@ -1618,7 +1617,7 @@
|
||||
for (j = 0, len1 = ref3.length; j < len1; j++) {
|
||||
bvar = ref3[j];
|
||||
lhs = (new Value(new ThisLiteral, [new Access(bvar)])).compile(o);
|
||||
this.ctor.body.unshift(new Literal(lhs + " = " + (utility('bind', o)) + "(" + lhs + ", this)"));
|
||||
this.ctor.body.unshift(new Literal(`${lhs} = ${utility('bind', o)}(${lhs}, this)`));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1704,9 +1703,9 @@
|
||||
if (!this.ctor) {
|
||||
this.ctor = new Code;
|
||||
if (this.externalCtor) {
|
||||
this.ctor.body.push(new Literal(this.externalCtor + ".apply(this, arguments)"));
|
||||
this.ctor.body.push(new Literal(`${this.externalCtor}.apply(this, arguments)`));
|
||||
} else if (this.parent) {
|
||||
this.ctor.body.push(new Literal(name + ".__super__.constructor.apply(this, arguments)"));
|
||||
this.ctor.body.push(new Literal(`${name}.__super__.constructor.apply(this, arguments)`));
|
||||
}
|
||||
this.ctor.body.makeReturn();
|
||||
this.body.expressions.unshift(this.ctor);
|
||||
@@ -1783,7 +1782,7 @@
|
||||
|
||||
ModuleDeclaration.prototype.checkScope = function(o, moduleDeclarationType) {
|
||||
if (o.indent.length !== 0) {
|
||||
return this.error(moduleDeclarationType + " statements must be at top-level scope");
|
||||
return this.error(`${moduleDeclarationType} statements must be at top-level scope`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1803,7 +1802,7 @@
|
||||
this.checkScope(o, 'import');
|
||||
o.importedSymbols = [];
|
||||
code = [];
|
||||
code.push(this.makeCode(this.tab + "import "));
|
||||
code.push(this.makeCode(`${this.tab}import `));
|
||||
if (this.clause != null) {
|
||||
code.push(...this.clause.compileNode(o));
|
||||
}
|
||||
@@ -1861,7 +1860,7 @@
|
||||
var code, ref3;
|
||||
this.checkScope(o, 'export');
|
||||
code = [];
|
||||
code.push(this.makeCode(this.tab + "export "));
|
||||
code.push(this.makeCode(`${this.tab}export `));
|
||||
if (this instanceof ExportDefaultDeclaration) {
|
||||
code.push(this.makeCode('default '));
|
||||
}
|
||||
@@ -1878,7 +1877,7 @@
|
||||
code = code.concat(this.clause.compileNode(o));
|
||||
}
|
||||
if (((ref3 = this.source) != null ? ref3.value : void 0) != null) {
|
||||
code.push(this.makeCode(" from " + this.source.value));
|
||||
code.push(this.makeCode(` from ${this.source.value}`));
|
||||
}
|
||||
code.push(this.makeCode(';'));
|
||||
return code;
|
||||
@@ -1945,11 +1944,11 @@
|
||||
return results;
|
||||
}).call(this);
|
||||
if (this.specifiers.length !== 0) {
|
||||
code.push(this.makeCode("{\n" + o.indent));
|
||||
code.push(this.makeCode(`{\n${o.indent}`));
|
||||
for (index = j = 0, len1 = compiledList.length; j < len1; index = ++j) {
|
||||
fragments = compiledList[index];
|
||||
if (index) {
|
||||
code.push(this.makeCode(",\n" + o.indent));
|
||||
code.push(this.makeCode(`,\n${o.indent}`));
|
||||
}
|
||||
code.push(...fragments);
|
||||
}
|
||||
@@ -2004,7 +2003,7 @@
|
||||
code = [];
|
||||
code.push(this.makeCode(this.original.value));
|
||||
if (this.alias != null) {
|
||||
code.push(this.makeCode(" as " + this.alias.value));
|
||||
code.push(this.makeCode(` as ${this.alias.value}`));
|
||||
}
|
||||
return code;
|
||||
};
|
||||
@@ -2023,7 +2022,7 @@
|
||||
ImportSpecifier.prototype.compileNode = function(o) {
|
||||
var ref3;
|
||||
if ((ref3 = this.identifier, indexOf.call(o.importedSymbols, ref3) >= 0) || o.scope.check(this.identifier)) {
|
||||
this.error("'" + this.identifier + "' has already been declared");
|
||||
this.error(`'${this.identifier}' has already been declared`);
|
||||
} else {
|
||||
o.importedSymbols.push(this.identifier);
|
||||
}
|
||||
@@ -2085,7 +2084,7 @@
|
||||
|
||||
Assign.prototype.checkAssignability = function(o, varBase) {
|
||||
if (Object.prototype.hasOwnProperty.call(o.scope.positions, varBase.value) && o.scope.variables[o.scope.positions[varBase.value]].type === 'import') {
|
||||
return varBase.error("'" + varBase.value + "' is read-only");
|
||||
return varBase.error(`'${varBase.value}' is read-only`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2130,7 +2129,7 @@
|
||||
if (!this.context) {
|
||||
varBase = this.variable.unwrapAll();
|
||||
if (!varBase.isAssignable()) {
|
||||
this.variable.error("'" + (this.variable.compile(o)) + "' can't be assigned");
|
||||
this.variable.error(`'${this.variable.compile(o)}' can't be assigned`);
|
||||
}
|
||||
if (!(typeof varBase.hasProperties === "function" ? varBase.hasProperties() : void 0)) {
|
||||
if (this.moduleDeclaration) {
|
||||
@@ -2159,7 +2158,7 @@
|
||||
}
|
||||
return compiledName.concat(this.makeCode(": "), val);
|
||||
}
|
||||
answer = compiledName.concat(this.makeCode(" " + (this.context || '=') + " "), val);
|
||||
answer = compiledName.concat(this.makeCode(` ${this.context || '='} `), val);
|
||||
if (o.level <= LEVEL_LIST) {
|
||||
return answer;
|
||||
} else {
|
||||
@@ -2219,7 +2218,7 @@
|
||||
assigns = [];
|
||||
expandedIdx = false;
|
||||
if (!(value.unwrap() instanceof IdentifierLiteral) || this.variable.assigns(vvarText)) {
|
||||
assigns.push([this.makeCode((ref = o.scope.freeVariable('ref')) + " = "), ...vvar]);
|
||||
assigns.push([this.makeCode(`${(ref = o.scope.freeVariable('ref'))} = `), ...vvar]);
|
||||
vvar = [this.makeCode(ref)];
|
||||
vvarText = ref;
|
||||
}
|
||||
@@ -2229,27 +2228,27 @@
|
||||
if (!expandedIdx && obj instanceof Splat) {
|
||||
name = obj.name.unwrap().value;
|
||||
obj = obj.unwrap();
|
||||
val = olen + " <= " + vvarText + ".length ? " + (utility('slice', o)) + ".call(" + vvarText + ", " + i;
|
||||
val = `${olen} <= ${vvarText}.length ? ${utility('slice', o)}.call(${vvarText}, ${i}`;
|
||||
if (rest = olen - i - 1) {
|
||||
ivar = o.scope.freeVariable('i', {
|
||||
single: true
|
||||
});
|
||||
val += ", " + ivar + " = " + vvarText + ".length - " + rest + ") : (" + ivar + " = " + i + ", [])";
|
||||
val += `, ${ivar} = ${vvarText}.length - ${rest}) : (${ivar} = ${i}, [])`;
|
||||
} else {
|
||||
val += ") : []";
|
||||
}
|
||||
val = new Literal(val);
|
||||
expandedIdx = ivar + "++";
|
||||
expandedIdx = `${ivar}++`;
|
||||
} else if (!expandedIdx && obj instanceof Expansion) {
|
||||
if (rest = olen - i - 1) {
|
||||
if (rest === 1) {
|
||||
expandedIdx = vvarText + ".length - 1";
|
||||
expandedIdx = `${vvarText}.length - 1`;
|
||||
} else {
|
||||
ivar = o.scope.freeVariable('i', {
|
||||
single: true
|
||||
});
|
||||
val = new Literal(ivar + " = " + vvarText + ".length - " + rest);
|
||||
expandedIdx = ivar + "++";
|
||||
val = new Literal(`${ivar} = ${vvarText}.length - ${rest}`);
|
||||
expandedIdx = `${ivar}++`;
|
||||
assigns.push(val.compileToFragments(o, LEVEL_LIST));
|
||||
}
|
||||
}
|
||||
@@ -2305,7 +2304,7 @@
|
||||
var fragments, left, ref3, right;
|
||||
ref3 = this.variable.cacheReference(o), left = ref3[0], right = ref3[1];
|
||||
if (!left.properties.length && left.base instanceof Literal && !(left.base instanceof ThisLiteral) && !o.scope.check(left.base.value)) {
|
||||
this.variable.error("the variable \"" + left.base.value + "\" can't be assigned with " + this.context + " because it has not been declared before");
|
||||
this.variable.error(`the variable \"${left.base.value}\" can't be assigned with ${this.context} because it has not been declared before`);
|
||||
}
|
||||
if (indexOf.call(this.context, "?") >= 0) {
|
||||
o.isExistentialEquals = true;
|
||||
@@ -2353,7 +2352,7 @@
|
||||
to = "9e9";
|
||||
}
|
||||
ref5 = this.value.cache(o, LEVEL_LIST), valDef = ref5[0], valRef = ref5[1];
|
||||
answer = [].concat(this.makeCode("[].splice.apply(" + name + ", [" + fromDecl + ", " + to + "].concat("), valDef, this.makeCode(")), "), valRef);
|
||||
answer = [].concat(this.makeCode(`[].splice.apply(${name}, [${fromDecl}, ${to}].concat(`), valDef, this.makeCode(")), "), valRef);
|
||||
if (o.level > LEVEL_TOP) {
|
||||
return this.wrapInBraces(answer);
|
||||
} else {
|
||||
@@ -2421,7 +2420,7 @@
|
||||
paramNames = [];
|
||||
this.eachParamName((name, node) => {
|
||||
if (indexOf.call(paramNames, name) >= 0) {
|
||||
node.error("multiple parameters named '" + name + "'");
|
||||
node.error(`multiple parameters named '${name}'`);
|
||||
}
|
||||
return paramNames.push(name);
|
||||
});
|
||||
@@ -2524,7 +2523,7 @@
|
||||
}
|
||||
answer.push(this.makeCode(!this.bound ? ') {' : ') => {'));
|
||||
if (!this.body.isEmpty()) {
|
||||
answer = answer.concat(this.makeCode("\n"), this.body.compileWithDeclarations(o), this.makeCode("\n" + this.tab));
|
||||
answer = answer.concat(this.makeCode("\n"), this.body.compileWithDeclarations(o), this.makeCode(`\n${this.tab}`));
|
||||
}
|
||||
answer.push(this.makeCode('}'));
|
||||
if (this.ctor) {
|
||||
@@ -2572,7 +2571,7 @@
|
||||
}
|
||||
if (this.name instanceof Obj && this.name.generated) {
|
||||
token = this.name.objects[0].operatorToken;
|
||||
token.error("unexpected " + token.value);
|
||||
token.error(`unexpected ${token.value}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2591,7 +2590,7 @@
|
||||
if (node["this"]) {
|
||||
name = node.properties[0].name.value;
|
||||
if (indexOf.call(JS_FORBIDDEN, name) >= 0) {
|
||||
name = "_" + name;
|
||||
name = `_${name}`;
|
||||
}
|
||||
node = new IdentifierLiteral(o.scope.freeVariable(name));
|
||||
} else if (node.isComplex()) {
|
||||
@@ -2609,7 +2608,7 @@
|
||||
Param.prototype.eachName = function(iterator, name = this.name) {
|
||||
var atParam, j, len1, node, obj, ref3, ref4;
|
||||
atParam = function(obj) {
|
||||
return iterator("@" + obj.properties[0].name.value, obj);
|
||||
return iterator(`@${obj.properties[0].name.value}`, obj);
|
||||
};
|
||||
if (name instanceof Literal) {
|
||||
return iterator(name.value, name);
|
||||
@@ -2640,7 +2639,7 @@
|
||||
iterator(obj.base.value, obj.base);
|
||||
}
|
||||
} else if (!(obj instanceof Expansion)) {
|
||||
obj.error("illegal parameter " + (obj.compile()));
|
||||
obj.error(`illegal parameter ${obj.compile()}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -2754,7 +2753,7 @@
|
||||
} else {
|
||||
if (this.returns) {
|
||||
body.makeReturn(rvar = o.scope.freeVariable('results'));
|
||||
set = "" + this.tab + rvar + " = [];\n";
|
||||
set = `${this.tab}${rvar} = [];\n`;
|
||||
}
|
||||
if (this.guard) {
|
||||
if (body.expressions.length > 1) {
|
||||
@@ -2765,11 +2764,11 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
body = [].concat(this.makeCode("\n"), body.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab));
|
||||
body = [].concat(this.makeCode("\n"), body.compileToFragments(o, LEVEL_TOP), this.makeCode(`\n${this.tab}`));
|
||||
}
|
||||
answer = [].concat(this.makeCode(set + this.tab + "while ("), this.condition.compileToFragments(o, LEVEL_PAREN), this.makeCode(") {"), body, this.makeCode("}"));
|
||||
if (this.returns) {
|
||||
answer.push(this.makeCode("\n" + this.tab + "return " + rvar + ";"));
|
||||
answer.push(this.makeCode(`\n${this.tab}return ${rvar};`));
|
||||
}
|
||||
return answer;
|
||||
};
|
||||
@@ -2940,7 +2939,7 @@
|
||||
default:
|
||||
lhs = this.first.compileToFragments(o, LEVEL_OP);
|
||||
rhs = this.second.compileToFragments(o, LEVEL_OP);
|
||||
answer = [].concat(lhs, this.makeCode(" " + this.operator + " "), rhs);
|
||||
answer = [].concat(lhs, this.makeCode(` ${this.operator} `), rhs);
|
||||
if (o.level <= LEVEL_OP) {
|
||||
return answer;
|
||||
} else {
|
||||
@@ -2953,7 +2952,7 @@
|
||||
var fragments, fst, ref3, shared;
|
||||
ref3 = this.first.second.cache(o), this.first.second = ref3[0], shared = ref3[1];
|
||||
fst = this.first.compileToFragments(o, LEVEL_OP);
|
||||
fragments = fst.concat(this.makeCode(" " + (this.invert ? '&&' : '||') + " "), shared.compileToFragments(o), this.makeCode(" " + this.operator + " "), this.second.compileToFragments(o, LEVEL_OP));
|
||||
fragments = fst.concat(this.makeCode(` ${(this.invert ? '&&' : '||')} `), shared.compileToFragments(o), this.makeCode(` ${this.operator} `), this.second.compileToFragments(o, LEVEL_OP));
|
||||
return this.wrapInBraces(fragments);
|
||||
};
|
||||
|
||||
@@ -3002,7 +3001,7 @@
|
||||
parts = [];
|
||||
op = this.operator;
|
||||
if (o.scope.parent == null) {
|
||||
this.error(this.operator + " can only occur inside functions");
|
||||
this.error(`${this.operator} can only occur inside functions`);
|
||||
}
|
||||
if (((ref3 = o.scope.method) != null ? ref3.bound : void 0) && o.scope.method.isGenerator) {
|
||||
this.error('yield cannot occur inside bound (fat arrow) functions');
|
||||
@@ -3163,11 +3162,11 @@
|
||||
tryPart = this.attempt.compileToFragments(o, LEVEL_TOP);
|
||||
catchPart = this.recovery ? (generatedErrorVariableName = o.scope.freeVariable('error', {
|
||||
reserve: false
|
||||
}), placeholder = new IdentifierLiteral(generatedErrorVariableName), this.errorVariable ? (message = isUnassignable(this.errorVariable.unwrapAll().value), message ? this.errorVariable.error(message) : void 0, this.recovery.unshift(new Assign(this.errorVariable, placeholder))) : void 0, [].concat(this.makeCode(" catch ("), placeholder.compileToFragments(o), this.makeCode(") {\n"), this.recovery.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab + "}"))) : !(this.ensure || this.recovery) ? (generatedErrorVariableName = o.scope.freeVariable('error', {
|
||||
}), placeholder = new IdentifierLiteral(generatedErrorVariableName), this.errorVariable ? (message = isUnassignable(this.errorVariable.unwrapAll().value), message ? this.errorVariable.error(message) : void 0, this.recovery.unshift(new Assign(this.errorVariable, placeholder))) : void 0, [].concat(this.makeCode(" catch ("), placeholder.compileToFragments(o), this.makeCode(") {\n"), this.recovery.compileToFragments(o, LEVEL_TOP), this.makeCode(`\n${this.tab}}`))) : !(this.ensure || this.recovery) ? (generatedErrorVariableName = o.scope.freeVariable('error', {
|
||||
reserve: false
|
||||
}), [this.makeCode(" catch (" + generatedErrorVariableName + ") {}")]) : [];
|
||||
ensurePart = this.ensure ? [].concat(this.makeCode(" finally {\n"), this.ensure.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab + "}")) : [];
|
||||
return [].concat(this.makeCode(this.tab + "try {\n"), tryPart, this.makeCode("\n" + this.tab + "}"), catchPart, ensurePart);
|
||||
}), [this.makeCode(` catch (${generatedErrorVariableName}) {}`)]) : [];
|
||||
ensurePart = this.ensure ? [].concat(this.makeCode(" finally {\n"), this.ensure.compileToFragments(o, LEVEL_TOP), this.makeCode(`\n${this.tab}}`)) : [];
|
||||
return [].concat(this.makeCode(`${this.tab}try {\n`), tryPart, this.makeCode(`\n${this.tab}}`), catchPart, ensurePart);
|
||||
};
|
||||
|
||||
return Try;
|
||||
@@ -3214,11 +3213,11 @@
|
||||
code = this.expression.compile(o, LEVEL_OP);
|
||||
if (this.expression.unwrap() instanceof IdentifierLiteral && !o.scope.check(code)) {
|
||||
ref3 = this.negated ? ['===', '||'] : ['!==', '&&'], cmp = ref3[0], cnj = ref3[1];
|
||||
code = "typeof " + code + " " + cmp + " \"undefined\" " + cnj + " " + code + " " + cmp + " null";
|
||||
code = `typeof ${code} ${cmp} \"undefined\" ${cnj} ${code} ${cmp} null`;
|
||||
} else {
|
||||
code = code + " " + (this.negated ? '==' : '!=') + " null";
|
||||
code = `${code} ${(this.negated ? '==' : '!=')} null`;
|
||||
}
|
||||
return [this.makeCode(o.level <= LEVEL_COND ? code : "(" + code + ")")];
|
||||
return [this.makeCode(o.level <= LEVEL_COND ? code : `(${code})`)];
|
||||
};
|
||||
|
||||
return Existence;
|
||||
@@ -3265,15 +3264,22 @@
|
||||
exports.StringWithInterpolations = StringWithInterpolations = (function(superClass1) {
|
||||
extend1(StringWithInterpolations, superClass1);
|
||||
|
||||
function StringWithInterpolations() {
|
||||
return StringWithInterpolations.__super__.constructor.apply(this, arguments);
|
||||
function StringWithInterpolations(body1) {
|
||||
this.body = body1;
|
||||
}
|
||||
|
||||
StringWithInterpolations.prototype.children = ['body'];
|
||||
|
||||
StringWithInterpolations.prototype.unwrap = function() {
|
||||
return this;
|
||||
};
|
||||
|
||||
StringWithInterpolations.prototype.isComplex = function() {
|
||||
return this.body.isComplex();
|
||||
};
|
||||
|
||||
StringWithInterpolations.prototype.compileNode = function(o) {
|
||||
var element, elements, expr, fragments, j, len1;
|
||||
if (!o.inTaggedTemplateCall) {
|
||||
return StringWithInterpolations.__super__.compileNode.call(this, ...arguments);
|
||||
}
|
||||
expr = this.body.unwrap();
|
||||
elements = [];
|
||||
expr.traverseChildren(false, function(node) {
|
||||
@@ -3304,7 +3310,7 @@
|
||||
|
||||
return StringWithInterpolations;
|
||||
|
||||
})(Parens);
|
||||
})(Base);
|
||||
|
||||
exports.For = For = (function(superClass1) {
|
||||
extend1(For, superClass1);
|
||||
@@ -3320,7 +3326,7 @@
|
||||
this.index.error('cannot use index with for-from');
|
||||
}
|
||||
if (this.own && !this.object) {
|
||||
source.ownTag.error("cannot use own with for-" + (this.from ? 'from' : 'in'));
|
||||
source.ownTag.error(`cannot use own with for-${(this.from ? 'from' : 'in')}`);
|
||||
}
|
||||
if (this.object) {
|
||||
ref3 = [this.index, this.name], this.name = ref3[0], this.index = ref3[1];
|
||||
@@ -3375,7 +3381,7 @@
|
||||
});
|
||||
}
|
||||
kvar = ((this.range || this.from) && name) || index || ivar;
|
||||
kvarAssign = kvar !== ivar ? kvar + " = " : "";
|
||||
kvarAssign = kvar !== ivar ? `${kvar} = ` : "";
|
||||
if (this.step && !this.range) {
|
||||
ref4 = this.cacheToCodeFragments(this.step.cache(o, LEVEL_LIST, isComplexOrAssignable)), step = ref4[0], stepVar = ref4[1];
|
||||
if (this.step.isNumber()) {
|
||||
@@ -3399,24 +3405,24 @@
|
||||
} else {
|
||||
svar = this.source.compile(o, LEVEL_LIST);
|
||||
if ((name || this.own) && !(this.source.unwrap() instanceof IdentifierLiteral)) {
|
||||
defPart += "" + this.tab + (ref = scope.freeVariable('ref')) + " = " + svar + ";\n";
|
||||
defPart += `${this.tab}${(ref = scope.freeVariable('ref'))} = ${svar};\n`;
|
||||
svar = ref;
|
||||
}
|
||||
if (name && !this.pattern && !this.from) {
|
||||
namePart = name + " = " + svar + "[" + kvar + "]";
|
||||
namePart = `${name} = ${svar}[${kvar}]`;
|
||||
}
|
||||
if (!this.object && !this.from) {
|
||||
if (step !== stepVar) {
|
||||
defPart += "" + this.tab + step + ";\n";
|
||||
defPart += `${this.tab}${step};\n`;
|
||||
}
|
||||
down = stepNum < 0;
|
||||
if (!(this.step && (stepNum != null) && down)) {
|
||||
lvar = scope.freeVariable('len');
|
||||
}
|
||||
declare = "" + kvarAssign + ivar + " = 0, " + lvar + " = " + svar + ".length";
|
||||
declareDown = "" + kvarAssign + ivar + " = " + svar + ".length - 1";
|
||||
compare = ivar + " < " + lvar;
|
||||
compareDown = ivar + " >= 0";
|
||||
declare = `${kvarAssign}${ivar} = 0, ${lvar} = ${svar}.length`;
|
||||
declareDown = `${kvarAssign}${ivar} = ${svar}.length - 1`;
|
||||
compare = `${ivar} < ${lvar}`;
|
||||
compareDown = `${ivar} >= 0`;
|
||||
if (this.step) {
|
||||
if (stepNum != null) {
|
||||
if (down) {
|
||||
@@ -3424,19 +3430,19 @@
|
||||
declare = declareDown;
|
||||
}
|
||||
} else {
|
||||
compare = stepVar + " > 0 ? " + compare + " : " + compareDown;
|
||||
declare = "(" + stepVar + " > 0 ? (" + declare + ") : " + declareDown + ")";
|
||||
compare = `${stepVar} > 0 ? ${compare} : ${compareDown}`;
|
||||
declare = `(${stepVar} > 0 ? (${declare}) : ${declareDown})`;
|
||||
}
|
||||
increment = ivar + " += " + stepVar;
|
||||
increment = `${ivar} += ${stepVar}`;
|
||||
} else {
|
||||
increment = "" + (kvar !== ivar ? "++" + ivar : ivar + "++");
|
||||
increment = `${(kvar !== ivar ? `++${ivar}` : `${ivar}++`)}`;
|
||||
}
|
||||
forPartFragments = [this.makeCode(declare + "; " + compare + "; " + kvarAssign + increment)];
|
||||
forPartFragments = [this.makeCode(`${declare}; ${compare}; ${kvarAssign}${increment}`)];
|
||||
}
|
||||
}
|
||||
if (this.returns) {
|
||||
resultPart = "" + this.tab + rvar + " = [];\n";
|
||||
returnResult = "\n" + this.tab + "return " + rvar + ";";
|
||||
resultPart = `${this.tab}${rvar} = [];\n`;
|
||||
returnResult = `\n${this.tab}return ${rvar};`;
|
||||
body.makeReturn(rvar);
|
||||
}
|
||||
if (this.guard) {
|
||||
@@ -3449,19 +3455,19 @@
|
||||
}
|
||||
}
|
||||
if (this.pattern) {
|
||||
body.expressions.unshift(new Assign(this.name, this.from ? new IdentifierLiteral(kvar) : new Literal(svar + "[" + kvar + "]")));
|
||||
body.expressions.unshift(new Assign(this.name, this.from ? new IdentifierLiteral(kvar) : new Literal(`${svar}[${kvar}]`)));
|
||||
}
|
||||
defPartFragments = [].concat(this.makeCode(defPart), this.pluckDirectCall(o, body));
|
||||
if (namePart) {
|
||||
varPart = "\n" + idt1 + namePart + ";";
|
||||
varPart = `\n${idt1}${namePart};`;
|
||||
}
|
||||
if (this.object) {
|
||||
forPartFragments = [this.makeCode(kvar + " in " + svar)];
|
||||
forPartFragments = [this.makeCode(`${kvar} in ${svar}`)];
|
||||
if (this.own) {
|
||||
guardPart = "\n" + idt1 + "if (!" + (utility('hasProp', o)) + ".call(" + svar + ", " + kvar + ")) continue;";
|
||||
guardPart = `\n${idt1}if (!${utility('hasProp', o)}.call(${svar}, ${kvar})) continue;`;
|
||||
}
|
||||
} else if (this.from) {
|
||||
forPartFragments = [this.makeCode(kvar + " of " + svar)];
|
||||
forPartFragments = [this.makeCode(`${kvar} of ${svar}`)];
|
||||
}
|
||||
bodyFragments = body.compileToFragments(merge(o, {
|
||||
indent: idt1
|
||||
@@ -3469,7 +3475,7 @@
|
||||
if (bodyFragments && bodyFragments.length > 0) {
|
||||
bodyFragments = [].concat(this.makeCode("\n"), bodyFragments, this.makeCode("\n"));
|
||||
}
|
||||
return [].concat(defPartFragments, this.makeCode("" + (resultPart || '') + this.tab + "for ("), forPartFragments, this.makeCode(") {" + guardPart + varPart), bodyFragments, this.makeCode(this.tab + "}" + (returnResult || '')));
|
||||
return [].concat(defPartFragments, this.makeCode(`${resultPart || ''}${this.tab}for (`), forPartFragments, this.makeCode(`) {${guardPart}${varPart}`), bodyFragments, this.makeCode(`${this.tab}}${returnResult || ''}`));
|
||||
};
|
||||
|
||||
For.prototype.pluckDirectCall = function(o, body) {
|
||||
@@ -3667,7 +3673,7 @@
|
||||
body = this.ensureBlock(this.body).compileToFragments(merge(o, {
|
||||
indent: indent
|
||||
}));
|
||||
ifPart = [].concat(this.makeCode("if ("), cond, this.makeCode(") {\n"), body, this.makeCode("\n" + this.tab + "}"));
|
||||
ifPart = [].concat(this.makeCode("if ("), cond, this.makeCode(") {\n"), body, this.makeCode(`\n${this.tab}}`));
|
||||
if (!child) {
|
||||
ifPart.unshift(this.makeCode(this.tab));
|
||||
}
|
||||
@@ -3681,7 +3687,7 @@
|
||||
} else {
|
||||
answer = answer.concat(this.makeCode("{\n"), this.elseBody.compileToFragments(merge(o, {
|
||||
indent: indent
|
||||
}), LEVEL_TOP), this.makeCode("\n" + this.tab + "}"));
|
||||
}), LEVEL_TOP), this.makeCode(`\n${this.tab}}`));
|
||||
}
|
||||
return answer;
|
||||
};
|
||||
@@ -3709,7 +3715,7 @@
|
||||
|
||||
UTILITIES = {
|
||||
extend: function(o) {
|
||||
return "function(child, parent) { for (var key in parent) { if (" + (utility('hasProp', o)) + ".call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }";
|
||||
return `function(child, parent) { for (var key in parent) { if (${utility('hasProp', o)}.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }`;
|
||||
},
|
||||
bind: function() {
|
||||
return 'function(fn, me){ return function(){ return fn.apply(me, arguments); }; }';
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
}
|
||||
}
|
||||
if (isOption && !matchedRule) {
|
||||
throw new Error("unrecognized option: " + arg);
|
||||
throw new Error(`unrecognized option: ${arg}`);
|
||||
}
|
||||
}
|
||||
if (seenNonOptionArg || !isOption) {
|
||||
@@ -62,7 +62,7 @@
|
||||
var j, len, letPart, lines, ref, rule, spaces;
|
||||
lines = [];
|
||||
if (this.banner) {
|
||||
lines.unshift(this.banner + "\n");
|
||||
lines.unshift(`${this.banner}\n`);
|
||||
}
|
||||
ref = this.rules;
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
@@ -72,7 +72,7 @@
|
||||
letPart = rule.shortFlag ? rule.shortFlag + ', ' : ' ';
|
||||
lines.push(' ' + letPart + rule.longFlag + spaces + rule.description);
|
||||
}
|
||||
return "\n" + (lines.join('\n')) + "\n";
|
||||
return `\n${lines.join('\n')}\n`;
|
||||
};
|
||||
|
||||
return OptionParser;
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
rli.removeListener('line', nodeLineListener);
|
||||
rli.on('line', function(cmd) {
|
||||
if (multiline.enabled) {
|
||||
multiline.buffer += cmd + "\n";
|
||||
multiline.buffer += `${cmd}\n`;
|
||||
rli.setPrompt(multiline.prompt);
|
||||
rli.prompt(true);
|
||||
} else {
|
||||
@@ -139,7 +139,7 @@
|
||||
fd = fs.openSync(filename, 'a');
|
||||
repl.rli.addListener('line', function(code) {
|
||||
if (code && code.length && code !== '.history' && code !== '.exit' && lastLine !== code) {
|
||||
fs.writeSync(fd, code + "\n");
|
||||
fs.writeSync(fd, `${code}\n`);
|
||||
return lastLine = code;
|
||||
}
|
||||
});
|
||||
@@ -149,7 +149,7 @@
|
||||
return repl.commands[getCommandId(repl, 'history')] = {
|
||||
help: 'Show command history',
|
||||
action: function() {
|
||||
repl.outputStream.write((repl.rli.history.slice(0).reverse().join('\n')) + "\n");
|
||||
repl.outputStream.write(`${repl.rli.history.slice(0).reverse().join('\n')}\n`);
|
||||
return repl.displayPrompt();
|
||||
}
|
||||
};
|
||||
@@ -159,7 +159,7 @@
|
||||
var commandsHaveLeadingDot;
|
||||
commandsHaveLeadingDot = repl.commands['.help'] != null;
|
||||
if (commandsHaveLeadingDot) {
|
||||
return "." + commandName;
|
||||
return `.${commandName}`;
|
||||
} else {
|
||||
return commandName;
|
||||
}
|
||||
|
||||
@@ -74,9 +74,9 @@
|
||||
newCode = startCode + index % (diff + 1);
|
||||
letter = String.fromCharCode(newCode);
|
||||
num = Math.floor(index / (diff + 1));
|
||||
return "" + letter + (num || '');
|
||||
return `${letter}${num || ''}`;
|
||||
} else {
|
||||
return "" + name + (index || '');
|
||||
return `${name}${index || ''}`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -143,7 +143,7 @@
|
||||
for (i = 0, len = ref.length; i < len; i++) {
|
||||
v = ref[i];
|
||||
if (v.type.assigned) {
|
||||
results.push(v.name + " = " + v.type.value);
|
||||
results.push(`${v.name} = ${v.type.value}`);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
|
||||
@@ -136,7 +136,7 @@
|
||||
|
||||
SourceMap.prototype.encodeBase64 = function(value) {
|
||||
return BASE64_CHARS[value] || (function() {
|
||||
throw new Error("Cannot Base64 encode value: " + value);
|
||||
throw new Error(`Cannot Base64 encode value: ${value}`);
|
||||
})();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user