unoverload Literal AST node
This commit is contained in:
@@ -26,7 +26,7 @@ export default function (opts) {
|
||||
} else if (esutils.keyword.isIdentifierNameES6(node.name)) {
|
||||
node.type = "Identifier";
|
||||
} else {
|
||||
return t.literal(node.name);
|
||||
return t.stringLiteral(node.name);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -70,7 +70,7 @@ export default function (opts) {
|
||||
},
|
||||
|
||||
exit(node) {
|
||||
var value = node.value || t.literal(true);
|
||||
var value = node.value || t.booleanLiteral(true);
|
||||
return t.inherits(t.property("init", node.name, value), node);
|
||||
}
|
||||
};
|
||||
@@ -107,7 +107,7 @@ export default function (opts) {
|
||||
if (attribs.length) {
|
||||
attribs = buildJSXOpeningElementAttributes(attribs, file);
|
||||
} else {
|
||||
attribs = t.literal(null);
|
||||
attribs = t.nullLiteral();
|
||||
}
|
||||
|
||||
args.push(attribs);
|
||||
|
||||
@@ -114,9 +114,9 @@ export function toClassObject(mutatorMap) {
|
||||
|
||||
export function toDefineObject(mutatorMap) {
|
||||
each(mutatorMap, function (map) {
|
||||
if (map.value) map.writable = t.literal(true);
|
||||
map.configurable = t.literal(true);
|
||||
map.enumerable = t.literal(true);
|
||||
if (map.value) map.writable = t.booleanLiteral(true);
|
||||
map.configurable = t.booleanLiteral(true);
|
||||
map.enumerable = t.booleanLiteral(true);
|
||||
});
|
||||
|
||||
return toClassObject(mutatorMap);
|
||||
|
||||
@@ -6,7 +6,7 @@ import * as t from "babel-types";
|
||||
*/
|
||||
|
||||
export function is(node, flag) {
|
||||
return t.isLiteral(node) && node.regex && node.regex.flags.indexOf(flag) >= 0;
|
||||
return t.isRegexLiteral(node) && node.flags.indexOf(flag) >= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14,8 +14,8 @@ export function is(node, flag) {
|
||||
*/
|
||||
|
||||
export function pullFlag(node, flag) {
|
||||
var flags = node.regex.flags.split("");
|
||||
if (node.regex.flags.indexOf(flag) < 0) return;
|
||||
var flags = node.flags.split("");
|
||||
if (node.flags.indexOf(flag) < 0) return;
|
||||
pull(flags, flag);
|
||||
node.regex.flags = flags.join("");
|
||||
node.flags = flags.join("");
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ export default class ReplaceSupers {
|
||||
this.isStatic ? this.getObjectRef() : t.memberExpression(this.getObjectRef(), t.identifier("prototype"))
|
||||
]
|
||||
),
|
||||
isComputed ? property : t.literal(property.name),
|
||||
isComputed ? property : t.stringLiteral(property.name),
|
||||
value,
|
||||
thisExpression
|
||||
]
|
||||
@@ -133,7 +133,7 @@ export default class ReplaceSupers {
|
||||
this.isStatic ? this.getObjectRef() : t.memberExpression(this.getObjectRef(), t.identifier("prototype"))
|
||||
]
|
||||
),
|
||||
isComputed ? property : t.literal(property.name),
|
||||
isComputed ? property : t.stringLiteral(property.name),
|
||||
thisExpression
|
||||
]
|
||||
);
|
||||
@@ -301,7 +301,7 @@ export default class ReplaceSupers {
|
||||
property = node.property;
|
||||
computed = node.computed;
|
||||
} else if (t.isUpdateExpression(node) && isMemberExpressionSuper(node.argument)) {
|
||||
var binary = t.binaryExpression(node.operator[0], node.argument, t.literal(1));
|
||||
var binary = t.binaryExpression(node.operator[0], node.argument, t.numberLiteral(1));
|
||||
if (node.prefix) {
|
||||
// ++super.foo; -> super.foo += 1;
|
||||
return this.specHandleAssignmentExpression(null, path, binary, getThisReference);
|
||||
|
||||
@@ -311,7 +311,7 @@ export default class DefaultFormatter {
|
||||
this.checkExportIdentifier(id);
|
||||
return util.template("exports-from-assign", {
|
||||
INIT: init,
|
||||
ID: t.literal(id.name)
|
||||
ID: t.stringLiteral(id.name)
|
||||
}, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ export default class AMDFormatter extends DefaultFormatter {
|
||||
buildDependencyLiterals() {
|
||||
var names = [];
|
||||
for (var name in this.ids) {
|
||||
names.push(t.literal(name));
|
||||
names.push(t.stringLiteral(name));
|
||||
}
|
||||
return names;
|
||||
}
|
||||
@@ -42,8 +42,8 @@ export default class AMDFormatter extends DefaultFormatter {
|
||||
|
||||
// build an array of module names
|
||||
|
||||
var names = [t.literal("exports")];
|
||||
if (this.passModuleArg) names.push(t.literal("module"));
|
||||
var names = [t.stringLiteral("exports")];
|
||||
if (this.passModuleArg) names.push(t.stringLiteral("module"));
|
||||
names = names.concat(this.buildDependencyLiterals());
|
||||
names = t.arrayExpression(names);
|
||||
|
||||
@@ -57,7 +57,7 @@ export default class AMDFormatter extends DefaultFormatter {
|
||||
|
||||
var defineArgs = [names, container];
|
||||
var moduleName = this.getModuleName();
|
||||
if (moduleName) defineArgs.unshift(t.literal(moduleName));
|
||||
if (moduleName) defineArgs.unshift(t.stringLiteral(moduleName));
|
||||
|
||||
var call = t.callExpression(t.identifier("define"), defineArgs);
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ var remapVisitor = {
|
||||
if (!scope.hasBinding(node.name) ||
|
||||
scope.bindingIdentifierEquals(node.name, formatter.localImports[node.name])) {
|
||||
if (!formatter.isLoose() && this.key === "callee" && this.parentPath.isCallExpression()) {
|
||||
return t.sequenceExpression([t.literal(0), remap]);
|
||||
return t.sequenceExpression([t.numberLiteral(0), remap]);
|
||||
} else {
|
||||
return remap;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ var remapVisitor = {
|
||||
this.skip();
|
||||
|
||||
// expand to long file assignment expression
|
||||
var assign = t.assignmentExpression(node.operator[0] + "=", node.argument, t.literal(1));
|
||||
var assign = t.assignmentExpression(node.operator[0] + "=", node.argument, t.numberLiteral(1));
|
||||
|
||||
// remap this assignment expression
|
||||
var remapped = formatter.remapExportAssignment(assign, exported);
|
||||
@@ -81,7 +81,7 @@ var remapVisitor = {
|
||||
} else { // "++"
|
||||
operator = "-";
|
||||
}
|
||||
nodes.push(t.binaryExpression(operator, node.argument, t.literal(1)));
|
||||
nodes.push(t.binaryExpression(operator, node.argument, t.numberLiteral(1)));
|
||||
|
||||
return t.sequenceExpression(nodes);
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ export default class SystemFormatter extends AMDFormatter {
|
||||
|
||||
var block = t.blockStatement([
|
||||
t.ifStatement(
|
||||
t.binaryExpression("!==", leftIdentifier, t.literal("default")),
|
||||
t.binaryExpression("!==", leftIdentifier, t.stringLiteral("default")),
|
||||
t.expressionStatement(this._buildExportCall(leftIdentifier, valIdentifier))
|
||||
)
|
||||
]);
|
||||
@@ -162,7 +162,7 @@ export default class SystemFormatter extends AMDFormatter {
|
||||
*/
|
||||
|
||||
buildExportsAssignment(id, init, node) {
|
||||
var call = this._buildExportCall(t.literal(id.name), init, true);
|
||||
var call = this._buildExportCall(t.stringLiteral(id.name), init, true);
|
||||
return this._addImportSource(call, node);
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ export default class SystemFormatter extends AMDFormatter {
|
||||
var assign = node;
|
||||
|
||||
for (var i = 0; i < exported.length; i++) {
|
||||
assign = this._buildExportCall(t.literal(exported[i].name), assign);
|
||||
assign = this._buildExportCall(t.stringLiteral(exported[i].name), assign);
|
||||
}
|
||||
|
||||
return assign;
|
||||
@@ -256,7 +256,7 @@ export default class SystemFormatter extends AMDFormatter {
|
||||
|
||||
var hoistDeclarators = [];
|
||||
var moduleName = this.getModuleName();
|
||||
var moduleNameLiteral = t.literal(moduleName);
|
||||
var moduleNameLiteral = t.stringLiteral(moduleName);
|
||||
|
||||
var block = t.blockStatement(program.body);
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ export default class UMDFormatter extends AMDFormatter {
|
||||
|
||||
var names = [];
|
||||
for (let name in this.ids) {
|
||||
names.push(t.literal(name));
|
||||
names.push(t.stringLiteral(name));
|
||||
}
|
||||
|
||||
// factory
|
||||
@@ -38,8 +38,8 @@ export default class UMDFormatter extends AMDFormatter {
|
||||
|
||||
// amd
|
||||
|
||||
var defineArgs = [t.literal("exports")];
|
||||
if (this.passModuleArg) defineArgs.push(t.literal("module"));
|
||||
var defineArgs = [t.stringLiteral("exports")];
|
||||
if (this.passModuleArg) defineArgs.push(t.stringLiteral("module"));
|
||||
defineArgs = defineArgs.concat(names);
|
||||
defineArgs = [t.arrayExpression(defineArgs)];
|
||||
|
||||
@@ -68,7 +68,7 @@ export default class UMDFormatter extends AMDFormatter {
|
||||
//
|
||||
|
||||
var moduleName = this.getModuleName();
|
||||
if (moduleName) defineArgs.unshift(t.literal(moduleName));
|
||||
if (moduleName) defineArgs.unshift(t.stringLiteral(moduleName));
|
||||
|
||||
//
|
||||
var globalArg = this.file.opts.basename;
|
||||
|
||||
@@ -34,7 +34,7 @@ export var visitor = {
|
||||
var prop = node.property;
|
||||
if (!node.computed && t.isIdentifier(prop) && !t.isValidIdentifier(prop.name)) {
|
||||
// foo.default -> foo["default"]
|
||||
node.property = t.literal(prop.name);
|
||||
node.property = t.stringLiteral(prop.name);
|
||||
node.computed = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ var loopVisitor = {
|
||||
|
||||
state.hasBreakContinue = true;
|
||||
state.map[loopText] = node;
|
||||
replace = t.literal(loopText);
|
||||
replace = t.stringLiteral(loopText);
|
||||
}
|
||||
|
||||
if (this.isReturnStatement()) {
|
||||
@@ -733,7 +733,7 @@ class BlockScoping {
|
||||
|
||||
if (has.hasBreakContinue) {
|
||||
for (var key in has.map) {
|
||||
cases.push(t.switchCase(t.literal(key), [has.map[key]]));
|
||||
cases.push(t.switchCase(t.stringLiteral(key), [has.map[key]]));
|
||||
}
|
||||
|
||||
if (has.hasReturn) {
|
||||
|
||||
@@ -23,7 +23,7 @@ function getTDZStatus(refPath, bindingPath) {
|
||||
function buildTDZAssert(node, file) {
|
||||
return t.callExpression(
|
||||
file.addHelper("temporal-assert-defined"),
|
||||
[node, t.literal(node.name), file.addHelper("temporal-undefined")]
|
||||
[node, t.stringLiteral(node.name), file.addHelper("temporal-undefined")]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -69,9 +69,12 @@ export var visitor = {
|
||||
return t.logicalExpression("&&", assert, node);
|
||||
}
|
||||
} else if (status === "outside") {
|
||||
return t.throwStatement(t.newExpression(t.identifier("ReferenceError"), [
|
||||
t.literal(`${node.name} is not defined - temporal dead zone`)
|
||||
]));
|
||||
return t.throwStatement(t.inherits(
|
||||
t.newExpression(t.identifier("ReferenceError"), [
|
||||
t.stringLiteral(`${node.name} is not defined - temporal dead zone`)
|
||||
]),
|
||||
node
|
||||
));
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -248,7 +248,7 @@ export default class ClassTransformer {
|
||||
var map = defineMap.push(mutatorMap, node, kind, this.file);
|
||||
|
||||
if (enumerable) {
|
||||
map.enumerable = t.literal(true);
|
||||
map.enumerable = t.booleanLiteral(true);
|
||||
}
|
||||
|
||||
if (map.decorators) {
|
||||
@@ -383,7 +383,7 @@ export default class ClassTransformer {
|
||||
if (instanceProps) instanceProps = defineMap.toComputedObjectFromClass(instanceProps);
|
||||
if (staticProps) staticProps = defineMap.toComputedObjectFromClass(staticProps);
|
||||
|
||||
var nullNode = t.literal(null);
|
||||
var nullNode = t.nullLiteral();
|
||||
|
||||
// (Constructor, instanceDescriptors, staticDescriptors, instanceInitializers, staticInitializers)
|
||||
var args = [this.classRef, nullNode, nullNode, nullNode, nullNode];
|
||||
@@ -545,7 +545,7 @@ export default class ClassTransformer {
|
||||
body.push(t.returnStatement(node.value));
|
||||
node.value = t.functionExpression(null, [], t.blockStatement(body));
|
||||
} else {
|
||||
node.value = t.literal(null);
|
||||
node.value = t.nullLiteral();
|
||||
}
|
||||
this.pushToMap(node, true, "initializer");
|
||||
|
||||
|
||||
@@ -414,7 +414,7 @@ class DestructuringTransformer {
|
||||
if (t.isSpreadProperty(prop)) continue;
|
||||
|
||||
var key = prop.key;
|
||||
if (t.isIdentifier(key) && !prop.computed) key = t.literal(prop.key.name);
|
||||
if (t.isIdentifier(key) && !prop.computed) key = t.stringLiteral(prop.key.name);
|
||||
keys.push(key);
|
||||
}
|
||||
|
||||
@@ -579,14 +579,14 @@ class DestructuringTransformer {
|
||||
elemRef = this.toArray(arrayRef);
|
||||
|
||||
if (i > 0) {
|
||||
elemRef = t.callExpression(t.memberExpression(elemRef, t.identifier("slice")), [t.literal(i)]);
|
||||
elemRef = t.callExpression(t.memberExpression(elemRef, t.identifier("slice")), [t.numberLiteral(i)]);
|
||||
}
|
||||
|
||||
// set the element to the rest element argument since we've dealt with it
|
||||
// being a rest already
|
||||
elem = elem.argument;
|
||||
} else {
|
||||
elemRef = t.memberExpression(arrayRef, t.literal(i), true);
|
||||
elemRef = t.memberExpression(arrayRef, t.numberLiteral(i), true);
|
||||
}
|
||||
|
||||
this.push(elem, elemRef);
|
||||
|
||||
@@ -3,14 +3,16 @@ export var metadata = {
|
||||
};
|
||||
|
||||
export var visitor = {
|
||||
Literal(node) {
|
||||
NumberLiteral(node) {
|
||||
// number octal like 0b10 or 0o70
|
||||
if (typeof node.value === "number" && /^0[ob]/i.test(node.raw)) {
|
||||
if (/^0[ob]/i.test(node.raw)) {
|
||||
node.raw = undefined;
|
||||
}
|
||||
},
|
||||
|
||||
StringLiteral(node) {
|
||||
// unicode escape
|
||||
if (typeof node.value === "string" && /\\[u]/gi.test(node.raw)) {
|
||||
if (/\\[u]/gi.test(node.raw)) {
|
||||
node.raw = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ export var visitor = {
|
||||
defNode = util.template("default-parameter", {
|
||||
VARIABLE_NAME: left,
|
||||
DEFAULT_VALUE: right,
|
||||
ARGUMENT_KEY: t.literal(i),
|
||||
ARGUMENT_KEY: t.numberLiteral(i),
|
||||
ARGUMENTS: argsIdentifier
|
||||
}, true);
|
||||
} else {
|
||||
|
||||
@@ -107,7 +107,7 @@ function optimiseMemberExpression(parent, offset) {
|
||||
prop.value += offset;
|
||||
prop.raw = String(prop.value);
|
||||
} else { // // UnaryExpression, BinaryExpression
|
||||
newExpr = t.binaryExpression("+", prop, t.literal(offset));
|
||||
newExpr = t.binaryExpression("+", prop, t.numberLiteral(offset));
|
||||
parent.property = newExpr;
|
||||
}
|
||||
}
|
||||
@@ -147,7 +147,7 @@ export var visitor = {
|
||||
rest = scope.generateUidIdentifier("ref");
|
||||
|
||||
var declar = t.variableDeclaration("let", pattern.elements.map(function (elem, index) {
|
||||
var accessExpr = t.memberExpression(rest, t.literal(index), true);
|
||||
var accessExpr = t.memberExpression(rest, t.numberLiteral(index), true);
|
||||
return t.variableDeclarator(elem, accessExpr);
|
||||
}));
|
||||
node.body.body.unshift(declar);
|
||||
@@ -193,7 +193,7 @@ export var visitor = {
|
||||
|
||||
//
|
||||
|
||||
var start = t.literal(node.params.length);
|
||||
var start = t.numberLiteral(node.params.length);
|
||||
var key = scope.generateUidIdentifier("key");
|
||||
var len = scope.generateUidIdentifier("len");
|
||||
|
||||
@@ -214,7 +214,7 @@ export var visitor = {
|
||||
arrLen = t.conditionalExpression(
|
||||
t.binaryExpression(">", len, start),
|
||||
t.binaryExpression("-", len, start),
|
||||
t.literal(0)
|
||||
t.numberLiteral(0)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ function spec(node, body, objId, initProps, file) {
|
||||
|
||||
let key = prop.key;
|
||||
if (t.isIdentifier(key) && !prop.computed) {
|
||||
key = t.literal(key.name);
|
||||
key = t.stringLiteral(key.name);
|
||||
}
|
||||
|
||||
var bodyNode = t.callExpression(file.addHelper("define-property"), [objId, key, prop.value]);
|
||||
|
||||
@@ -11,11 +11,11 @@ export var visitor = {
|
||||
* [Please add a description.]
|
||||
*/
|
||||
|
||||
Literal(node) {
|
||||
RegexLiteral(node) {
|
||||
if (!regex.is(node, "y")) return;
|
||||
return t.newExpression(t.identifier("RegExp"), [
|
||||
t.literal(node.regex.pattern),
|
||||
t.literal(node.regex.flags)
|
||||
t.stringLiteral(node.pattern),
|
||||
t.stringLiteral(node.flags)
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,9 +11,9 @@ export var visitor = {
|
||||
* [Please add a description.]
|
||||
*/
|
||||
|
||||
Literal(node) {
|
||||
RegexLiteral(node) {
|
||||
if (!regex.is(node, "u")) return;
|
||||
node.regex.pattern = rewritePattern(node.regex.pattern, node.regex.flags);
|
||||
node.regex.pattern = rewritePattern(node.pattern, node.flags);
|
||||
regex.pullFlag(node, "u");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ export var visitor = {
|
||||
var id = this.scope.generateUidIdentifier("null");
|
||||
this.unshiftContainer("body", [
|
||||
t.variableDeclaration("var", [
|
||||
t.variableDeclarator(id, t.literal(null))
|
||||
t.variableDeclarator(id, t.nullLiteral())
|
||||
]),
|
||||
t.exportNamedDeclaration(null, [
|
||||
t.exportSpecifier(id, t.identifier("__proto__"))
|
||||
|
||||
@@ -26,7 +26,7 @@ export var visitor = {
|
||||
if (node.operator === "typeof") {
|
||||
var call = t.callExpression(file.addHelper("typeof"), [node.argument]);
|
||||
if (this.get("argument").isIdentifier()) {
|
||||
var undefLiteral = t.literal("undefined");
|
||||
var undefLiteral = t.stringLiteral("undefined");
|
||||
var unary = t.unaryExpression("typeof", node.argument);
|
||||
unary._ignoreSpecSymbols = true;
|
||||
return t.conditionalExpression(
|
||||
|
||||
@@ -138,7 +138,7 @@ export var visitor = {
|
||||
|
||||
var nodes = build(args, scope);
|
||||
|
||||
var context = t.arrayExpression([t.literal(null)]);
|
||||
var context = t.arrayExpression([t.nullLiteral()]);
|
||||
|
||||
args = t.callExpression(t.memberExpression(context, t.identifier("concat")), nodes);
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ class TailCallTransformer {
|
||||
}
|
||||
|
||||
body.unshift(t.expressionStatement(
|
||||
t.assignmentExpression("=", this.getAgainId(), t.literal(false)))
|
||||
t.assignmentExpression("=", this.getAgainId(), t.booleanLiteral(false)))
|
||||
);
|
||||
|
||||
node.body = util.template("tail-call-body", {
|
||||
@@ -482,14 +482,14 @@ class TailCallTransformer {
|
||||
body.push(t.expressionStatement(t.assignmentExpression(
|
||||
"=",
|
||||
param,
|
||||
t.memberExpression(argumentsId, t.literal(i), true)
|
||||
t.memberExpression(argumentsId, t.numberLiteral(i), true)
|
||||
)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
body.push(t.expressionStatement(
|
||||
t.assignmentExpression("=", this.getAgainId(), t.literal(true))
|
||||
t.assignmentExpression("=", this.getAgainId(), t.booleanLiteral(true))
|
||||
));
|
||||
|
||||
body.push(t.continueStatement(this.getFunctionId()));
|
||||
|
||||
@@ -7,8 +7,6 @@ export var metadata = {
|
||||
stage: 2
|
||||
};
|
||||
|
||||
var MATH_POW = t.memberExpression(t.identifier("Math"), t.identifier("pow"));
|
||||
|
||||
/**
|
||||
* [Please add a description.]
|
||||
*/
|
||||
@@ -21,6 +19,6 @@ export var visitor = build({
|
||||
*/
|
||||
|
||||
build(left, right) {
|
||||
return t.callExpression(MATH_POW, [left, right]);
|
||||
return t.callExpression(t.memberExpression(t.identifier("Math"), t.identifier("pow")), [left, right]);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -44,11 +44,11 @@ export var visitor = {
|
||||
var isComponent = true;
|
||||
var props = t.objectExpression([]);
|
||||
var obj = t.objectExpression([]);
|
||||
var key = t.literal(null);
|
||||
var key = t.nullLiteral();
|
||||
var type = open.name;
|
||||
|
||||
if (t.isJSXIdentifier(type) && react.isCompatTag(type.name)) {
|
||||
type = t.literal(type.name);
|
||||
type = t.stringLiteral(type.name);
|
||||
isComponent = false;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ export var visitor = {
|
||||
|
||||
// metadata
|
||||
pushElemProp("type", type);
|
||||
pushElemProp("ref", t.literal(null));
|
||||
pushElemProp("ref", t.nullLiteral());
|
||||
|
||||
if (node.children.length) {
|
||||
var children = react.buildChildren(node);
|
||||
|
||||
@@ -25,7 +25,7 @@ export var visitor = require("../../helpers/build-react-transformer")({
|
||||
var tagName = state.tagName;
|
||||
var args = state.args;
|
||||
if (react.isCompatTag(tagName)) {
|
||||
args.push(t.literal(tagName));
|
||||
args.push(t.stringLiteral(tagName));
|
||||
} else {
|
||||
args.push(state.tagExpr);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ export var visitor = {
|
||||
if (t.isExpressionStatement(first) && isUseStrict(first.expression)) {
|
||||
directive = first;
|
||||
} else {
|
||||
directive = t.expressionStatement(t.literal("use strict"));
|
||||
directive = t.expressionStatement(t.stringLiteral("use strict"));
|
||||
this.unshiftContainer("body", directive);
|
||||
if (first) {
|
||||
directive.leadingComments = first.leadingComments;
|
||||
|
||||
@@ -125,50 +125,25 @@ export function ArrayExpression(node, print) {
|
||||
|
||||
export { ArrayExpression as ArrayPattern };
|
||||
|
||||
/**
|
||||
* Prints Literal, prints value, regex, raw, handles val type.
|
||||
*/
|
||||
|
||||
export function Literal(node) {
|
||||
this.push(""); // hack: catch up indentation
|
||||
this._push(this._Literal(node));
|
||||
export function RegexLiteral(node) {
|
||||
this.push(`/${node.pattern}/${node.flags}`);
|
||||
}
|
||||
|
||||
export function _Literal(node) {
|
||||
var val = node.value;
|
||||
|
||||
if (node.regex) {
|
||||
return `/${node.regex.pattern}/${node.regex.flags}`;
|
||||
}
|
||||
|
||||
// just use the raw property if our current value is equivalent to the one we got
|
||||
// when we populated raw
|
||||
if (node.raw != null && node.rawValue != null && val === node.rawValue) {
|
||||
return node.raw;
|
||||
}
|
||||
|
||||
switch (typeof val) {
|
||||
case "string":
|
||||
return this._stringLiteral(val);
|
||||
|
||||
case "number":
|
||||
return val + "";
|
||||
|
||||
case "boolean":
|
||||
return val ? "true" : "false";
|
||||
|
||||
default:
|
||||
if (val === null) {
|
||||
return "null";
|
||||
} else {
|
||||
throw new Error("Invalid Literal type");
|
||||
}
|
||||
}
|
||||
export function BooleanLiteral(node) {
|
||||
this.push(node.value ? "true" : "false");
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints string literals, handles format.
|
||||
*/
|
||||
export function NullLiteral() {
|
||||
this.push("null");
|
||||
}
|
||||
|
||||
export function NumberLiteral(node) {
|
||||
this.push(node.value + "");
|
||||
}
|
||||
|
||||
export function StringLiteral(node) {
|
||||
this.push(this._stringLiteral(node.value));
|
||||
}
|
||||
|
||||
export function _stringLiteral(val) {
|
||||
val = JSON.stringify(val);
|
||||
|
||||
@@ -12,7 +12,7 @@ import * as t from "./index";
|
||||
|
||||
export function toComputedKey(node: Object, key: Object = node.key || node.property): Object {
|
||||
if (!node.computed) {
|
||||
if (t.isIdentifier(key)) key = t.literal(key.name);
|
||||
if (t.isIdentifier(key)) key = t.stringLiteral(key.name);
|
||||
}
|
||||
return key;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ export function toKeyAlias(node: Object, key: Object = node.key) {
|
||||
return toKeyAlias.uid++;
|
||||
} else if (t.isIdentifier(key)) {
|
||||
alias = key.name;
|
||||
} else if (t.isLiteral(key)) {
|
||||
} else if (t.isStringLiteral(key)) {
|
||||
alias = JSON.stringify(key.value);
|
||||
} else {
|
||||
alias = JSON.stringify(traverse.removeProperties(t.cloneDeep(key)));
|
||||
@@ -264,9 +264,31 @@ export function valueToNode(value: any): Object {
|
||||
return t.identifier("undefined");
|
||||
}
|
||||
|
||||
// null, booleans, strings, numbers, regexs
|
||||
if (value === true || value === false || value === null || isString(value) || isNumber(value) || isRegExp(value)) {
|
||||
return t.literal(value);
|
||||
// boolean
|
||||
if (value === true || value === false) {
|
||||
return t.booleanLiteral(value);
|
||||
}
|
||||
|
||||
// null
|
||||
if (value === null) {
|
||||
return t.nullLiteral();
|
||||
}
|
||||
|
||||
// strings
|
||||
if (isString(value)) {
|
||||
return t.stringLiteral(value);
|
||||
}
|
||||
|
||||
// numbers
|
||||
if (isNumber(value)) {
|
||||
return t.numberLiteral(value);
|
||||
}
|
||||
|
||||
// regexes
|
||||
if (isRegExp(value)) {
|
||||
var pattern = value.source;
|
||||
var flags = value.toString().match(/\/([a-z]+|)$/)[1];
|
||||
return t.regexLiteral(pattern, flags);
|
||||
}
|
||||
|
||||
// array
|
||||
|
||||
@@ -32,9 +32,17 @@ pp.checkPropClash = function (prop, propHash) {
|
||||
|
||||
let key = prop.key, name;
|
||||
switch (key.type) {
|
||||
case "Identifier": name = key.name; break;
|
||||
case "Literal": name = String(key.value); break;
|
||||
default: return;
|
||||
case "Identifier":
|
||||
name = key.name;
|
||||
break;
|
||||
|
||||
case "StringLiteral":
|
||||
case "NumberLiteral":
|
||||
name = String(key.value);
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
let kind = prop.kind;
|
||||
@@ -377,19 +385,28 @@ pp.parseExprAtom = function (refShorthandDefaultPos) {
|
||||
|
||||
case tt.regexp:
|
||||
let value = this.state.value;
|
||||
node = this.parseLiteral(value.value);
|
||||
node.regex = {pattern: value.pattern, flags: value.flags};
|
||||
node = this.parseLiteral(value.value, "RegexLiteral");
|
||||
node.pattern = value.pattern;
|
||||
node.flags = value.flags;
|
||||
return node;
|
||||
|
||||
case tt.num: case tt.string:
|
||||
return this.parseLiteral(this.state.value);
|
||||
case tt.num:
|
||||
return this.parseLiteral(this.state.value, "NumberLiteral");
|
||||
|
||||
case tt._null: case tt._true: case tt._false:
|
||||
case tt.string:
|
||||
return this.parseLiteral(this.state.value, "StringLiteral");
|
||||
|
||||
case tt._null:
|
||||
node = this.startNode();
|
||||
node.rawValue = node.value = this.match(tt._null) ? null : this.match(tt._true);
|
||||
this.next();
|
||||
return this.finishNode(node, "NullLiteral");
|
||||
|
||||
case tt._true: case tt._false:
|
||||
node = this.startNode();
|
||||
node.rawValue = node.value = this.match(tt._true);
|
||||
node.raw = this.state.type.keyword;
|
||||
this.next();
|
||||
return this.finishNode(node, "Literal");
|
||||
return this.finishNode(node, "BooleanLiteral");
|
||||
|
||||
case tt.parenL:
|
||||
return this.parseParenAndDistinguishExpression(null, null, canBeArrow);
|
||||
@@ -443,12 +460,12 @@ pp.parseExprAtom = function (refShorthandDefaultPos) {
|
||||
}
|
||||
};
|
||||
|
||||
pp.parseLiteral = function (value) {
|
||||
pp.parseLiteral = function (value, type) {
|
||||
let node = this.startNode();
|
||||
node.rawValue = node.value = value;
|
||||
node.raw = this.input.slice(this.state.start, this.state.end);
|
||||
this.next();
|
||||
return this.finishNode(node, "Literal");
|
||||
return this.finishNode(node, type);
|
||||
};
|
||||
|
||||
pp.parseParenExpression = function () {
|
||||
|
||||
@@ -565,7 +565,7 @@ pp.parseClass = function (node, isStatement, optionalId) {
|
||||
key = this.parsePropertyName(method);
|
||||
}
|
||||
if (!method.static && (key.type === "Identifier" && key.name === "constructor" ||
|
||||
key.type === "Literal" && key.value === "constructor")) {
|
||||
key.type === "StringLiteral" && key.value === "constructor")) {
|
||||
if (hadConstructor) this.raise(key.start, "Duplicate constructor in the same class");
|
||||
if (isGetSet) this.raise(key.start, "Constructor can't have get/set modifier");
|
||||
if (isGenerator) this.raise(key.start, "Constructor can't be a generator");
|
||||
|
||||
@@ -9,7 +9,7 @@ const pp = Parser.prototype;
|
||||
// Test whether a statement node is the string literal `"use strict"`.
|
||||
|
||||
pp.isUseStrict = function (stmt) {
|
||||
return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && stmt.expression.raw.slice(1, -1) === "use strict";
|
||||
return stmt.type === "ExpressionStatement" && stmt.expression.type === "StringLiteral" && stmt.expression.raw.slice(1, -1) === "use strict";
|
||||
};
|
||||
|
||||
// TODO
|
||||
|
||||
@@ -382,7 +382,7 @@ export default function(instance) {
|
||||
instance.extend("parseExprAtom", function(inner) {
|
||||
return function(refShortHandDefaultPos) {
|
||||
if (this.match(tt.jsxText)) {
|
||||
var node = this.parseLiteral(this.state.value);
|
||||
var node = this.parseLiteral(this.state.value, "JSXText");
|
||||
// https://github.com/babel/babel/issues/2078
|
||||
node.rawValue = null;
|
||||
return node;
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
}
|
||||
},
|
||||
"argument": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 42,
|
||||
"end": 44,
|
||||
"loc": {
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"type": "Literal",
|
||||
"type": "BooleanLiteral",
|
||||
"start": 37,
|
||||
"end": 41,
|
||||
"loc": {
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
},
|
||||
"consequent": [],
|
||||
"test": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 66,
|
||||
"end": 67,
|
||||
"loc": {
|
||||
@@ -267,7 +267,7 @@
|
||||
}
|
||||
],
|
||||
"test": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 111,
|
||||
"end": 112,
|
||||
"loc": {
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
},
|
||||
"consequent": [],
|
||||
"test": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 34,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
@@ -202,7 +202,7 @@
|
||||
}
|
||||
],
|
||||
"test": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 71,
|
||||
"end": 72,
|
||||
"loc": {
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
}
|
||||
],
|
||||
"test": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 48,
|
||||
"end": 49,
|
||||
"loc": {
|
||||
@@ -210,7 +210,7 @@
|
||||
}
|
||||
],
|
||||
"test": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 83,
|
||||
"end": 84,
|
||||
"loc": {
|
||||
|
||||
@@ -501,7 +501,7 @@
|
||||
},
|
||||
"operator": "-",
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 215,
|
||||
"end": 216,
|
||||
"loc": {
|
||||
@@ -527,7 +527,7 @@
|
||||
}
|
||||
],
|
||||
"test": {
|
||||
"type": "Literal",
|
||||
"type": "StringLiteral",
|
||||
"start": 116,
|
||||
"end": 136,
|
||||
"loc": {
|
||||
@@ -584,7 +584,7 @@
|
||||
}
|
||||
},
|
||||
"argument": {
|
||||
"type": "Literal",
|
||||
"type": "BooleanLiteral",
|
||||
"start": 271,
|
||||
"end": 276,
|
||||
"loc": {
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
}
|
||||
],
|
||||
"test": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 22,
|
||||
"end": 23,
|
||||
"loc": {
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"type": "Literal",
|
||||
"type": "BooleanLiteral",
|
||||
"start": 4,
|
||||
"end": 8,
|
||||
"loc": {
|
||||
@@ -93,7 +93,7 @@
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "Literal",
|
||||
"type": "RegexLiteral",
|
||||
"start": 15,
|
||||
"end": 20,
|
||||
"loc": {
|
||||
@@ -107,10 +107,8 @@
|
||||
}
|
||||
},
|
||||
"raw": "/foo/",
|
||||
"regex": {
|
||||
"pattern": "foo",
|
||||
"flags": ""
|
||||
}
|
||||
"pattern": "foo",
|
||||
"flags": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 6,
|
||||
"end": 8,
|
||||
"loc": {
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "Literal",
|
||||
"type": "StringLiteral",
|
||||
"start": 0,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "Literal",
|
||||
"type": "StringLiteral",
|
||||
"start": 0,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"init": {
|
||||
"type": "Literal",
|
||||
"type": "RegexLiteral",
|
||||
"start": 8,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
@@ -88,10 +88,8 @@
|
||||
}
|
||||
},
|
||||
"raw": "/[a-z]/i",
|
||||
"regex": {
|
||||
"pattern": "[a-z]",
|
||||
"flags": "i"
|
||||
}
|
||||
"pattern": "[a-z]",
|
||||
"flags": "i"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -99,4 +97,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"init": {
|
||||
"type": "Literal",
|
||||
"type": "RegexLiteral",
|
||||
"start": 8,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
@@ -88,10 +88,8 @@
|
||||
}
|
||||
},
|
||||
"raw": "/[x-z]/i",
|
||||
"regex": {
|
||||
"pattern": "[x-z]",
|
||||
"flags": "i"
|
||||
}
|
||||
"pattern": "[x-z]",
|
||||
"flags": "i"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -99,4 +97,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"init": {
|
||||
"type": "Literal",
|
||||
"type": "RegexLiteral",
|
||||
"start": 8,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
@@ -88,10 +88,8 @@
|
||||
}
|
||||
},
|
||||
"raw": "/[a-c]/i",
|
||||
"regex": {
|
||||
"pattern": "[a-c]",
|
||||
"flags": "i"
|
||||
}
|
||||
"pattern": "[a-c]",
|
||||
"flags": "i"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -99,4 +97,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"init": {
|
||||
"type": "Literal",
|
||||
"type": "RegexLiteral",
|
||||
"start": 8,
|
||||
"end": 17,
|
||||
"loc": {
|
||||
@@ -88,10 +88,8 @@
|
||||
}
|
||||
},
|
||||
"raw": "/[P QR]/i",
|
||||
"regex": {
|
||||
"pattern": "[P QR]",
|
||||
"flags": "i"
|
||||
}
|
||||
"pattern": "[P QR]",
|
||||
"flags": "i"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -99,4 +97,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"init": {
|
||||
"type": "Literal",
|
||||
"type": "RegexLiteral",
|
||||
"start": 8,
|
||||
"end": 18,
|
||||
"loc": {
|
||||
@@ -88,10 +88,8 @@
|
||||
}
|
||||
},
|
||||
"raw": "/foo\\/bar/",
|
||||
"regex": {
|
||||
"pattern": "foo\\/bar",
|
||||
"flags": ""
|
||||
}
|
||||
"pattern": "foo\\/bar",
|
||||
"flags": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -99,4 +97,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"init": {
|
||||
"type": "Literal",
|
||||
"type": "RegexLiteral",
|
||||
"start": 8,
|
||||
"end": 21,
|
||||
"loc": {
|
||||
@@ -88,10 +88,8 @@
|
||||
}
|
||||
},
|
||||
"raw": "/=([^=\\s])+/g",
|
||||
"regex": {
|
||||
"pattern": "=([^=\\s])+",
|
||||
"flags": "g"
|
||||
}
|
||||
"pattern": "=([^=\\s])+",
|
||||
"flags": "g"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -99,4 +97,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"init": {
|
||||
"type": "Literal",
|
||||
"type": "RegexLiteral",
|
||||
"start": 8,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
@@ -88,10 +88,8 @@
|
||||
}
|
||||
},
|
||||
"raw": "/[P QR]/\\u0067",
|
||||
"regex": {
|
||||
"pattern": "[P QR]",
|
||||
"flags": "g"
|
||||
}
|
||||
"pattern": "[P QR]",
|
||||
"flags": "g"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -99,4 +97,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,7 @@
|
||||
null,
|
||||
null,
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 9,
|
||||
"end": 11,
|
||||
"loc": {
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 6,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
@@ -107,7 +107,7 @@
|
||||
"raw": "1"
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 9,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
@@ -125,7 +125,7 @@
|
||||
"raw": "2"
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 12,
|
||||
"end": 13,
|
||||
"loc": {
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
"name": "universe"
|
||||
},
|
||||
"property": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 9,
|
||||
"end": 11,
|
||||
"loc": {
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 9,
|
||||
"end": 11,
|
||||
"loc": {
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 9,
|
||||
"end": 11,
|
||||
"loc": {
|
||||
@@ -155,7 +155,7 @@
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 22,
|
||||
"end": 24,
|
||||
"loc": {
|
||||
@@ -173,7 +173,7 @@
|
||||
"raw": "14"
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 26,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
@@ -191,7 +191,7 @@
|
||||
"raw": "3"
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 29,
|
||||
"end": 31,
|
||||
"loc": {
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 40,
|
||||
"end": 44,
|
||||
"loc": {
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 6,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
@@ -107,7 +107,7 @@
|
||||
"raw": "1"
|
||||
},
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 9,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
@@ -126,7 +126,7 @@
|
||||
},
|
||||
null,
|
||||
{
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 13,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
"name": "y"
|
||||
},
|
||||
"consequent": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 4,
|
||||
"end": 5,
|
||||
"loc": {
|
||||
@@ -91,7 +91,7 @@
|
||||
"raw": "1"
|
||||
},
|
||||
"alternate": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 8,
|
||||
"end": 9,
|
||||
"loc": {
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
}
|
||||
},
|
||||
"consequent": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 9,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
@@ -123,7 +123,7 @@
|
||||
"raw": "1"
|
||||
},
|
||||
"alternate": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 13,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 4,
|
||||
"end": 6,
|
||||
"loc": {
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "Literal",
|
||||
"type": "NullLiteral",
|
||||
"start": 0,
|
||||
"end": 4,
|
||||
"loc": {
|
||||
@@ -55,10 +55,7 @@
|
||||
"line": 1,
|
||||
"column": 4
|
||||
}
|
||||
},
|
||||
"value": null,
|
||||
"rawValue": null,
|
||||
"raw": "null"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "eval"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 7,
|
||||
"end": 9,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "arguments"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 12,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 5,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 5,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 5,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 5,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 5,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 6,
|
||||
"end": 8,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 6,
|
||||
"end": 8,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 7,
|
||||
"end": 9,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 5,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 5,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 5,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"init": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 8,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "eval"
|
||||
},
|
||||
"init": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 11,
|
||||
"end": 13,
|
||||
"loc": {
|
||||
@@ -123,7 +123,7 @@
|
||||
"name": "arguments"
|
||||
},
|
||||
"init": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 27,
|
||||
"end": 29,
|
||||
"loc": {
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
"name": "answer"
|
||||
},
|
||||
"value": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 14,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"init": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 8,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
@@ -123,7 +123,7 @@
|
||||
"name": "y"
|
||||
},
|
||||
"init": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 16,
|
||||
"end": 17,
|
||||
"loc": {
|
||||
@@ -172,7 +172,7 @@
|
||||
"name": "z"
|
||||
},
|
||||
"init": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 23,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
"name": "if"
|
||||
},
|
||||
"value": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 10,
|
||||
"end": 12,
|
||||
"loc": {
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"init": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 21,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"type": "Literal",
|
||||
"type": "BooleanLiteral",
|
||||
"start": 18,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"type": "Literal",
|
||||
"type": "BooleanLiteral",
|
||||
"start": 18,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
|
||||
@@ -187,7 +187,7 @@
|
||||
},
|
||||
"operator": "<",
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 28,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"body": []
|
||||
},
|
||||
"test": {
|
||||
"type": "Literal",
|
||||
"type": "BooleanLiteral",
|
||||
"start": 16,
|
||||
"end": 21,
|
||||
"loc": {
|
||||
@@ -107,7 +107,7 @@
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "Literal",
|
||||
"type": "BooleanLiteral",
|
||||
"start": 23,
|
||||
"end": 28,
|
||||
"loc": {
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"type": "Literal",
|
||||
"type": "BooleanLiteral",
|
||||
"start": 7,
|
||||
"end": 11,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
},
|
||||
"operator": "<",
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 11,
|
||||
"end": 13,
|
||||
"loc": {
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
"name": "true"
|
||||
},
|
||||
"value": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 12,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 8,
|
||||
"end": 9,
|
||||
"loc": {
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"init": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 12,
|
||||
"end": 13,
|
||||
"loc": {
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"init": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 12,
|
||||
"end": 13,
|
||||
"loc": {
|
||||
@@ -137,7 +137,7 @@
|
||||
"name": "y"
|
||||
},
|
||||
"init": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 19,
|
||||
"end": 20,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 8,
|
||||
"end": 9,
|
||||
"loc": {
|
||||
@@ -124,7 +124,7 @@
|
||||
},
|
||||
"operator": "<",
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 15,
|
||||
"end": 17,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 8,
|
||||
"end": 9,
|
||||
"loc": {
|
||||
@@ -124,7 +124,7 @@
|
||||
},
|
||||
"operator": "<",
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 15,
|
||||
"end": 17,
|
||||
"loc": {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"name": "x"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 8,
|
||||
"end": 9,
|
||||
"loc": {
|
||||
@@ -124,7 +124,7 @@
|
||||
},
|
||||
"operator": "<",
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 15,
|
||||
"end": 17,
|
||||
"loc": {
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
"name": "false"
|
||||
},
|
||||
"value": {
|
||||
"type": "Literal",
|
||||
"type": "NumberLiteral",
|
||||
"start": 13,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"type": "Literal",
|
||||
"type": "BooleanLiteral",
|
||||
"start": 7,
|
||||
"end": 11,
|
||||
"loc": {
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"type": "Literal",
|
||||
"type": "BooleanLiteral",
|
||||
"start": 7,
|
||||
"end": 11,
|
||||
"loc": {
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"type": "Literal",
|
||||
"type": "BooleanLiteral",
|
||||
"start": 13,
|
||||
"end": 17,
|
||||
"loc": {
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"type": "Literal",
|
||||
"type": "BooleanLiteral",
|
||||
"start": 13,
|
||||
"end": 17,
|
||||
"loc": {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user