Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/@babel/generator/lib/node/parentheses.js
rd565449 r0c6b92a 4 4 value: true 5 5 }); 6 exports.ArrowFunctionExpression = ArrowFunctionExpression;7 6 exports.AssignmentExpression = AssignmentExpression; 8 7 exports.Binary = Binary; 9 8 exports.BinaryExpression = BinaryExpression; 10 9 exports.ClassExpression = ClassExpression; 11 exports. ConditionalExpression = ConditionalExpression;10 exports.ArrowFunctionExpression = exports.ConditionalExpression = ConditionalExpression; 12 11 exports.DoExpression = DoExpression; 13 12 exports.FunctionExpression = FunctionExpression; … … 34 33 isBinaryExpression, 35 34 isCallExpression, 36 isExportDeclaration,37 35 isForOfStatement, 38 36 isIndexedAccessType, … … 40 38 isObjectPattern, 41 39 isOptionalMemberExpression, 42 isYieldExpression 40 isYieldExpression, 41 isStatement 43 42 } = _t; 44 43 const PRECEDENCE = new Map([["||", 0], ["??", 0], ["|>", 0], ["&&", 1], ["|", 2], ["^", 3], ["&", 4], ["==", 5], ["===", 5], ["!=", 5], ["!==", 5], ["<", 6], [">", 6], ["<=", 6], [">=", 6], ["in", 6], ["instanceof", 6], [">>", 7], ["<<", 7], [">>>", 7], ["+", 8], ["-", 8], ["*", 9], ["/", 9], ["%", 9], ["**", 10]]); … … 67 66 function FunctionTypeAnnotation(node, parent, tokenContext) { 68 67 const parentType = parent.type; 69 return parentType === "UnionTypeAnnotation" || parentType === "IntersectionTypeAnnotation" || parentType === "ArrayTypeAnnotation" || Boolean(tokenContext & _index.TokenContext.arrowFlowReturnType); 68 return (parentType === "UnionTypeAnnotation" || parentType === "IntersectionTypeAnnotation" || parentType === "ArrayTypeAnnotation" || Boolean(tokenContext & _index.TokenContext.arrowFlowReturnType) 69 ); 70 70 } 71 71 function UpdateExpression(node, parent) { 72 72 return hasPostfixPart(node, parent) || isClassExtendsClause(node, parent); 73 73 } 74 function needsParenBeforeExpressionBrace(tokenContext) { 75 return Boolean(tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.arrowBody)); 76 } 74 77 function ObjectExpression(node, parent, tokenContext) { 75 return Boolean(tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.arrowBody));78 return needsParenBeforeExpressionBrace(tokenContext); 76 79 } 77 80 function DoExpression(node, parent, tokenContext) { … … 116 119 function TSUnionType(node, parent) { 117 120 const parentType = parent.type; 118 return parentType === "TSArrayType" || parentType === "TSOptionalType" || parentType === "TSIntersectionType" || parentType === "TS UnionType" || parentType === "TSRestType";121 return parentType === "TSArrayType" || parentType === "TSOptionalType" || parentType === "TSIntersectionType" || parentType === "TSRestType"; 119 122 } 120 123 function TSInferType(node, parent) { … … 131 134 function SequenceExpression(node, parent) { 132 135 const parentType = parent.type; 133 if (parentType === " ForStatement" || parentType === "ThrowStatement" || parentType === "ReturnStatement" || parentType === "IfStatement" && parent.test === node || parentType === "WhileStatement" && parent.test === node || parentType === "ForInStatement" && parent.right === node || parentType === "SwitchStatement" && parent.discriminant === node || parentType === "ExpressionStatement" && parent.expression === node) {136 if (parentType === "SequenceExpression" || parentType === "ParenthesizedExpression" || parentType === "MemberExpression" && parent.property === node || parentType === "OptionalMemberExpression" && parent.property === node || parentType === "TemplateLiteral") { 134 137 return false; 135 138 } 136 return true; 139 if (parentType === "ClassDeclaration") { 140 return true; 141 } 142 if (parentType === "ForOfStatement") { 143 return parent.right === node; 144 } 145 if (parentType === "ExportDefaultDeclaration") { 146 return true; 147 } 148 return !isStatement(parent); 137 149 } 138 150 function YieldExpression(node, parent) { … … 149 161 return Boolean(tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.exportDefault)); 150 162 } 151 function ArrowFunctionExpression(node, parent) {152 return isExportDeclaration(parent) || ConditionalExpression(node, parent);153 }154 163 function ConditionalExpression(node, parent) { 155 164 const parentType = parent.type; … … 162 171 return isCallExpression(parent) && parent.callee === node || isMemberExpression(parent) && parent.object === node; 163 172 } 164 function AssignmentExpression(node, parent ) {165 if ( isObjectPattern(node.left)) {173 function AssignmentExpression(node, parent, tokenContext) { 174 if (needsParenBeforeExpressionBrace(tokenContext) && isObjectPattern(node.left)) { 166 175 return true; 167 176 } else { … … 182 191 } 183 192 } 184 function Identifier(node, parent, tokenContext ) {193 function Identifier(node, parent, tokenContext, _inForInit, getRawIdentifier) { 185 194 var _node$extra; 186 195 const parentType = parent.type; … … 190 199 return true; 191 200 } 201 } 202 if (getRawIdentifier && getRawIdentifier(node) !== node.name) { 203 return false; 192 204 } 193 205 if (node.name === "let") {
Note:
See TracChangeset
for help on using the changeset viewer.