node_modules/@babel/generator/lib/generators/expressions.js in immosquare-cleaner-0.1.47 vs node_modules/@babel/generator/lib/generators/expressions.js in immosquare-cleaner-0.1.48

- old
+ new

@@ -29,11 +29,11 @@ exports.UpdateExpression = UpdateExpression; exports.V8IntrinsicIdentifier = V8IntrinsicIdentifier; exports.YieldExpression = YieldExpression; exports._shouldPrintDecoratorsBeforeExport = _shouldPrintDecoratorsBeforeExport; var _t = require("@babel/types"); -var n = require("../node/index.js"); +var _index = require("../node/index.js"); const { isCallExpression, isLiteral, isMemberExpression, isNewExpression @@ -46,62 +46,64 @@ this.word(operator); this.space(); } else { this.token(operator); } - this.print(node.argument, node); + this.print(node.argument); } function DoExpression(node) { if (node.async) { this.word("async", true); this.space(); } 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); + this.print(node.expression); 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.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("?."); } this.tokenChar(40); + const exit = this.enterForStatementInit(false); this.printList(node.arguments, node); + exit(); this.rightParens(node); } function SequenceExpression(node) { this.printList(node.expressions, node); } @@ -109,55 +111,30 @@ this.word("this"); } function Super() { this.word("super"); } -function isDecoratorMemberExpression(node) { - switch (node.type) { - case "Identifier": - return true; - case "MemberExpression": - return !node.computed && node.property.type === "Identifier" && isDecoratorMemberExpression(node.object); - default: - return false; - } -} -function shouldParenthesizeDecoratorExpression(node) { - if (node.type === "ParenthesizedExpression") { - return false; - } - return !isDecoratorMemberExpression(node.type === "CallExpression" ? node.callee : node); -} function _shouldPrintDecoratorsBeforeExport(node) { if (typeof this.format.decoratorsBeforeExport === "boolean") { return this.format.decoratorsBeforeExport; } return typeof node.start === "number" && node.start === node.declaration.start; } function Decorator(node) { this.tokenChar(64); - const { - expression - } = node; - if (shouldParenthesizeDecoratorExpression(expression)) { - this.tokenChar(40); - this.print(expression, node); - this.tokenChar(41); - } else { - this.print(expression, node); - } + this.print(node.expression); this.newline(); } function OptionalMemberExpression(node) { let { computed } = node; const { 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"); } if (isLiteral(property) && typeof property.value === "number") { computed = true; @@ -165,36 +142,40 @@ if (optional) { this.token("?."); } 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); + 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); + exit(); this.rightParens(node); } function Import() { this.word("import"); } @@ -209,11 +190,11 @@ this.word("yield", true); if (node.delegate) { 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); @@ -222,71 +203,70 @@ } function EmptyStatement() { this.semicolon(true); } function ExpressionStatement(node) { - this.print(node.expression, node); + this.tokenContext |= _index.TokenContext.expressionStatement; + this.print(node.expression); this.semicolon(); } function AssignmentPattern(node) { - this.print(node.left, node); - if (node.left.optional) this.tokenChar(63); - this.print(node.left.typeAnnotation, node); + this.print(node.left); + if (node.left.type === "Identifier") { + if (node.left.optional) this.tokenChar(63); + this.print(node.left.typeAnnotation); + } this.space(); this.tokenChar(61); this.space(); - this.print(node.right, node); + this.print(node.right); } -function AssignmentExpression(node, parent) { - const parens = this.inForStatementInitCounter && node.operator === "in" && !n.needsParens(node, parent); - if (parens) { - this.tokenChar(40); - } - this.print(node.left, node); +function AssignmentExpression(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); - if (parens) { - this.tokenChar(41); - } + 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"); } let computed = node.computed; if (isLiteral(node.property) && typeof node.property.value === "number") { computed = true; } if (computed) { + const exit = this.enterForStatementInit(false); 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); this.word(node.name); } @@ -299,10 +279,10 @@ body } = node; if (body.body.length || body.directives.length) { this.newline(); } - this.print(body, node); + this.print(body); this.dedent(); this.rightBrace(node); } //# sourceMappingURL=expressions.js.map