feat: refactoring project
This commit is contained in:
109
node_modules/@babel/generator/lib/generators/expressions.js
generated
vendored
109
node_modules/@babel/generator/lib/generators/expressions.js
generated
vendored
@@ -36,7 +36,8 @@ const {
|
||||
isCallExpression,
|
||||
isLiteral,
|
||||
isMemberExpression,
|
||||
isNewExpression
|
||||
isNewExpression,
|
||||
isPattern
|
||||
} = _t;
|
||||
function UnaryExpression(node) {
|
||||
const {
|
||||
@@ -48,7 +49,7 @@ function UnaryExpression(node) {
|
||||
} else {
|
||||
this.token(operator);
|
||||
}
|
||||
this.print(node.argument, node);
|
||||
this.print(node.argument);
|
||||
}
|
||||
function DoExpression(node) {
|
||||
if (node.async) {
|
||||
@@ -57,55 +58,62 @@ function DoExpression(node) {
|
||||
}
|
||||
this.word("do");
|
||||
this.space();
|
||||
this.print(node.body, node);
|
||||
this.print(node.body);
|
||||
}
|
||||
function ParenthesizedExpression(node) {
|
||||
this.tokenChar(40);
|
||||
this.print(node.expression, node);
|
||||
const exit = this.enterDelimited();
|
||||
this.print(node.expression);
|
||||
exit();
|
||||
this.rightParens(node);
|
||||
}
|
||||
function UpdateExpression(node) {
|
||||
if (node.prefix) {
|
||||
this.token(node.operator);
|
||||
this.print(node.argument, node);
|
||||
this.print(node.argument);
|
||||
} else {
|
||||
this.printTerminatorless(node.argument, node, true);
|
||||
this.print(node.argument, true);
|
||||
this.token(node.operator);
|
||||
}
|
||||
}
|
||||
function ConditionalExpression(node) {
|
||||
this.print(node.test, node);
|
||||
this.print(node.test);
|
||||
this.space();
|
||||
this.tokenChar(63);
|
||||
this.space();
|
||||
this.print(node.consequent, node);
|
||||
this.print(node.consequent);
|
||||
this.space();
|
||||
this.tokenChar(58);
|
||||
this.space();
|
||||
this.print(node.alternate, node);
|
||||
this.print(node.alternate);
|
||||
}
|
||||
function NewExpression(node, parent) {
|
||||
this.word("new");
|
||||
this.space();
|
||||
this.print(node.callee, node);
|
||||
this.print(node.callee);
|
||||
if (this.format.minified && node.arguments.length === 0 && !node.optional && !isCallExpression(parent, {
|
||||
callee: node
|
||||
}) && !isMemberExpression(parent) && !isNewExpression(parent)) {
|
||||
return;
|
||||
}
|
||||
this.print(node.typeArguments, node);
|
||||
this.print(node.typeParameters, node);
|
||||
this.print(node.typeArguments);
|
||||
this.print(node.typeParameters);
|
||||
if (node.optional) {
|
||||
this.token("?.");
|
||||
}
|
||||
if (node.arguments.length === 0 && this.tokenMap && !this.tokenMap.endMatches(node, ")")) {
|
||||
return;
|
||||
}
|
||||
this.tokenChar(40);
|
||||
const exit = this.enterForStatementInit(false);
|
||||
this.printList(node.arguments, node);
|
||||
const exit = this.enterDelimited();
|
||||
this.printList(node.arguments, {
|
||||
printTrailingSeparator: this.shouldPrintTrailingComma(")")
|
||||
});
|
||||
exit();
|
||||
this.rightParens(node);
|
||||
}
|
||||
function SequenceExpression(node) {
|
||||
this.printList(node.expressions, node);
|
||||
this.printList(node.expressions);
|
||||
}
|
||||
function ThisExpression() {
|
||||
this.word("this");
|
||||
@@ -121,7 +129,7 @@ function _shouldPrintDecoratorsBeforeExport(node) {
|
||||
}
|
||||
function Decorator(node) {
|
||||
this.tokenChar(64);
|
||||
this.print(node.expression, node);
|
||||
this.print(node.expression);
|
||||
this.newline();
|
||||
}
|
||||
function OptionalMemberExpression(node) {
|
||||
@@ -132,7 +140,7 @@ function OptionalMemberExpression(node) {
|
||||
optional,
|
||||
property
|
||||
} = node;
|
||||
this.print(node.object, node);
|
||||
this.print(node.object);
|
||||
if (!computed && isMemberExpression(property)) {
|
||||
throw new TypeError("Got a MemberExpression for MemberExpression property");
|
||||
}
|
||||
@@ -144,35 +152,37 @@ function OptionalMemberExpression(node) {
|
||||
}
|
||||
if (computed) {
|
||||
this.tokenChar(91);
|
||||
this.print(property, node);
|
||||
this.print(property);
|
||||
this.tokenChar(93);
|
||||
} else {
|
||||
if (!optional) {
|
||||
this.tokenChar(46);
|
||||
}
|
||||
this.print(property, node);
|
||||
this.print(property);
|
||||
}
|
||||
}
|
||||
function OptionalCallExpression(node) {
|
||||
this.print(node.callee, node);
|
||||
this.print(node.typeParameters, node);
|
||||
this.print(node.callee);
|
||||
this.print(node.typeParameters);
|
||||
if (node.optional) {
|
||||
this.token("?.");
|
||||
}
|
||||
this.print(node.typeArguments, node);
|
||||
this.print(node.typeArguments);
|
||||
this.tokenChar(40);
|
||||
const exit = this.enterForStatementInit(false);
|
||||
this.printList(node.arguments, node);
|
||||
const exit = this.enterDelimited();
|
||||
this.printList(node.arguments);
|
||||
exit();
|
||||
this.rightParens(node);
|
||||
}
|
||||
function CallExpression(node) {
|
||||
this.print(node.callee, node);
|
||||
this.print(node.typeArguments, node);
|
||||
this.print(node.typeParameters, node);
|
||||
this.print(node.callee);
|
||||
this.print(node.typeArguments);
|
||||
this.print(node.typeParameters);
|
||||
this.tokenChar(40);
|
||||
const exit = this.enterForStatementInit(false);
|
||||
this.printList(node.arguments, node);
|
||||
const exit = this.enterDelimited();
|
||||
this.printList(node.arguments, {
|
||||
printTrailingSeparator: this.shouldPrintTrailingComma(")")
|
||||
});
|
||||
exit();
|
||||
this.rightParens(node);
|
||||
}
|
||||
@@ -183,7 +193,7 @@ function AwaitExpression(node) {
|
||||
this.word("await");
|
||||
if (node.argument) {
|
||||
this.space();
|
||||
this.printTerminatorless(node.argument, node, false);
|
||||
this.printTerminatorless(node.argument);
|
||||
}
|
||||
}
|
||||
function YieldExpression(node) {
|
||||
@@ -192,12 +202,12 @@ function YieldExpression(node) {
|
||||
this.tokenChar(42);
|
||||
if (node.argument) {
|
||||
this.space();
|
||||
this.print(node.argument, node);
|
||||
this.print(node.argument);
|
||||
}
|
||||
} else {
|
||||
if (node.argument) {
|
||||
this.space();
|
||||
this.printTerminatorless(node.argument, node, false);
|
||||
this.printTerminatorless(node.argument);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -206,38 +216,39 @@ function EmptyStatement() {
|
||||
}
|
||||
function ExpressionStatement(node) {
|
||||
this.tokenContext |= _index.TokenContext.expressionStatement;
|
||||
this.print(node.expression, node);
|
||||
this.print(node.expression);
|
||||
this.semicolon();
|
||||
}
|
||||
function AssignmentPattern(node) {
|
||||
this.print(node.left, node);
|
||||
if (node.left.type === "Identifier") {
|
||||
this.print(node.left);
|
||||
if (node.left.type === "Identifier" || isPattern(node.left)) {
|
||||
if (node.left.optional) this.tokenChar(63);
|
||||
this.print(node.left.typeAnnotation, node);
|
||||
this.print(node.left.typeAnnotation);
|
||||
}
|
||||
this.space();
|
||||
this.tokenChar(61);
|
||||
this.space();
|
||||
this.print(node.right, node);
|
||||
this.print(node.right);
|
||||
}
|
||||
function AssignmentExpression(node) {
|
||||
this.print(node.left, node);
|
||||
this.print(node.left);
|
||||
this.space();
|
||||
if (node.operator === "in" || node.operator === "instanceof") {
|
||||
this.word(node.operator);
|
||||
} else {
|
||||
this.token(node.operator);
|
||||
this._endsWithDiv = node.operator === "/";
|
||||
}
|
||||
this.space();
|
||||
this.print(node.right, node);
|
||||
this.print(node.right);
|
||||
}
|
||||
function BindExpression(node) {
|
||||
this.print(node.object, node);
|
||||
this.print(node.object);
|
||||
this.token("::");
|
||||
this.print(node.callee, node);
|
||||
this.print(node.callee);
|
||||
}
|
||||
function MemberExpression(node) {
|
||||
this.print(node.object, node);
|
||||
this.print(node.object);
|
||||
if (!node.computed && isMemberExpression(node.property)) {
|
||||
throw new TypeError("Got a MemberExpression for MemberExpression property");
|
||||
}
|
||||
@@ -246,24 +257,24 @@ function MemberExpression(node) {
|
||||
computed = true;
|
||||
}
|
||||
if (computed) {
|
||||
const exit = this.enterForStatementInit(false);
|
||||
const exit = this.enterDelimited();
|
||||
this.tokenChar(91);
|
||||
this.print(node.property, node);
|
||||
this.print(node.property);
|
||||
this.tokenChar(93);
|
||||
exit();
|
||||
} else {
|
||||
this.tokenChar(46);
|
||||
this.print(node.property, node);
|
||||
this.print(node.property);
|
||||
}
|
||||
}
|
||||
function MetaProperty(node) {
|
||||
this.print(node.meta, node);
|
||||
this.print(node.meta);
|
||||
this.tokenChar(46);
|
||||
this.print(node.property, node);
|
||||
this.print(node.property);
|
||||
}
|
||||
function PrivateName(node) {
|
||||
this.tokenChar(35);
|
||||
this.print(node.id, node);
|
||||
this.print(node.id);
|
||||
}
|
||||
function V8IntrinsicIdentifier(node) {
|
||||
this.tokenChar(37);
|
||||
@@ -280,7 +291,7 @@ function ModuleExpression(node) {
|
||||
if (body.body.length || body.directives.length) {
|
||||
this.newline();
|
||||
}
|
||||
this.print(body, node);
|
||||
this.print(body);
|
||||
this.dedent();
|
||||
this.rightBrace(node);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user