Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/@babel/generator/lib/generators/flow.js
rd565449 r0c6b92a 90 90 } 91 91 function ArrayTypeAnnotation(node) { 92 this.print(node.elementType, node,true);92 this.print(node.elementType, true); 93 93 this.tokenChar(91); 94 94 this.tokenChar(93); … … 119 119 this.word("function"); 120 120 this.space(); 121 this.print(node.id , node);122 this.print(node.id.typeAnnotation.typeAnnotation , node);121 this.print(node.id); 122 this.print(node.id.typeAnnotation.typeAnnotation); 123 123 if (node.predicate) { 124 124 this.space(); 125 this.print(node.predicate , node);125 this.print(node.predicate); 126 126 } 127 127 this.semicolon(); … … 135 135 this.word("checks"); 136 136 this.tokenChar(40); 137 this.print(node.value , node);137 this.print(node.value); 138 138 this.tokenChar(41); 139 139 } … … 148 148 this.word("module"); 149 149 this.space(); 150 this.print(node.id , node);151 this.space(); 152 this.print(node.body , node);150 this.print(node.id); 151 this.space(); 152 this.print(node.body); 153 153 } 154 154 function DeclareModuleExports(node) { … … 158 158 this.tokenChar(46); 159 159 this.word("exports"); 160 this.print(node.typeAnnotation , node);160 this.print(node.typeAnnotation); 161 161 } 162 162 function DeclareTypeAlias(node) { … … 179 179 this.word("var"); 180 180 this.space(); 181 this.print(node.id , node);182 this.print(node.id.typeAnnotation , node);181 this.print(node.id); 182 this.print(node.id.typeAnnotation); 183 183 this.semicolon(); 184 184 } … … 206 206 this.word("enum"); 207 207 this.space(); 208 this.print(id , node);209 this.print(body , node);208 this.print(id); 209 this.print(body); 210 210 } 211 211 function enumExplicitType(context, name, hasExplicitType) { … … 226 226 context.newline(); 227 227 for (const member of members) { 228 context.print(member , node);228 context.print(member); 229 229 context.newline(); 230 230 } … … 265 265 id 266 266 } = node; 267 this.print(id , node);267 this.print(id); 268 268 this.tokenChar(44); 269 269 } 270 270 function enumInitializedMember(context, node) { 271 const { 272 id, 273 init 274 } = node; 275 context.print(id, node); 271 context.print(node.id); 276 272 context.space(); 277 273 context.token("="); 278 274 context.space(); 279 context.print( init, node);275 context.print(node.init); 280 276 context.token(","); 281 277 } … … 292 288 if (node.declaration) { 293 289 const declar = node.declaration; 294 this.print(declar , node);290 this.print(declar); 295 291 if (!isStatement(declar)) this.semicolon(); 296 292 } else { … … 298 294 if (node.specifiers.length) { 299 295 this.space(); 300 this.printList(node.specifiers , node);296 this.printList(node.specifiers); 301 297 this.space(); 302 298 } … … 306 302 this.word("from"); 307 303 this.space(); 308 this.print(node.source , node);304 this.print(node.source); 309 305 } 310 306 this.semicolon(); … … 315 311 } 316 312 function FunctionTypeAnnotation(node, parent) { 317 this.print(node.typeParameters , node);313 this.print(node.typeParameters); 318 314 this.tokenChar(40); 319 315 if (node.this) { … … 321 317 this.tokenChar(58); 322 318 this.space(); 323 this.print(node.this.typeAnnotation , node);319 this.print(node.this.typeAnnotation); 324 320 if (node.params.length || node.rest) { 325 321 this.tokenChar(44); … … 327 323 } 328 324 } 329 this.printList(node.params , node);325 this.printList(node.params); 330 326 if (node.rest) { 331 327 if (node.params.length) { … … 334 330 } 335 331 this.token("..."); 336 this.print(node.rest , node);332 this.print(node.rest); 337 333 } 338 334 this.tokenChar(41); … … 345 341 } 346 342 this.space(); 347 this.print(node.returnType , node);343 this.print(node.returnType); 348 344 } 349 345 function FunctionTypeParam(node) { 350 this.print(node.name , node);346 this.print(node.name); 351 347 if (node.optional) this.tokenChar(63); 352 348 if (node.name) { … … 354 350 this.space(); 355 351 } 356 this.print(node.typeAnnotation , node);352 this.print(node.typeAnnotation); 357 353 } 358 354 function InterfaceExtends(node) { 359 this.print(node.id , node);360 this.print(node.typeParameters, node,true);355 this.print(node.id); 356 this.print(node.typeParameters, true); 361 357 } 362 358 function _interfaceish(node) { 363 359 var _node$extends; 364 this.print(node.id , node);365 this.print(node.typeParameters , node);360 this.print(node.id); 361 this.print(node.typeParameters); 366 362 if ((_node$extends = node.extends) != null && _node$extends.length) { 367 363 this.space(); 368 364 this.word("extends"); 369 365 this.space(); 370 this.printList(node.extends , node);366 this.printList(node.extends); 371 367 } 372 368 if (node.type === "DeclareClass") { … … 376 372 this.word("mixins"); 377 373 this.space(); 378 this.printList(node.mixins , node);374 this.printList(node.mixins); 379 375 } 380 376 if ((_node$implements = node.implements) != null && _node$implements.length) { … … 382 378 this.word("implements"); 383 379 this.space(); 384 this.printList(node.implements , node);385 } 386 } 387 this.space(); 388 this.print(node.body , node);380 this.printList(node.implements); 381 } 382 } 383 this.space(); 384 this.print(node.body); 389 385 } 390 386 function _variance(node) { … … 404 400 this._interfaceish(node); 405 401 } 406 function andSeparator( ) {407 this.space(); 408 this.token Char(38);402 function andSeparator(occurrenceCount) { 403 this.space(); 404 this.token("&", false, occurrenceCount); 409 405 this.space(); 410 406 } … … 416 412 this.word("extends"); 417 413 this.space(); 418 this.printList(node.extends , node);419 } 420 this.space(); 421 this.print(node.body , node);414 this.printList(node.extends); 415 } 416 this.space(); 417 this.print(node.body); 422 418 } 423 419 function IntersectionTypeAnnotation(node) { 424 this.printJoin(node.types, node,{420 this.printJoin(node.types, { 425 421 separator: andSeparator 426 422 }); … … 434 430 function NullableTypeAnnotation(node) { 435 431 this.tokenChar(63); 436 this.print(node.typeAnnotation , node);432 this.print(node.typeAnnotation); 437 433 } 438 434 function NumberTypeAnnotation() { … … 447 443 function TupleTypeAnnotation(node) { 448 444 this.tokenChar(91); 449 this.printList(node.types , node);445 this.printList(node.types); 450 446 this.tokenChar(93); 451 447 } … … 453 449 this.word("typeof"); 454 450 this.space(); 455 this.print(node.argument , node);451 this.print(node.argument); 456 452 } 457 453 function TypeAlias(node) { 458 454 this.word("type"); 459 455 this.space(); 460 this.print(node.id , node);461 this.print(node.typeParameters , node);456 this.print(node.id); 457 this.print(node.typeParameters); 462 458 this.space(); 463 459 this.tokenChar(61); 464 460 this.space(); 465 this.print(node.right , node);461 this.print(node.right); 466 462 this.semicolon(); 467 463 } … … 474 470 this.tokenChar(63); 475 471 } 476 this.print(node.typeAnnotation , node);472 this.print(node.typeAnnotation); 477 473 } 478 474 function TypeParameterInstantiation(node) { 479 475 this.tokenChar(60); 480 this.printList(node.params, node,{});476 this.printList(node.params, {}); 481 477 this.tokenChar(62); 482 478 } … … 485 481 this.word(node.name); 486 482 if (node.bound) { 487 this.print(node.bound , node);483 this.print(node.bound); 488 484 } 489 485 if (node.default) { … … 491 487 this.tokenChar(61); 492 488 this.space(); 493 this.print(node.default , node);489 this.print(node.default); 494 490 } 495 491 } … … 499 495 this.word("type"); 500 496 this.space(); 501 this.print(node.id , node);502 this.print(node.typeParameters , node);497 this.print(node.id); 498 this.print(node.typeParameters); 503 499 if (node.supertype) { 504 500 this.tokenChar(58); 505 501 this.space(); 506 this.print(node.supertype , node);502 this.print(node.supertype); 507 503 } 508 504 if (node.impltype) { … … 510 506 this.tokenChar(61); 511 507 this.space(); 512 this.print(node.impltype , node);508 this.print(node.impltype); 513 509 } 514 510 this.semicolon(); … … 524 520 this.newline(); 525 521 this.space(); 526 this.printJoin(props, node,{522 this.printJoin(props, { 527 523 addNewlines(leading) { 528 524 if (leading && !props[0]) return 1; … … 560 556 this.tokenChar(91); 561 557 this.tokenChar(91); 562 this.print(node.id , node);558 this.print(node.id); 563 559 this.tokenChar(93); 564 560 this.tokenChar(93); … … 568 564 this.space(); 569 565 } 570 this.print(node.value , node);566 this.print(node.value); 571 567 } 572 568 function ObjectTypeCallProperty(node) { … … 575 571 this.space(); 576 572 } 577 this.print(node.value , node);573 this.print(node.value); 578 574 } 579 575 function ObjectTypeIndexer(node) { … … 585 581 this.tokenChar(91); 586 582 if (node.id) { 587 this.print(node.id , node);583 this.print(node.id); 588 584 this.tokenChar(58); 589 585 this.space(); 590 586 } 591 this.print(node.key , node);587 this.print(node.key); 592 588 this.tokenChar(93); 593 589 this.tokenChar(58); 594 590 this.space(); 595 this.print(node.value , node);591 this.print(node.value); 596 592 } 597 593 function ObjectTypeProperty(node) { … … 609 605 } 610 606 this._variance(node); 611 this.print(node.key , node);607 this.print(node.key); 612 608 if (node.optional) this.tokenChar(63); 613 609 if (!node.method) { … … 615 611 this.space(); 616 612 } 617 this.print(node.value , node);613 this.print(node.value); 618 614 } 619 615 function ObjectTypeSpreadProperty(node) { 620 616 this.token("..."); 621 this.print(node.argument , node);617 this.print(node.argument); 622 618 } 623 619 function QualifiedTypeIdentifier(node) { 624 this.print(node.qualification , node);620 this.print(node.qualification); 625 621 this.tokenChar(46); 626 this.print(node.id , node);622 this.print(node.id); 627 623 } 628 624 function SymbolTypeAnnotation() { 629 625 this.word("symbol"); 630 626 } 631 function orSeparator( ) {632 this.space(); 633 this.token Char(124);627 function orSeparator(occurrenceCount) { 628 this.space(); 629 this.token("|", false, occurrenceCount); 634 630 this.space(); 635 631 } 636 632 function UnionTypeAnnotation(node) { 637 this.printJoin(node.types, node,{633 this.printJoin(node.types, { 638 634 separator: orSeparator 639 635 }); … … 641 637 function TypeCastExpression(node) { 642 638 this.tokenChar(40); 643 this.print(node.expression , node);644 this.print(node.typeAnnotation , node);639 this.print(node.expression); 640 this.print(node.typeAnnotation); 645 641 this.tokenChar(41); 646 642 } … … 656 652 } 657 653 function IndexedAccessType(node) { 658 this.print(node.objectType, node,true);654 this.print(node.objectType, true); 659 655 this.tokenChar(91); 660 this.print(node.indexType , node);656 this.print(node.indexType); 661 657 this.tokenChar(93); 662 658 } 663 659 function OptionalIndexedAccessType(node) { 664 this.print(node.objectType , node);660 this.print(node.objectType); 665 661 if (node.optional) { 666 662 this.token("?."); 667 663 } 668 664 this.tokenChar(91); 669 this.print(node.indexType , node);665 this.print(node.indexType); 670 666 this.tokenChar(93); 671 667 }
Note:
See TracChangeset
for help on using the changeset viewer.