Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/@babel/generator/lib/generators/expressions.js
rd565449 r0c6b92a 37 37 isLiteral, 38 38 isMemberExpression, 39 isNewExpression 39 isNewExpression, 40 isPattern 40 41 } = _t; 41 42 function UnaryExpression(node) { … … 49 50 this.token(operator); 50 51 } 51 this.print(node.argument , node);52 this.print(node.argument); 52 53 } 53 54 function DoExpression(node) { … … 58 59 this.word("do"); 59 60 this.space(); 60 this.print(node.body , node);61 this.print(node.body); 61 62 } 62 63 function ParenthesizedExpression(node) { 63 64 this.tokenChar(40); 64 this.print(node.expression, node); 65 const exit = this.enterDelimited(); 66 this.print(node.expression); 67 exit(); 65 68 this.rightParens(node); 66 69 } … … 68 71 if (node.prefix) { 69 72 this.token(node.operator); 70 this.print(node.argument , node);71 } else { 72 this.print Terminatorless(node.argument, node, true);73 this.print(node.argument); 74 } else { 75 this.print(node.argument, true); 73 76 this.token(node.operator); 74 77 } 75 78 } 76 79 function ConditionalExpression(node) { 77 this.print(node.test , node);80 this.print(node.test); 78 81 this.space(); 79 82 this.tokenChar(63); 80 83 this.space(); 81 this.print(node.consequent , node);84 this.print(node.consequent); 82 85 this.space(); 83 86 this.tokenChar(58); 84 87 this.space(); 85 this.print(node.alternate , node);88 this.print(node.alternate); 86 89 } 87 90 function NewExpression(node, parent) { 88 91 this.word("new"); 89 92 this.space(); 90 this.print(node.callee , node);93 this.print(node.callee); 91 94 if (this.format.minified && node.arguments.length === 0 && !node.optional && !isCallExpression(parent, { 92 95 callee: node … … 94 97 return; 95 98 } 96 this.print(node.typeArguments , node);97 this.print(node.typeParameters , node);99 this.print(node.typeArguments); 100 this.print(node.typeParameters); 98 101 if (node.optional) { 99 102 this.token("?."); 100 103 } 101 this.tokenChar(40); 102 const exit = this.enterForStatementInit(false); 103 this.printList(node.arguments, node); 104 if (node.arguments.length === 0 && this.tokenMap && !this.tokenMap.endMatches(node, ")")) { 105 return; 106 } 107 this.tokenChar(40); 108 const exit = this.enterDelimited(); 109 this.printList(node.arguments, { 110 printTrailingSeparator: this.shouldPrintTrailingComma(")") 111 }); 104 112 exit(); 105 113 this.rightParens(node); 106 114 } 107 115 function SequenceExpression(node) { 108 this.printList(node.expressions , node);116 this.printList(node.expressions); 109 117 } 110 118 function ThisExpression() { … … 122 130 function Decorator(node) { 123 131 this.tokenChar(64); 124 this.print(node.expression , node);132 this.print(node.expression); 125 133 this.newline(); 126 134 } … … 133 141 property 134 142 } = node; 135 this.print(node.object , node);143 this.print(node.object); 136 144 if (!computed && isMemberExpression(property)) { 137 145 throw new TypeError("Got a MemberExpression for MemberExpression property"); … … 145 153 if (computed) { 146 154 this.tokenChar(91); 147 this.print(property , node);155 this.print(property); 148 156 this.tokenChar(93); 149 157 } else { … … 151 159 this.tokenChar(46); 152 160 } 153 this.print(property , node);161 this.print(property); 154 162 } 155 163 } 156 164 function OptionalCallExpression(node) { 157 this.print(node.callee , node);158 this.print(node.typeParameters , node);165 this.print(node.callee); 166 this.print(node.typeParameters); 159 167 if (node.optional) { 160 168 this.token("?."); 161 169 } 162 this.print(node.typeArguments , node);163 this.tokenChar(40); 164 const exit = this.enter ForStatementInit(false);165 this.printList(node.arguments , node);170 this.print(node.typeArguments); 171 this.tokenChar(40); 172 const exit = this.enterDelimited(); 173 this.printList(node.arguments); 166 174 exit(); 167 175 this.rightParens(node); 168 176 } 169 177 function CallExpression(node) { 170 this.print(node.callee, node); 171 this.print(node.typeArguments, node); 172 this.print(node.typeParameters, node); 173 this.tokenChar(40); 174 const exit = this.enterForStatementInit(false); 175 this.printList(node.arguments, node); 178 this.print(node.callee); 179 this.print(node.typeArguments); 180 this.print(node.typeParameters); 181 this.tokenChar(40); 182 const exit = this.enterDelimited(); 183 this.printList(node.arguments, { 184 printTrailingSeparator: this.shouldPrintTrailingComma(")") 185 }); 176 186 exit(); 177 187 this.rightParens(node); … … 184 194 if (node.argument) { 185 195 this.space(); 186 this.printTerminatorless(node.argument , node, false);196 this.printTerminatorless(node.argument); 187 197 } 188 198 } … … 193 203 if (node.argument) { 194 204 this.space(); 195 this.print(node.argument , node);205 this.print(node.argument); 196 206 } 197 207 } else { 198 208 if (node.argument) { 199 209 this.space(); 200 this.printTerminatorless(node.argument , node, false);210 this.printTerminatorless(node.argument); 201 211 } 202 212 } … … 207 217 function ExpressionStatement(node) { 208 218 this.tokenContext |= _index.TokenContext.expressionStatement; 209 this.print(node.expression , node);219 this.print(node.expression); 210 220 this.semicolon(); 211 221 } 212 222 function AssignmentPattern(node) { 213 this.print(node.left , node);214 if (node.left.type === "Identifier" ) {223 this.print(node.left); 224 if (node.left.type === "Identifier" || isPattern(node.left)) { 215 225 if (node.left.optional) this.tokenChar(63); 216 this.print(node.left.typeAnnotation , node);226 this.print(node.left.typeAnnotation); 217 227 } 218 228 this.space(); 219 229 this.tokenChar(61); 220 230 this.space(); 221 this.print(node.right , node);231 this.print(node.right); 222 232 } 223 233 function AssignmentExpression(node) { 224 this.print(node.left , node);234 this.print(node.left); 225 235 this.space(); 226 236 if (node.operator === "in" || node.operator === "instanceof") { … … 228 238 } else { 229 239 this.token(node.operator); 230 } 231 this.space(); 232 this.print(node.right, node); 240 this._endsWithDiv = node.operator === "/"; 241 } 242 this.space(); 243 this.print(node.right); 233 244 } 234 245 function BindExpression(node) { 235 this.print(node.object , node);246 this.print(node.object); 236 247 this.token("::"); 237 this.print(node.callee , node);248 this.print(node.callee); 238 249 } 239 250 function MemberExpression(node) { 240 this.print(node.object , node);251 this.print(node.object); 241 252 if (!node.computed && isMemberExpression(node.property)) { 242 253 throw new TypeError("Got a MemberExpression for MemberExpression property"); … … 247 258 } 248 259 if (computed) { 249 const exit = this.enter ForStatementInit(false);260 const exit = this.enterDelimited(); 250 261 this.tokenChar(91); 251 this.print(node.property , node);262 this.print(node.property); 252 263 this.tokenChar(93); 253 264 exit(); 254 265 } else { 255 266 this.tokenChar(46); 256 this.print(node.property , node);267 this.print(node.property); 257 268 } 258 269 } 259 270 function MetaProperty(node) { 260 this.print(node.meta , node);271 this.print(node.meta); 261 272 this.tokenChar(46); 262 this.print(node.property , node);273 this.print(node.property); 263 274 } 264 275 function PrivateName(node) { 265 276 this.tokenChar(35); 266 this.print(node.id , node);277 this.print(node.id); 267 278 } 268 279 function V8IntrinsicIdentifier(node) { … … 281 292 this.newline(); 282 293 } 283 this.print(body , node);294 this.print(body); 284 295 this.dedent(); 285 296 this.rightBrace(node);
Note:
See TracChangeset
for help on using the changeset viewer.