rename NumberLiteral to NumericLiteral and RegexLiteral to RegExpLiteral

This commit is contained in:
Sebastian McKenzie 2015-11-03 01:19:35 +00:00
parent 9bc95258e6
commit e62a00df50
404 changed files with 622 additions and 573 deletions

View File

@ -188,8 +188,8 @@ declare class BabelNodeStringLiteral extends BabelNode {
value: string; value: string;
} }
declare class BabelNodeNumberLiteral extends BabelNode { declare class BabelNodeNumericLiteral extends BabelNode {
type: "NumberLiteral"; type: "NumericLiteral";
value: number; value: number;
} }
@ -202,8 +202,8 @@ declare class BabelNodeBooleanLiteral extends BabelNode {
value: boolean; value: boolean;
} }
declare class BabelNodeRegexLiteral extends BabelNode { declare class BabelNodeRegExpLiteral extends BabelNode {
type: "RegexLiteral"; type: "RegExpLiteral";
pattern: string; pattern: string;
flags?: string; flags?: string;
} }
@ -603,8 +603,8 @@ declare class BabelNodeNullableTypeAnnotation extends BabelNode {
typeAnnotation: any; typeAnnotation: any;
} }
declare class BabelNodeNumberLiteralTypeAnnotation extends BabelNode { declare class BabelNodeNumericLiteralTypeAnnotation extends BabelNode {
type: "NumberLiteralTypeAnnotation"; type: "NumericLiteralTypeAnnotation";
} }
declare class BabelNodeNumberTypeAnnotation extends BabelNode { declare class BabelNodeNumberTypeAnnotation extends BabelNode {
@ -809,7 +809,7 @@ declare class BabelNodeSpreadProperty extends BabelNode {
argument: BabelNodeExpression; argument: BabelNodeExpression;
} }
type BabelNodeExpression = BabelNodeArrayExpression | BabelNodeAssignmentExpression | BabelNodeBinaryExpression | BabelNodeCallExpression | BabelNodeConditionalExpression | BabelNodeFunctionExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumberLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegexLiteral | BabelNodeLogicalExpression | BabelNodeMemberExpression | BabelNodeNewExpression | BabelNodeObjectExpression | BabelNodeSequenceExpression | BabelNodeThisExpression | BabelNodeUnaryExpression | BabelNodeUpdateExpression | BabelNodeArrowFunctionExpression | BabelNodeClassExpression | BabelNodeMetaProperty | BabelNodeSuper | BabelNodeTaggedTemplateExpression | BabelNodeTemplateLiteral | BabelNodeYieldExpression | BabelNodeJSXElement | BabelNodeJSXEmptyExpression | BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeParenthesizedExpression | BabelNodeAwaitExpression | BabelNodeDoExpression; type BabelNodeExpression = BabelNodeArrayExpression | BabelNodeAssignmentExpression | BabelNodeBinaryExpression | BabelNodeCallExpression | BabelNodeConditionalExpression | BabelNodeFunctionExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeLogicalExpression | BabelNodeMemberExpression | BabelNodeNewExpression | BabelNodeObjectExpression | BabelNodeSequenceExpression | BabelNodeThisExpression | BabelNodeUnaryExpression | BabelNodeUpdateExpression | BabelNodeArrowFunctionExpression | BabelNodeClassExpression | BabelNodeMetaProperty | BabelNodeSuper | BabelNodeTaggedTemplateExpression | BabelNodeTemplateLiteral | BabelNodeYieldExpression | BabelNodeJSXElement | BabelNodeJSXEmptyExpression | BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeParenthesizedExpression | BabelNodeAwaitExpression | BabelNodeDoExpression;
type BabelNodeBinary = BabelNodeBinaryExpression | BabelNodeLogicalExpression; type BabelNodeBinary = BabelNodeBinaryExpression | BabelNodeLogicalExpression;
type BabelNodeScopable = BabelNodeBlockStatement | BabelNodeCatchClause | BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeProgram | BabelNodeObjectMethod | BabelNodeSwitchStatement | BabelNodeWhileStatement | BabelNodeArrowFunctionExpression | BabelNodeClassDeclaration | BabelNodeClassExpression | BabelNodeForOfStatement | BabelNodeClassMethod; type BabelNodeScopable = BabelNodeBlockStatement | BabelNodeCatchClause | BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeProgram | BabelNodeObjectMethod | BabelNodeSwitchStatement | BabelNodeWhileStatement | BabelNodeArrowFunctionExpression | BabelNodeClassDeclaration | BabelNodeClassExpression | BabelNodeForOfStatement | BabelNodeClassMethod;
type BabelNodeBlockParent = BabelNodeBlockStatement | BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeProgram | BabelNodeObjectMethod | BabelNodeSwitchStatement | BabelNodeWhileStatement | BabelNodeArrowFunctionExpression | BabelNodeForOfStatement | BabelNodeClassMethod; type BabelNodeBlockParent = BabelNodeBlockStatement | BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeProgram | BabelNodeObjectMethod | BabelNodeSwitchStatement | BabelNodeWhileStatement | BabelNodeArrowFunctionExpression | BabelNodeForOfStatement | BabelNodeClassMethod;
@ -825,11 +825,11 @@ type BabelNodeFor = BabelNodeForInStatement | BabelNodeForStatement | BabelNodeF
type BabelNodeForXStatement = BabelNodeForInStatement | BabelNodeForOfStatement; type BabelNodeForXStatement = BabelNodeForInStatement | BabelNodeForOfStatement;
type BabelNodeFunction = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeObjectMethod | BabelNodeArrowFunctionExpression | BabelNodeClassMethod; type BabelNodeFunction = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeObjectMethod | BabelNodeArrowFunctionExpression | BabelNodeClassMethod;
type BabelNodeFunctionParent = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeProgram | BabelNodeObjectMethod | BabelNodeArrowFunctionExpression | BabelNodeClassMethod; type BabelNodeFunctionParent = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeProgram | BabelNodeObjectMethod | BabelNodeArrowFunctionExpression | BabelNodeClassMethod;
type BabelNodePureish = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeStringLiteral | BabelNodeNumberLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeArrowFunctionExpression | BabelNodeClassDeclaration | BabelNodeClassExpression; type BabelNodePureish = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeArrowFunctionExpression | BabelNodeClassDeclaration | BabelNodeClassExpression;
type BabelNodeDeclaration = BabelNodeFunctionDeclaration | BabelNodeVariableDeclaration | BabelNodeClassDeclaration | BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareModule | BabelNodeDeclareVariable | BabelNodeInterfaceDeclaration | BabelNodeTypeAlias; type BabelNodeDeclaration = BabelNodeFunctionDeclaration | BabelNodeVariableDeclaration | BabelNodeClassDeclaration | BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareModule | BabelNodeDeclareVariable | BabelNodeInterfaceDeclaration | BabelNodeTypeAlias;
type BabelNodeLVal = BabelNodeIdentifier | BabelNodeMemberExpression | BabelNodeRestElement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern; type BabelNodeLVal = BabelNodeIdentifier | BabelNodeMemberExpression | BabelNodeRestElement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern;
type BabelNodeLiteral = BabelNodeStringLiteral | BabelNodeNumberLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegexLiteral | BabelNodeTemplateLiteral; type BabelNodeLiteral = BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeTemplateLiteral;
type BabelNodeImmutable = BabelNodeStringLiteral | BabelNodeNumberLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXExpressionContainer | BabelNodeJSXOpeningElement; type BabelNodeImmutable = BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXExpressionContainer | BabelNodeJSXOpeningElement;
type BabelNodeUserWhitespacable = BabelNodeObjectMethod | BabelNodeObjectProperty | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty; type BabelNodeUserWhitespacable = BabelNodeObjectMethod | BabelNodeObjectProperty | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty;
type BabelNodeMethod = BabelNodeObjectMethod | BabelNodeClassMethod; type BabelNodeMethod = BabelNodeObjectMethod | BabelNodeClassMethod;
type BabelNodeProperty = BabelNodeObjectProperty | BabelNodeClassProperty; type BabelNodeProperty = BabelNodeObjectProperty | BabelNodeClassProperty;
@ -839,7 +839,7 @@ type BabelNodeClass = BabelNodeClassDeclaration | BabelNodeClassExpression;
type BabelNodeModuleDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration; type BabelNodeModuleDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration;
type BabelNodeExportDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration; type BabelNodeExportDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration;
type BabelNodeModuleSpecifier = BabelNodeExportSpecifier | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier | BabelNodeImportSpecifier | BabelNodeExportDefaultSpecifier | BabelNodeExportNamespaceSpecifier; type BabelNodeModuleSpecifier = BabelNodeExportSpecifier | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier | BabelNodeImportSpecifier | BabelNodeExportDefaultSpecifier | BabelNodeExportNamespaceSpecifier;
type BabelNodeFlow = BabelNodeAnyTypeAnnotation | BabelNodeArrayTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeBooleanLiteralTypeAnnotation | BabelNodeClassImplements | BabelNodeClassProperty | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareModule | BabelNodeDeclareVariable | BabelNodeFunctionTypeAnnotation | BabelNodeFunctionTypeParam | BabelNodeGenericTypeAnnotation | BabelNodeInterfaceExtends | BabelNodeInterfaceDeclaration | BabelNodeIntersectionTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeNullableTypeAnnotation | BabelNodeNumberLiteralTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringLiteralTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeTupleTypeAnnotation | BabelNodeTypeofTypeAnnotation | BabelNodeTypeAlias | BabelNodeTypeAnnotation | BabelNodeTypeCastExpression | BabelNodeTypeParameterDeclaration | BabelNodeTypeParameterInstantiation | BabelNodeObjectTypeAnnotation | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty | BabelNodeQualifiedTypeIdentifier | BabelNodeUnionTypeAnnotation | BabelNodeVoidTypeAnnotation; type BabelNodeFlow = BabelNodeAnyTypeAnnotation | BabelNodeArrayTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeBooleanLiteralTypeAnnotation | BabelNodeClassImplements | BabelNodeClassProperty | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareModule | BabelNodeDeclareVariable | BabelNodeFunctionTypeAnnotation | BabelNodeFunctionTypeParam | BabelNodeGenericTypeAnnotation | BabelNodeInterfaceExtends | BabelNodeInterfaceDeclaration | BabelNodeIntersectionTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeNullableTypeAnnotation | BabelNodeNumericLiteralTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringLiteralTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeTupleTypeAnnotation | BabelNodeTypeofTypeAnnotation | BabelNodeTypeAlias | BabelNodeTypeAnnotation | BabelNodeTypeCastExpression | BabelNodeTypeParameterDeclaration | BabelNodeTypeParameterInstantiation | BabelNodeObjectTypeAnnotation | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty | BabelNodeQualifiedTypeIdentifier | BabelNodeUnionTypeAnnotation | BabelNodeVoidTypeAnnotation;
type BabelNodeFlowBaseAnnotation = BabelNodeAnyTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeVoidTypeAnnotation; type BabelNodeFlowBaseAnnotation = BabelNodeAnyTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeVoidTypeAnnotation;
type BabelNodeFlowDeclaration = BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareModule | BabelNodeDeclareVariable | BabelNodeInterfaceDeclaration | BabelNodeTypeAlias; type BabelNodeFlowDeclaration = BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareModule | BabelNodeDeclareVariable | BabelNodeInterfaceDeclaration | BabelNodeTypeAlias;
type BabelNodeJSX = BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXEmptyExpression | BabelNodeJSXExpressionContainer | BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName | BabelNodeJSXOpeningElement | BabelNodeJSXSpreadAttribute | BabelNodeJSXText; type BabelNodeJSX = BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXEmptyExpression | BabelNodeJSXExpressionContainer | BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName | BabelNodeJSXOpeningElement | BabelNodeJSXSpreadAttribute | BabelNodeJSXText;
@ -869,10 +869,10 @@ declare module "babel-types" {
declare function ifStatement(test: BabelNodeExpression, consequent?: ?BabelNodeStatement, alternate?: ?BabelNodeStatement): BabelNodeIfStatement; declare function ifStatement(test: BabelNodeExpression, consequent?: ?BabelNodeStatement, alternate?: ?BabelNodeStatement): BabelNodeIfStatement;
declare function labeledStatement(label: BabelNodeIdentifier, body: BabelNodeStatement): BabelNodeLabeledStatement; declare function labeledStatement(label: BabelNodeIdentifier, body: BabelNodeStatement): BabelNodeLabeledStatement;
declare function stringLiteral(value: string): BabelNodeStringLiteral; declare function stringLiteral(value: string): BabelNodeStringLiteral;
declare function numberLiteral(value: number): BabelNodeNumberLiteral; declare function NumericLiteral(value: number): BabelNodeNumericLiteral;
declare function nullLiteral(): BabelNodeNullLiteral; declare function nullLiteral(): BabelNodeNullLiteral;
declare function booleanLiteral(value: boolean): BabelNodeBooleanLiteral; declare function booleanLiteral(value: boolean): BabelNodeBooleanLiteral;
declare function regexLiteral(pattern: string, flags?: string): BabelNodeRegexLiteral; declare function RegExpLiteral(pattern: string, flags?: string): BabelNodeRegExpLiteral;
declare function logicalExpression(operator: any, left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeLogicalExpression; declare function logicalExpression(operator: any, left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeLogicalExpression;
declare function memberExpression(object: BabelNodeExpression, property: any, computed?: boolean): BabelNodeMemberExpression; declare function memberExpression(object: BabelNodeExpression, property: any, computed?: boolean): BabelNodeMemberExpression;
declare function newExpression(callee: BabelNodeExpression, _arguments: any): BabelNodeNewExpression; declare function newExpression(callee: BabelNodeExpression, _arguments: any): BabelNodeNewExpression;
@ -936,7 +936,7 @@ declare module "babel-types" {
declare function intersectionTypeAnnotation(types: any): BabelNodeIntersectionTypeAnnotation; declare function intersectionTypeAnnotation(types: any): BabelNodeIntersectionTypeAnnotation;
declare function mixedTypeAnnotation(): BabelNodeMixedTypeAnnotation; declare function mixedTypeAnnotation(): BabelNodeMixedTypeAnnotation;
declare function nullableTypeAnnotation(typeAnnotation: any): BabelNodeNullableTypeAnnotation; declare function nullableTypeAnnotation(typeAnnotation: any): BabelNodeNullableTypeAnnotation;
declare function numberLiteralTypeAnnotation(): BabelNodeNumberLiteralTypeAnnotation; declare function NumericLiteralTypeAnnotation(): BabelNodeNumericLiteralTypeAnnotation;
declare function numberTypeAnnotation(): BabelNodeNumberTypeAnnotation; declare function numberTypeAnnotation(): BabelNodeNumberTypeAnnotation;
declare function stringLiteralTypeAnnotation(): BabelNodeStringLiteralTypeAnnotation; declare function stringLiteralTypeAnnotation(): BabelNodeStringLiteralTypeAnnotation;
declare function stringTypeAnnotation(): BabelNodeStringTypeAnnotation; declare function stringTypeAnnotation(): BabelNodeStringTypeAnnotation;
@ -999,10 +999,10 @@ declare module "babel-types" {
declare function isIfStatement(node: Object, opts?: Object): boolean; declare function isIfStatement(node: Object, opts?: Object): boolean;
declare function isLabeledStatement(node: Object, opts?: Object): boolean; declare function isLabeledStatement(node: Object, opts?: Object): boolean;
declare function isStringLiteral(node: Object, opts?: Object): boolean; declare function isStringLiteral(node: Object, opts?: Object): boolean;
declare function isNumberLiteral(node: Object, opts?: Object): boolean; declare function isNumericLiteral(node: Object, opts?: Object): boolean;
declare function isNullLiteral(node: Object, opts?: Object): boolean; declare function isNullLiteral(node: Object, opts?: Object): boolean;
declare function isBooleanLiteral(node: Object, opts?: Object): boolean; declare function isBooleanLiteral(node: Object, opts?: Object): boolean;
declare function isRegexLiteral(node: Object, opts?: Object): boolean; declare function isRegExpLiteral(node: Object, opts?: Object): boolean;
declare function isLogicalExpression(node: Object, opts?: Object): boolean; declare function isLogicalExpression(node: Object, opts?: Object): boolean;
declare function isMemberExpression(node: Object, opts?: Object): boolean; declare function isMemberExpression(node: Object, opts?: Object): boolean;
declare function isNewExpression(node: Object, opts?: Object): boolean; declare function isNewExpression(node: Object, opts?: Object): boolean;
@ -1066,7 +1066,7 @@ declare module "babel-types" {
declare function isIntersectionTypeAnnotation(node: Object, opts?: Object): boolean; declare function isIntersectionTypeAnnotation(node: Object, opts?: Object): boolean;
declare function isMixedTypeAnnotation(node: Object, opts?: Object): boolean; declare function isMixedTypeAnnotation(node: Object, opts?: Object): boolean;
declare function isNullableTypeAnnotation(node: Object, opts?: Object): boolean; declare function isNullableTypeAnnotation(node: Object, opts?: Object): boolean;
declare function isNumberLiteralTypeAnnotation(node: Object, opts?: Object): boolean; declare function isNumericLiteralTypeAnnotation(node: Object, opts?: Object): boolean;
declare function isNumberTypeAnnotation(node: Object, opts?: Object): boolean; declare function isNumberTypeAnnotation(node: Object, opts?: Object): boolean;
declare function isStringLiteralTypeAnnotation(node: Object, opts?: Object): boolean; declare function isStringLiteralTypeAnnotation(node: Object, opts?: Object): boolean;
declare function isStringTypeAnnotation(node: Object, opts?: Object): boolean; declare function isStringTypeAnnotation(node: Object, opts?: Object): boolean;

View File

@ -118,7 +118,7 @@ export function NullableTypeAnnotation(node: Object) {
this.print(node.typeAnnotation, node); this.print(node.typeAnnotation, node);
} }
export { NumberLiteral as NumberLiteralTypeAnnotation } from "./types"; export { NumericLiteral as NumericLiteralTypeAnnotation } from "./types";
export function NumberTypeAnnotation() { export function NumberTypeAnnotation() {
this.push("number"); this.push("number");

View File

@ -99,7 +99,7 @@ export function ArrayExpression(node: Object) {
export { ArrayExpression as ArrayPattern }; export { ArrayExpression as ArrayPattern };
export function RegexLiteral(node: Object) { export function RegExpLiteral(node: Object) {
this.push(`/${node.pattern}/${node.flags}`); this.push(`/${node.pattern}/${node.flags}`);
} }
@ -111,7 +111,7 @@ export function NullLiteral() {
this.push("null"); this.push("null");
} }
export function NumberLiteral(node: Object) { export function NumericLiteral(node: Object) {
this.push(node.value + ""); this.push(node.value + "");
} }

View File

@ -4,7 +4,7 @@ import pull from "lodash/array/pull";
import * as t from "babel-types"; import * as t from "babel-types";
export function is(node: Object, flag: string): boolean { export function is(node: Object, flag: string): boolean {
return t.isRegexLiteral(node) && node.flags.indexOf(flag) >= 0; return t.isRegExpLiteral(node) && node.flags.indexOf(flag) >= 0;
} }
export function pullFlag(node: Object, flag: string) { export function pullFlag(node: Object, flag: string) {

View File

@ -249,7 +249,7 @@ export default class ReplaceSupers {
property = node.property; property = node.property;
computed = node.computed; computed = node.computed;
} else if (t.isUpdateExpression(node) && isMemberExpressionSuper(node.argument)) { } else if (t.isUpdateExpression(node) && isMemberExpressionSuper(node.argument)) {
let binary = t.binaryExpression(node.operator[0], node.argument, t.numberLiteral(1)); let binary = t.binaryExpression(node.operator[0], node.argument, t.numericLiteral(1));
if (node.prefix) { if (node.prefix) {
// ++super.foo; -> super.foo += 1; // ++super.foo; -> super.foo += 1;
return this.specHandleAssignmentExpression(null, path, binary); return this.specHandleAssignmentExpression(null, path, binary);

View File

@ -184,7 +184,7 @@ let hoistVarDeclarationsVisitor = {
node.left = node.left.declarations[0].id; node.left = node.left.declarations[0].id;
} }
} else if (isVar(node, parent, scope)) { } else if (isVar(node, parent, scope)) {
path.replaceWithMultiple(self.pushDeclar(node).map(t.expressionStatement)); path.replaceWithMultiple(self.pushDeclar(node).map(expr => t.expressionStatement(expr)));
} else if (path.isFunction()) { } else if (path.isFunction()) {
return path.skip(); return path.skip();
} }

View File

@ -288,14 +288,14 @@ export default function ({ types: t }) {
elemRef = this.toArray(arrayRef); elemRef = this.toArray(arrayRef);
if (i > 0) { if (i > 0) {
elemRef = t.callExpression(t.memberExpression(elemRef, t.identifier("slice")), [t.numberLiteral(i)]); elemRef = t.callExpression(t.memberExpression(elemRef, t.identifier("slice")), [t.numericLiteral(i)]);
} }
// set the element to the rest element argument since we've dealt with it // set the element to the rest element argument since we've dealt with it
// being a rest already // being a rest already
elem = elem.argument; elem = elem.argument;
} else { } else {
elemRef = t.memberExpression(arrayRef, t.numberLiteral(i), true); elemRef = t.memberExpression(arrayRef, t.numericLiteral(i), true);
} }
this.push(elem, elemRef); this.push(elem, elemRef);

View File

@ -1,7 +1,7 @@
export default function () { export default function () {
return { return {
visitor: { visitor: {
NumberLiteral({ node }) { NumericLiteral({ node }) {
// number octal like 0b10 or 0o70 // number octal like 0b10 or 0o70
if (node.extra && /^0[ob]/i.test(node.extra.raw)) { if (node.extra && /^0[ob]/i.test(node.extra.raw)) {
node.extra = undefined; node.extra = undefined;

View File

@ -57,7 +57,7 @@ export default function () {
if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return; if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return;
if (path.parentPath.isCallExpression({ callee: path.node })) { if (path.parentPath.isCallExpression({ callee: path.node })) {
path.replaceWith(t.sequenceExpression([t.numberLiteral(0), remap])); path.replaceWith(t.sequenceExpression([t.numericLiteral(0), remap]));
} else { } else {
path.replaceWith(remap); path.replaceWith(remap);
} }
@ -96,7 +96,7 @@ export default function () {
// redeclared in this scope // redeclared in this scope
if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return; if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return;
let node = t.assignmentExpression(path.node.operator[0] + "=", arg.node, t.numberLiteral(1)); let node = t.assignmentExpression(path.node.operator[0] + "=", arg.node, t.numericLiteral(1));
if ((path.parentPath.isExpressionStatement() && !path.isCompletionRecord()) || path.node.prefix) { if ((path.parentPath.isExpressionStatement() && !path.isCompletionRecord()) || path.node.prefix) {
return path.replaceWith(node); return path.replaceWith(node);
@ -111,7 +111,7 @@ export default function () {
} else { // "++" } else { // "++"
operator = "-"; operator = "-";
} }
nodes.push(t.binaryExpression(operator, arg.node, t.numberLiteral(1))); nodes.push(t.binaryExpression(operator, arg.node, t.numericLiteral(1)));
path.replaceWithMultiple(t.sequenceExpression(nodes)); path.replaceWithMultiple(t.sequenceExpression(nodes));
} }

View File

@ -67,7 +67,7 @@ export let visitor = {
defNode = buildDefaultParam({ defNode = buildDefaultParam({
VARIABLE_NAME: left, VARIABLE_NAME: left,
DEFAULT_VALUE: right, DEFAULT_VALUE: right,
ARGUMENT_KEY: t.numberLiteral(i), ARGUMENT_KEY: t.numericLiteral(i),
ARGUMENTS: argsIdentifier ARGUMENTS: argsIdentifier
}); });
} else { } else {
@ -131,7 +131,7 @@ export let visitor = {
let param = node.params[i]; let param = node.params[i];
if (param._isDefaultPlaceholder) continue; if (param._isDefaultPlaceholder) continue;
let declar = buildCutOff(param, argsIdentifier, t.numberLiteral(i)); let declar = buildCutOff(param, argsIdentifier, t.numericLiteral(i));
declar._blockHoist = node.params.length - i; declar._blockHoist = node.params.length - i;
body.push(declar); body.push(declar);
} }

View File

@ -94,7 +94,7 @@ function optimiseMemberExpression(parent, offset) {
prop.value += offset; prop.value += offset;
prop.raw = String(prop.value); prop.raw = String(prop.value);
} else { // // UnaryExpression, BinaryExpression } else { // // UnaryExpression, BinaryExpression
newExpr = t.binaryExpression("+", prop, t.numberLiteral(offset)); newExpr = t.binaryExpression("+", prop, t.numericLiteral(offset));
parent.property = newExpr; parent.property = newExpr;
} }
} }
@ -122,7 +122,7 @@ export let visitor = {
rest = scope.generateUidIdentifier("ref"); rest = scope.generateUidIdentifier("ref");
let declar = t.variableDeclaration("let", pattern.elements.map(function (elem, index) { let declar = t.variableDeclaration("let", pattern.elements.map(function (elem, index) {
let accessExpr = t.memberExpression(rest, t.numberLiteral(index), true); let accessExpr = t.memberExpression(rest, t.numericLiteral(index), true);
return t.variableDeclarator(elem, accessExpr); return t.variableDeclarator(elem, accessExpr);
})); }));
node.body.body.unshift(declar); node.body.body.unshift(declar);
@ -168,7 +168,7 @@ export let visitor = {
// //
let start = t.numberLiteral(node.params.length); let start = t.numericLiteral(node.params.length);
let key = scope.generateUidIdentifier("key"); let key = scope.generateUidIdentifier("key");
let len = scope.generateUidIdentifier("len"); let len = scope.generateUidIdentifier("len");
@ -189,7 +189,7 @@ export let visitor = {
arrLen = t.conditionalExpression( arrLen = t.conditionalExpression(
t.binaryExpression(">", len, start), t.binaryExpression(">", len, start),
t.binaryExpression("-", len, start), t.binaryExpression("-", len, start),
t.numberLiteral(0) t.numericLiteral(0)
); );
} }

View File

@ -4,7 +4,7 @@ import * as t from "babel-types";
export default function () { export default function () {
return { return {
visitor: { visitor: {
RegexLiteral(path) { RegExpLiteral(path) {
let { node } = path; let { node } = path;
if (!regex.is(node, "y")) return; if (!regex.is(node, "y")) return;

View File

@ -4,7 +4,7 @@ import * as regex from "babel-helper-regex";
export default function () { export default function () {
return { return {
visitor: { visitor: {
RegexLiteral({ node }) { RegExpLiteral({ node }) {
if (!regex.is(node, "u")) return; if (!regex.is(node, "u")) return;
node.pattern = rewritePattern(node.pattern, node.flags); node.pattern = rewritePattern(node.pattern, node.flags);
regex.pullFlag(node, "u"); regex.pullFlag(node, "u");

View File

@ -3,7 +3,7 @@ export default function ({ types: t }) {
visitor: { visitor: {
Literal(path) { Literal(path) {
if (typeof path.node.value === "boolean") { if (typeof path.node.value === "boolean") {
path.replaceWith(t.unaryExpression("!", t.numberLiteral(+!path.node.value), true)); path.replaceWith(t.unaryExpression("!", t.numericLiteral(+!path.node.value), true));
} }
} }
} }

View File

@ -33,7 +33,7 @@ export default function ({ types: t }) {
} }
} }
state.set("jsxIdentifier", id.split(".").map(t.identifier).reduce(function (object, property) { state.set("jsxIdentifier", id.split(".").map((name) => t.identifier(name)).reduce(function (object, property) {
return t.memberExpression(object, property); return t.memberExpression(object, property);
})); }));
}; };

View File

@ -67,7 +67,7 @@ exports.Emitter = Emitter;
// location to be determined at any time, even after generating code that // location to be determined at any time, even after generating code that
// refers to the location. // refers to the location.
function loc() { function loc() {
return t.numberLiteral(-1); return t.numericLiteral(-1);
} }
// Sets the exact value of the given location to the offset of the next // Sets the exact value of the given location to the offset of the next
@ -235,7 +235,7 @@ Ep.getDispatchLoop = function() {
self.listing.forEach(function(stmt, i) { self.listing.forEach(function(stmt, i) {
if (self.marked.hasOwnProperty(i)) { if (self.marked.hasOwnProperty(i)) {
cases.push(t.switchCase( cases.push(t.switchCase(
t.numberLiteral(i), t.numericLiteral(i),
current = [])); current = []));
alreadyEnded = false; alreadyEnded = false;
} }
@ -267,7 +267,7 @@ Ep.getDispatchLoop = function() {
); );
return t.whileStatement( return t.whileStatement(
t.numberLiteral(1), t.numericLiteral(1),
t.switchStatement( t.switchStatement(
t.assignmentExpression( t.assignmentExpression(
"=", "=",
@ -845,7 +845,7 @@ function isValidCompletion(record) {
// targets, but minimizing the number of switch cases keeps the generated // targets, but minimizing the number of switch cases keeps the generated
// code shorter. // code shorter.
Ep.getUnmarkedCurrentLoc = function() { Ep.getUnmarkedCurrentLoc = function() {
return t.numberLiteral(this.listing.length); return t.numericLiteral(this.listing.length);
}; };
// The context.prev property takes the value of context.next whenever we // The context.prev property takes the value of context.next whenever we
@ -1030,7 +1030,7 @@ Ep.explodeExpression = function(path, ignoreResult) {
// will receive the object of the MemberExpression as its `this` // will receive the object of the MemberExpression as its `this`
// object. // object.
newCallee = t.sequenceExpression([ newCallee = t.sequenceExpression([
t.numberLiteral(0), t.numericLiteral(0),
newCallee newCallee
]); ]);
} }

View File

@ -104,7 +104,7 @@ exports.visitor = {
// Async functions that are not generators don't care about the // Async functions that are not generators don't care about the
// outer function because they don't need it to be marked and don't // outer function because they don't need it to be marked and don't
// inherit from its .prototype. // inherit from its .prototype.
node.generator ? outerFnExpr : t.nullLiteral(null), node.generator ? outerFnExpr : t.nullLiteral(),
t.thisExpression() t.thisExpression()
]; ];
@ -166,7 +166,7 @@ function getOuterFnExpr(funPath) {
return t.memberExpression( return t.memberExpression(
markedArray, markedArray,
t.numberLiteral(index), t.numericLiteral(index),
true true
); );
} }

View File

@ -3,7 +3,7 @@ export default function ({ types: t }) {
visitor: { visitor: {
ReferencedIdentifier(path) { ReferencedIdentifier(path) {
if (path.node.name === "undefined") { if (path.node.name === "undefined") {
path.replaceWith(t.unaryExpression("void", t.numberLiteral(0), true)); path.replaceWith(t.unaryExpression("void", t.numericLiteral(0), true));
} }
} }
} }

View File

@ -75,7 +75,7 @@ export function evaluate(): { confident: boolean; value: any } {
return evaluate(exprs[exprs.length - 1]); return evaluate(exprs[exprs.length - 1]);
} }
if (path.isStringLiteral() || path.isNumberLiteral() || path.isBooleanLiteral()) { if (path.isStringLiteral() || path.isNumericLiteral() || path.isBooleanLiteral()) {
return node.value; return node.value;
} }

View File

@ -105,7 +105,7 @@ export function StringLiteral() {
return t.stringTypeAnnotation(); return t.stringTypeAnnotation();
} }
export function NumberLiteral() { export function NumericLiteral() {
return t.numberTypeAnnotation(); return t.numberTypeAnnotation();
} }
@ -117,7 +117,7 @@ export function NullLiteral() {
return t.voidTypeAnnotation(); return t.voidTypeAnnotation();
} }
export function RegexLiteral() { export function RegExpLiteral() {
return t.genericTypeAnnotation(t.identifier("RegExp")); return t.genericTypeAnnotation(t.identifier("RegExp"));
} }

View File

@ -391,7 +391,7 @@ export default class Scope {
if (i === true) { if (i === true) {
helperName = "toConsumableArray"; helperName = "toConsumableArray";
} else if (i) { } else if (i) {
args.push(t.numberLiteral(i)); args.push(t.numericLiteral(i));
helperName = "slicedToArray"; helperName = "slicedToArray";
// TODO if (this.hub.file.isLoose("es6.forOf")) helperName += "-loose"; // TODO if (this.hub.file.isLoose("es6.forOf")) helperName += "-loose";
} }
@ -427,7 +427,7 @@ export default class Scope {
buildUndefinedNode() { buildUndefinedNode() {
if (this.hasBinding("undefined")) { if (this.hasBinding("undefined")) {
return t.unaryExpression("void", t.numberLiteral(0), true); return t.unaryExpression("void", t.numericLiteral(0), true);
} else { } else {
return t.identifier("undefined"); return t.identifier("undefined");
} }

View File

@ -54,7 +54,7 @@ export function explode(visitor) {
delete visitor[nodeType]; delete visitor[nodeType];
if (wrapper.types) { if (wrapper.types) {
for (let type of (wrapper.types: Array)) { for (let type of (wrapper.types: Array<string>)) {
// merge the visitor if necessary or just put it back in // merge the visitor if necessary or just put it back in
if (visitor[type]) { if (visitor[type]) {
mergePair(visitor[type], fns); mergePair(visitor[type], fns);
@ -73,13 +73,20 @@ export function explode(visitor) {
let fns = visitor[nodeType]; let fns = visitor[nodeType];
let aliases = t.FLIPPED_ALIAS_KEYS[nodeType]; let aliases: ?Array<string> = t.FLIPPED_ALIAS_KEYS[nodeType];
let deprecratedKey = t.DEPRECATED_KEYS[nodeType];
if (deprecratedKey) {
console.trace(`Visitor defined for ${nodeType} but it has been renamed to ${deprecratedKey}`);
aliases = [deprecratedKey];
}
if (!aliases) continue; if (!aliases) continue;
// clear it from the visitor // clear it from the visitor
delete visitor[nodeType]; delete visitor[nodeType];
for (let alias of (aliases: Array)) { for (let alias of aliases) {
let existing = visitor[alias]; let existing = visitor[alias];
if (existing) { if (existing) {
mergePair(existing, fns); mergePair(existing, fns);
@ -115,11 +122,21 @@ export function verify(visitor) {
let visitors = visitor[nodeType]; let visitors = visitor[nodeType];
if (typeof visitors === "object") { if (typeof visitors === "object") {
for (let visitorKey in visitors) { for (let visitorKey in visitors) {
if (visitorKey === "enter" || visitorKey === "exit") continue; if (visitorKey === "enter" || visitorKey === "exit") {
// verify that it just contains functions
let val = visitors[visitorKey];
let fns = [].concat(val);
for (let fn of fns) {
if (typeof fn !== "function") {
throw new TypeError(`Non-function found defined in ${nodeType}.${visitorKey} with type ${typeof fn}`);
}
}
} else {
throw new Error(messages.get("traverseVerifyVisitorProperty", nodeType, visitorKey)); throw new Error(messages.get("traverseVerifyVisitorProperty", nodeType, visitorKey));
} }
} }
} }
}
visitor._verified = true; visitor._verified = true;
} }
@ -137,31 +154,7 @@ export function merge(visitors: Array, states: Array = []) {
let visitorType = visitor[type]; let visitorType = visitor[type];
// if we have state then overload the callbacks to take it // if we have state then overload the callbacks to take it
if (state) { if (state) visitorType = wrapWithState(visitorType, state);
let oldVisitorType = visitorType;
visitorType = {};
for (let key in oldVisitorType) {
let fns = oldVisitorType[key];
// not an enter/exit array of callbacks
if (!Array.isArray(fns)) continue;
fns = fns.map(function (fn) {
if (typeof fn === "function") {
let newFn = function (path) {
return fn.call(state, path, state);
};
newFn.toString = () => fn.toString();
return newFn;
} else {
return fn;
}
});
visitorType[key] = fns;
}
}
let nodeVisitor = rootVisitor[type] = rootVisitor[type] || {}; let nodeVisitor = rootVisitor[type] = rootVisitor[type] || {};
mergePair(nodeVisitor, visitorType); mergePair(nodeVisitor, visitorType);
@ -171,6 +164,27 @@ export function merge(visitors: Array, states: Array = []) {
return rootVisitor; return rootVisitor;
} }
function wrapWithState(oldVisitor, state) {
let newVisitor = {};
for (let key in oldVisitor) {
let fns = oldVisitor[key];
// not an enter/exit array of callbacks
if (!Array.isArray(fns)) continue;
fns = fns.map(function (fn) {
return function (path) {
return fn.call(state, path, state);
};
});
newVisitor[key] = fns;
}
return newVisitor;
}
function ensureEntranceObjects(obj) { function ensureEntranceObjects(obj) {
for (let key in obj) { for (let key in obj) {
if (shouldIgnoreKey(key)) continue; if (shouldIgnoreKey(key)) continue;

View File

@ -267,14 +267,14 @@ export function valueToNode(value: any): Object {
// numbers // numbers
if (isNumber(value)) { if (isNumber(value)) {
return t.numberLiteral(value); return t.numericLiteral(value);
} }
// regexes // regexes
if (isRegExp(value)) { if (isRegExp(value)) {
let pattern = value.source; let pattern = value.source;
let flags = value.toString().match(/\/([a-z]+|)$/)[1]; let flags = value.toString().match(/\/([a-z]+|)$/)[1];
return t.regexLiteral(pattern, flags); return t.regExpLiteral(pattern, flags);
} }
// array // array

View File

@ -212,13 +212,16 @@ defineType("ForStatement", {
aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop"], aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop"],
fields: { fields: {
init: { init: {
validate: assertNodeType("VariableDeclaration", "Expression") validate: assertNodeType("VariableDeclaration", "Expression"),
optional: true
}, },
test: { test: {
validate: assertNodeType("Expression") validate: assertNodeType("Expression"),
optional: true
}, },
update: { update: {
validate: assertNodeType("Expression") validate: assertNodeType("Expression"),
optional: true
}, },
body: { body: {
validate: assertNodeType("Statement") validate: assertNodeType("Statement")
@ -340,8 +343,9 @@ defineType("StringLiteral", {
aliases: ["Expression", "Pureish", "Literal", "Immutable"] aliases: ["Expression", "Pureish", "Literal", "Immutable"]
}); });
defineType("NumberLiteral", { defineType("NumericLiteral", {
builder: ["value"], builder: ["value"],
deprecatedAlias: "NumberLiteral",
fields: { fields: {
value: { value: {
validate: assertValueType("number") validate: assertValueType("number")
@ -364,8 +368,9 @@ defineType("BooleanLiteral", {
aliases: ["Expression", "Pureish", "Literal", "Immutable"] aliases: ["Expression", "Pureish", "Literal", "Immutable"]
}); });
defineType("RegexLiteral", { defineType("RegExpLiteral", {
builder: ["pattern", "flags"], builder: ["pattern", "flags"],
deprecatedAlias: "RegexLiteral",
aliases: ["Expression", "Literal"], aliases: ["Expression", "Literal"],
fields: { fields: {
pattern: { pattern: {

View File

@ -139,7 +139,7 @@ defineType("NullableTypeAnnotation", {
} }
}); });
defineType("NumberLiteralTypeAnnotation", { defineType("NumericLiteralTypeAnnotation", {
aliases: ["Flow"], aliases: ["Flow"],
fields: { fields: {
// todo // todo

View File

@ -6,6 +6,7 @@ export let VISITOR_KEYS = {};
export let ALIAS_KEYS = {}; export let ALIAS_KEYS = {};
export let NODE_FIELDS = {}; export let NODE_FIELDS = {};
export let BUILDER_KEYS = {}; export let BUILDER_KEYS = {};
export let DEPRECATED_KEYS = {};
function getType(val) { function getType(val) {
if (Array.isArray(val)) { if (Array.isArray(val)) {
@ -101,6 +102,10 @@ export default function defineType(
opts.aliases = opts.aliases || inherits.aliases || []; opts.aliases = opts.aliases || inherits.aliases || [];
opts.builder = opts.builder || inherits.builder || opts.visitor || []; opts.builder = opts.builder || inherits.builder || opts.visitor || [];
if (opts.deprecatedAlias) {
DEPRECATED_KEYS[opts.deprecatedAlias] = type;
}
// ensure all field keys are represented in `fields` // ensure all field keys are represented in `fields`
for (let key of (opts.visitor.concat(opts.builder): Array<string>)) { for (let key of (opts.visitor.concat(opts.builder): Array<string>)) {
opts.fields[key] = opts.fields[key] || {}; opts.fields[key] = opts.fields[key] || {};

View File

@ -13,9 +13,9 @@ let t = exports;
* Pass `skipAliasCheck` to force it to directly compare `node.type` with `type`. * Pass `skipAliasCheck` to force it to directly compare `node.type` with `type`.
*/ */
function registerType(type: string, skipAliasCheck?: boolean) { function registerType(type: string) {
let is = t[`is${type}`] = function (node, opts) { let is = t[`is${type}`] = function (node, opts) {
return t.is(type, node, opts, skipAliasCheck); return t.is(type, node, opts);
}; };
t[`assert${type}`] = function (node, opts) { t[`assert${type}`] = function (node, opts) {
@ -47,8 +47,8 @@ export const NUMBER_UNARY_OPERATORS = ["+", "-", "++", "--", "~"];
export const STRING_UNARY_OPERATORS = ["typeof"]; export const STRING_UNARY_OPERATORS = ["typeof"];
import "./definitions/init"; import "./definitions/init";
import { VISITOR_KEYS, ALIAS_KEYS, NODE_FIELDS, BUILDER_KEYS } from "./definitions"; import { VISITOR_KEYS, ALIAS_KEYS, NODE_FIELDS, BUILDER_KEYS, DEPRECATED_KEYS } from "./definitions";
export { VISITOR_KEYS, ALIAS_KEYS, NODE_FIELDS, BUILDER_KEYS }; export { VISITOR_KEYS, ALIAS_KEYS, NODE_FIELDS, BUILDER_KEYS, DEPRECATED_KEYS };
import * as _react from "./react"; import * as _react from "./react";
export { _react as react }; export { _react as react };
@ -58,7 +58,7 @@ export { _react as react };
*/ */
for (let type in t.VISITOR_KEYS) { for (let type in t.VISITOR_KEYS) {
registerType(type, true); registerType(type);
} }
/** /**
@ -80,10 +80,12 @@ each(t.ALIAS_KEYS, function (aliases, type) {
each(t.FLIPPED_ALIAS_KEYS, function (types, type) { each(t.FLIPPED_ALIAS_KEYS, function (types, type) {
t[type.toUpperCase() + "_TYPES"] = types; t[type.toUpperCase() + "_TYPES"] = types;
registerType(type, false); registerType(type);
}); });
export const TYPES = Object.keys(t.VISITOR_KEYS).concat(Object.keys(t.FLIPPED_ALIAS_KEYS)); export const TYPES = Object.keys(t.VISITOR_KEYS)
.concat(Object.keys(t.FLIPPED_ALIAS_KEYS))
.concat(Object.keys(t.DEPRECATED_KEYS));
/** /**
* Returns whether `node` is of given `type`. * Returns whether `node` is of given `type`.
@ -112,11 +114,11 @@ export function is(type: string, node: Object, opts?: Object): boolean {
export function isType(nodeType: string, targetType: string): boolean { export function isType(nodeType: string, targetType: string): boolean {
if (nodeType === targetType) return true; if (nodeType === targetType) return true;
let aliases = t.FLIPPED_ALIAS_KEYS[targetType]; let aliases: ?Array<string> = t.FLIPPED_ALIAS_KEYS[targetType];
if (aliases) { if (aliases) {
if (aliases[0] === nodeType) return true; if (aliases[0] === nodeType) return true;
for (let alias of (aliases: Array<string>)) { for (let alias of aliases) {
if (nodeType === alias) return true; if (nodeType === alias) return true;
} }
} }
@ -124,6 +126,10 @@ export function isType(nodeType: string, targetType: string): boolean {
return false; return false;
} }
/**
* Description
*/
each(t.BUILDER_KEYS, function (keys, type) { each(t.BUILDER_KEYS, function (keys, type) {
function builder() { function builder() {
if (arguments.length > keys.length) { if (arguments.length > keys.length) {
@ -155,6 +161,25 @@ each(t.BUILDER_KEYS, function (keys, type) {
t[type[0].toLowerCase() + type.slice(1)] = builder; t[type[0].toLowerCase() + type.slice(1)] = builder;
}); });
/**
* Description
*/
for (let type in t.DEPRECATED_KEYS) {
let newType = t.DEPRECATED_KEYS[type];
function proxy(fn) {
return function () {
console.trace(`The node type ${type} has been renamed to ${newType}`);
return fn.apply(this, arguments);
};
}
t[type] = t[type[0].toLowerCase() + type.slice(1)] = proxy(t[newType]);
t[`is${type}`] = proxy(t[`is${newType}`]);
t[`assert${type}`] = proxy(t[`assert${newType}`]);
}
/** /**
* Description * Description
*/ */

View File

@ -40,7 +40,7 @@ pp.checkPropClash = function (prop, propHash) {
break; break;
case "StringLiteral": case "StringLiteral":
case "NumberLiteral": case "NumericLiteral":
name = String(key.value); name = String(key.value);
break; break;
@ -417,13 +417,13 @@ pp.parseExprAtom = function (refShorthandDefaultPos) {
case tt.regexp: case tt.regexp:
let value = this.state.value; let value = this.state.value;
node = this.parseLiteral(value.value, "RegexLiteral"); node = this.parseLiteral(value.value, "RegExpLiteral");
node.pattern = value.pattern; node.pattern = value.pattern;
node.flags = value.flags; node.flags = value.flags;
return node; return node;
case tt.num: case tt.num:
return this.parseLiteral(this.state.value, "NumberLiteral"); return this.parseLiteral(this.state.value, "NumericLiteral");
case tt.string: case tt.string:
return this.parseLiteral(this.state.value, "StringLiteral"); return this.parseLiteral(this.state.value, "StringLiteral");

View File

@ -506,7 +506,7 @@ pp.flowParsePrimaryType = function () {
this.addExtra(node, "rawValue", node.value); this.addExtra(node, "rawValue", node.value);
this.addExtra(node, "raw", this.input.slice(this.state.start, this.state.end)); this.addExtra(node, "raw", this.input.slice(this.state.start, this.state.end));
this.next(); this.next();
return this.finishNode(node, "NumberLiteralTypeAnnotation"); return this.finishNode(node, "NumericLiteralTypeAnnotation");
default: default:
if (this.state.type.keyword === "typeof") { if (this.state.type.keyword === "typeof") {

View File

@ -91,7 +91,7 @@
} }
}, },
"argument": { "argument": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 42, "start": 42,
"end": 44, "end": 44,
"loc": { "loc": {

View File

@ -140,7 +140,7 @@
}, },
"consequent": [], "consequent": [],
"test": { "test": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 66, "start": 66,
"end": 67, "end": 67,
"loc": { "loc": {
@ -261,7 +261,7 @@
} }
], ],
"test": { "test": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 111, "start": 111,
"end": 112, "end": 112,
"loc": { "loc": {

View File

@ -75,7 +75,7 @@
}, },
"consequent": [], "consequent": [],
"test": { "test": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 34, "start": 34,
"end": 35, "end": 35,
"loc": { "loc": {
@ -196,7 +196,7 @@
} }
], ],
"test": { "test": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 71, "start": 71,
"end": 72, "end": 72,
"loc": { "loc": {

View File

@ -157,7 +157,7 @@
} }
], ],
"test": { "test": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 48, "start": 48,
"end": 49, "end": 49,
"loc": { "loc": {
@ -212,7 +212,7 @@
} }
], ],
"test": { "test": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 83, "start": 83,
"end": 84, "end": 84,
"loc": { "loc": {

View File

@ -501,7 +501,7 @@
}, },
"operator": "-", "operator": "-",
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 215, "start": 215,
"end": 216, "end": 216,
"loc": { "loc": {

View File

@ -94,7 +94,7 @@
} }
], ],
"test": { "test": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 22, "start": 22,
"end": 23, "end": 23,
"loc": { "loc": {

View File

@ -92,7 +92,7 @@
} }
}, },
"expression": { "expression": {
"type": "RegexLiteral", "type": "RegExpLiteral",
"start": 15, "start": 15,
"end": 20, "end": 20,
"loc": { "loc": {

View File

@ -89,7 +89,7 @@
}, },
"elements": [ "elements": [
{ {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 6, "start": 6,
"end": 8, "end": 8,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"init": { "init": {
"type": "RegexLiteral", "type": "RegExpLiteral",
"start": 8, "start": 8,
"end": 16, "end": 16,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"init": { "init": {
"type": "RegexLiteral", "type": "RegExpLiteral",
"start": 8, "start": 8,
"end": 16, "end": 16,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"init": { "init": {
"type": "RegexLiteral", "type": "RegExpLiteral",
"start": 8, "start": 8,
"end": 16, "end": 16,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"init": { "init": {
"type": "RegexLiteral", "type": "RegExpLiteral",
"start": 8, "start": 8,
"end": 17, "end": 17,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"init": { "init": {
"type": "RegexLiteral", "type": "RegExpLiteral",
"start": 8, "start": 8,
"end": 18, "end": 18,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"init": { "init": {
"type": "RegexLiteral", "type": "RegExpLiteral",
"start": 8, "start": 8,
"end": 21, "end": 21,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"init": { "init": {
"type": "RegexLiteral", "type": "RegExpLiteral",
"start": 8, "start": 8,
"end": 22, "end": 22,
"loc": { "loc": {

View File

@ -91,7 +91,7 @@
null, null,
null, null,
{ {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 9, "start": 9,
"end": 11, "end": 11,
"loc": { "loc": {

View File

@ -89,7 +89,7 @@
}, },
"elements": [ "elements": [
{ {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 6, "start": 6,
"end": 7, "end": 7,
"loc": { "loc": {
@ -109,7 +109,7 @@
"value": 1 "value": 1
}, },
{ {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 9, "start": 9,
"end": 10, "end": 10,
"loc": { "loc": {
@ -129,7 +129,7 @@
"value": 2 "value": 2
}, },
{ {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 12, "start": 12,
"end": 13, "end": 13,
"loc": { "loc": {

View File

@ -87,7 +87,7 @@
"name": "universe" "name": "universe"
}, },
"property": { "property": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 9, "start": 9,
"end": 11, "end": 11,
"loc": { "loc": {

View File

@ -88,7 +88,7 @@
}, },
"arguments": [ "arguments": [
{ {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 9, "start": 9,
"end": 11, "end": 11,
"loc": { "loc": {

View File

@ -116,7 +116,7 @@
}, },
"arguments": [ "arguments": [
{ {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 9, "start": 9,
"end": 11, "end": 11,
"loc": { "loc": {
@ -157,7 +157,7 @@
}, },
"arguments": [ "arguments": [
{ {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 22, "start": 22,
"end": 24, "end": 24,
"loc": { "loc": {
@ -177,7 +177,7 @@
"value": 14 "value": 14
}, },
{ {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 26, "start": 26,
"end": 27, "end": 27,
"loc": { "loc": {
@ -197,7 +197,7 @@
"value": 3 "value": 3
}, },
{ {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 29, "start": 29,
"end": 31, "end": 31,
"loc": { "loc": {

View File

@ -170,7 +170,7 @@
}, },
"arguments": [ "arguments": [
{ {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 40, "start": 40,
"end": 44, "end": 44,
"loc": { "loc": {

View File

@ -89,7 +89,7 @@
}, },
"elements": [ "elements": [
{ {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 6, "start": 6,
"end": 7, "end": 7,
"loc": { "loc": {
@ -109,7 +109,7 @@
"value": 1 "value": 1
}, },
{ {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 9, "start": 9,
"end": 10, "end": 10,
"loc": { "loc": {
@ -130,7 +130,7 @@
}, },
null, null,
{ {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 13, "start": 13,
"end": 14, "end": 14,
"loc": { "loc": {

View File

@ -73,7 +73,7 @@
"name": "y" "name": "y"
}, },
"consequent": { "consequent": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 4, "start": 4,
"end": 5, "end": 5,
"loc": { "loc": {
@ -93,7 +93,7 @@
"value": 1 "value": 1
}, },
"alternate": { "alternate": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 8, "start": 8,
"end": 9, "end": 9,
"loc": { "loc": {

View File

@ -105,7 +105,7 @@
} }
}, },
"consequent": { "consequent": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 9, "start": 9,
"end": 10, "end": 10,
"loc": { "loc": {
@ -125,7 +125,7 @@
"value": 1 "value": 1
}, },
"alternate": { "alternate": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 13, "start": 13,
"end": 14, "end": 14,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 4, "start": 4,
"end": 6, "end": 6,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "eval" "name": "eval"
}, },
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 7, "start": 7,
"end": 9, "end": 9,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "arguments" "name": "arguments"
}, },
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 12, "start": 12,
"end": 14, "end": 14,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 5, "start": 5,
"end": 7, "end": 7,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 5, "start": 5,
"end": 7, "end": 7,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 5, "start": 5,
"end": 7, "end": 7,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 5, "start": 5,
"end": 7, "end": 7,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 5, "start": 5,
"end": 7, "end": 7,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 6, "start": 6,
"end": 8, "end": 8,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 6, "start": 6,
"end": 8, "end": 8,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 7, "start": 7,
"end": 9, "end": 9,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 5, "start": 5,
"end": 7, "end": 7,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 5, "start": 5,
"end": 7, "end": 7,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 5, "start": 5,
"end": 7, "end": 7,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"init": { "init": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 8, "start": 8,
"end": 10, "end": 10,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "eval" "name": "eval"
}, },
"init": { "init": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 11, "start": 11,
"end": 13, "end": 13,
"loc": { "loc": {
@ -125,7 +125,7 @@
"name": "arguments" "name": "arguments"
}, },
"init": { "init": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 27, "start": 27,
"end": 29, "end": 29,
"loc": { "loc": {

View File

@ -122,7 +122,7 @@
"name": "answer" "name": "answer"
}, },
"value": { "value": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 14, "start": 14,
"end": 16, "end": 16,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"init": { "init": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 8, "start": 8,
"end": 10, "end": 10,
"loc": { "loc": {
@ -125,7 +125,7 @@
"name": "y" "name": "y"
}, },
"init": { "init": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 16, "start": 16,
"end": 17, "end": 17,
"loc": { "loc": {
@ -176,7 +176,7 @@
"name": "z" "name": "z"
}, },
"init": { "init": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 23, "start": 23,
"end": 27, "end": 27,
"loc": { "loc": {

View File

@ -122,7 +122,7 @@
"name": "if" "name": "if"
}, },
"value": { "value": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 10, "start": 10,
"end": 12, "end": 12,
"loc": { "loc": {

View File

@ -104,7 +104,7 @@
"name": "x" "name": "x"
}, },
"init": { "init": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 21, "start": 21,
"end": 22, "end": 22,
"loc": { "loc": {

View File

@ -188,7 +188,7 @@
}, },
"operator": "<", "operator": "<",
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 28, "start": 28,
"end": 30, "end": 30,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
}, },
"operator": "<", "operator": "<",
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 11, "start": 11,
"end": 13, "end": 13,
"loc": { "loc": {

View File

@ -122,7 +122,7 @@
"name": "true" "name": "true"
}, },
"value": { "value": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 12, "start": 12,
"end": 14, "end": 14,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 8, "start": 8,
"end": 9, "end": 9,
"loc": { "loc": {

View File

@ -88,7 +88,7 @@
"name": "x" "name": "x"
}, },
"init": { "init": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 12, "start": 12,
"end": 13, "end": 13,
"loc": { "loc": {

View File

@ -88,7 +88,7 @@
"name": "x" "name": "x"
}, },
"init": { "init": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 12, "start": 12,
"end": 13, "end": 13,
"loc": { "loc": {
@ -139,7 +139,7 @@
"name": "y" "name": "y"
}, },
"init": { "init": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 19, "start": 19,
"end": 20, "end": 20,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 8, "start": 8,
"end": 9, "end": 9,
"loc": { "loc": {
@ -126,7 +126,7 @@
}, },
"operator": "<", "operator": "<",
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 15, "start": 15,
"end": 17, "end": 17,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 8, "start": 8,
"end": 9, "end": 9,
"loc": { "loc": {
@ -126,7 +126,7 @@
}, },
"operator": "<", "operator": "<",
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 15, "start": 15,
"end": 17, "end": 17,
"loc": { "loc": {

View File

@ -74,7 +74,7 @@
"name": "x" "name": "x"
}, },
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 8, "start": 8,
"end": 9, "end": 9,
"loc": { "loc": {
@ -126,7 +126,7 @@
}, },
"operator": "<", "operator": "<",
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 15, "start": 15,
"end": 17, "end": 17,
"loc": { "loc": {

View File

@ -122,7 +122,7 @@
"name": "false" "name": "false"
}, },
"value": { "value": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 13, "start": 13,
"end": 15, "end": 15,
"loc": { "loc": {

View File

@ -122,7 +122,7 @@
"name": "null" "name": "null"
}, },
"value": { "value": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 12, "start": 12,
"end": 14, "end": 14,
"loc": { "loc": {

View File

@ -139,7 +139,7 @@
} }
], ],
"test": { "test": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 23, "start": 23,
"end": 25, "end": 25,
"loc": { "loc": {

View File

@ -126,7 +126,7 @@
"value": "answer" "value": "answer"
}, },
"value": { "value": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 16, "start": 16,
"end": 18, "end": 18,
"loc": { "loc": {

View File

@ -139,7 +139,7 @@
} }
], ],
"test": { "test": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 23, "start": 23,
"end": 25, "end": 25,
"loc": { "loc": {

View File

@ -122,7 +122,7 @@
"name": "x" "name": "x"
}, },
"value": { "value": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 9, "start": 9,
"end": 10, "end": 10,
"loc": { "loc": {
@ -176,7 +176,7 @@
"name": "x" "name": "x"
}, },
"value": { "value": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 15, "start": 15,
"end": 16, "end": 16,
"loc": { "loc": {

View File

@ -43,7 +43,7 @@
} }
}, },
"expression": { "expression": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 5, "start": 5,
"end": 7, "end": 7,
"loc": { "loc": {

View File

@ -89,7 +89,7 @@
"name": "x" "name": "x"
}, },
"init": { "init": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 10, "start": 10,
"end": 12, "end": 12,
"loc": { "loc": {
@ -140,7 +140,7 @@
"name": "y" "name": "y"
}, },
"init": { "init": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 18, "start": 18,
"end": 19, "end": 19,
"loc": { "loc": {

View File

@ -71,7 +71,7 @@
} }
}, },
"object": { "object": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 0, "start": 0,
"end": 4, "end": 4,
"loc": { "loc": {
@ -110,7 +110,7 @@
}, },
"arguments": [ "arguments": [
{ {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 14, "start": 14,
"end": 16, "end": 16,
"loc": { "loc": {

View File

@ -57,7 +57,7 @@
} }
}, },
"left": { "left": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 0, "start": 0,
"end": 4, "end": 4,
"loc": { "loc": {
@ -78,7 +78,7 @@
}, },
"operator": "+", "operator": "+",
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 5, "start": 5,
"end": 6, "end": 6,
"loc": { "loc": {

View File

@ -57,7 +57,7 @@
} }
}, },
"expression": { "expression": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 5, "start": 5,
"end": 7, "end": 7,
"loc": { "loc": {
@ -123,7 +123,7 @@
} }
}, },
"expression": { "expression": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 14, "start": 14,
"end": 16, "end": 16,
"loc": { "loc": {

View File

@ -43,7 +43,7 @@
} }
}, },
"test": { "test": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 3, "start": 3,
"end": 4, "end": 4,
"loc": { "loc": {
@ -77,7 +77,7 @@
} }
}, },
"expression": { "expression": {
"type": "RegexLiteral", "type": "RegExpLiteral",
"start": 5, "start": 5,
"end": 12, "end": 12,
"loc": { "loc": {

View File

@ -60,7 +60,7 @@
} }
}, },
"expression": { "expression": {
"type": "RegexLiteral", "type": "RegExpLiteral",
"start": 2, "start": 2,
"end": 5, "end": 5,
"loc": { "loc": {

View File

@ -122,7 +122,7 @@
}, },
"operator": ">", "operator": ">",
"right": { "right": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 8, "start": 8,
"end": 10, "end": 10,
"loc": { "loc": {

View File

@ -106,7 +106,7 @@
"shorthand": false, "shorthand": false,
"computed": false, "computed": false,
"key": { "key": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 10, "start": 10,
"end": 12, "end": 12,
"loc": { "loc": {

View File

@ -43,7 +43,7 @@
} }
}, },
"expression": { "expression": {
"type": "RegexLiteral", "type": "RegExpLiteral",
"start": 0, "start": 0,
"end": 8, "end": 8,
"loc": { "loc": {

View File

@ -106,7 +106,7 @@
"shorthand": false, "shorthand": false,
"computed": false, "computed": false,
"key": { "key": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 10, "start": 10,
"end": 12, "end": 12,
"loc": { "loc": {

View File

@ -122,7 +122,7 @@
"name": "get" "name": "get"
}, },
"value": { "value": {
"type": "NumberLiteral", "type": "NumericLiteral",
"start": 11, "start": 11,
"end": 13, "end": 13,
"loc": { "loc": {

Some files were not shown because too many files have changed in this diff Show More