OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library fasta.kernel_library_builder; | 5 library fasta.kernel_library_builder; |
6 | 6 |
7 import 'package:front_end/src/scanner/token.dart' show Token; | 7 import 'package:front_end/src/scanner/token.dart' show Token; |
8 | 8 |
9 import 'package:kernel/ast.dart'; | 9 import 'package:kernel/ast.dart'; |
10 | 10 |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 return suffix; | 494 return suffix; |
495 } | 495 } |
496 | 496 |
497 void addProcedure( | 497 void addProcedure( |
498 List<MetadataBuilder> metadata, | 498 List<MetadataBuilder> metadata, |
499 int modifiers, | 499 int modifiers, |
500 KernelTypeBuilder returnType, | 500 KernelTypeBuilder returnType, |
501 String name, | 501 String name, |
502 List<TypeVariableBuilder> typeVariables, | 502 List<TypeVariableBuilder> typeVariables, |
503 List<FormalParameterBuilder> formals, | 503 List<FormalParameterBuilder> formals, |
504 AsyncMarker asyncModifier, | |
505 ProcedureKind kind, | 504 ProcedureKind kind, |
506 int charOffset, | 505 int charOffset, |
507 int charOpenParenOffset, | 506 int charOpenParenOffset, |
508 int charEndOffset, | 507 int charEndOffset, |
509 String nativeMethodName, | 508 String nativeMethodName, |
510 {bool isTopLevel}) { | 509 {bool isTopLevel}) { |
511 // Nested declaration began in `OutlineBuilder.beginMethod` or | 510 // Nested declaration began in `OutlineBuilder.beginMethod` or |
512 // `OutlineBuilder.beginTopLevelMethod`. | 511 // `OutlineBuilder.beginTopLevelMethod`. |
513 endNestedDeclaration().resolveTypes(typeVariables, this); | 512 endNestedDeclaration().resolveTypes(typeVariables, this); |
514 ProcedureBuilder procedure; | 513 ProcedureBuilder procedure; |
(...skipping 14 matching lines...) Expand all Loading... |
529 charEndOffset, | 528 charEndOffset, |
530 nativeMethodName); | 529 nativeMethodName); |
531 } else { | 530 } else { |
532 procedure = new KernelProcedureBuilder( | 531 procedure = new KernelProcedureBuilder( |
533 metadata, | 532 metadata, |
534 modifiers, | 533 modifiers, |
535 returnType, | 534 returnType, |
536 name, | 535 name, |
537 typeVariables, | 536 typeVariables, |
538 formals, | 537 formals, |
539 asyncModifier, | |
540 kind, | 538 kind, |
541 this, | 539 this, |
542 charOffset, | 540 charOffset, |
543 charOpenParenOffset, | 541 charOpenParenOffset, |
544 charEndOffset, | 542 charEndOffset, |
545 nativeMethodName); | 543 nativeMethodName); |
546 } | 544 } |
547 addBuilder(name, procedure, charOffset); | 545 addBuilder(name, procedure, charOffset); |
548 if (nativeMethodName != null) { | 546 if (nativeMethodName != null) { |
549 addNativeMethod(procedure); | 547 addNativeMethod(procedure); |
550 } | 548 } |
551 } | 549 } |
552 | 550 |
553 void addFactoryMethod( | 551 void addFactoryMethod( |
554 List<MetadataBuilder> metadata, | 552 List<MetadataBuilder> metadata, |
555 int modifiers, | 553 int modifiers, |
556 ConstructorReferenceBuilder constructorNameReference, | 554 ConstructorReferenceBuilder constructorNameReference, |
557 List<FormalParameterBuilder> formals, | 555 List<FormalParameterBuilder> formals, |
558 AsyncMarker asyncModifier, | |
559 ConstructorReferenceBuilder redirectionTarget, | 556 ConstructorReferenceBuilder redirectionTarget, |
560 int charOffset, | 557 int charOffset, |
561 int charOpenParenOffset, | 558 int charOpenParenOffset, |
562 int charEndOffset, | 559 int charEndOffset, |
563 String nativeMethodName) { | 560 String nativeMethodName) { |
564 // Nested declaration began in `OutlineBuilder.beginFactoryMethod`. | 561 // Nested declaration began in `OutlineBuilder.beginFactoryMethod`. |
565 DeclarationBuilder<KernelTypeBuilder> factoryDeclaration = | 562 DeclarationBuilder<KernelTypeBuilder> factoryDeclaration = |
566 endNestedDeclaration(); | 563 endNestedDeclaration(); |
567 String name = constructorNameReference.name; | 564 String name = constructorNameReference.name; |
568 String constructorName = | 565 String constructorName = |
569 computeAndValidateConstructorName(name, charOffset); | 566 computeAndValidateConstructorName(name, charOffset); |
570 if (constructorName != null) { | 567 if (constructorName != null) { |
571 name = constructorName; | 568 name = constructorName; |
572 } | 569 } |
573 assert(constructorNameReference.suffix == null); | 570 assert(constructorNameReference.suffix == null); |
574 KernelProcedureBuilder procedure = new KernelProcedureBuilder( | 571 KernelProcedureBuilder procedure = new KernelProcedureBuilder( |
575 metadata, | 572 metadata, |
576 staticMask | modifiers, | 573 staticMask | modifiers, |
577 null, | 574 null, |
578 name, | 575 name, |
579 <TypeVariableBuilder>[], | 576 <TypeVariableBuilder>[], |
580 formals, | 577 formals, |
581 asyncModifier, | |
582 ProcedureKind.Factory, | 578 ProcedureKind.Factory, |
583 this, | 579 this, |
584 charOffset, | 580 charOffset, |
585 charOpenParenOffset, | 581 charOpenParenOffset, |
586 charEndOffset, | 582 charEndOffset, |
587 nativeMethodName, | 583 nativeMethodName, |
588 redirectionTarget); | 584 redirectionTarget); |
589 currentDeclaration.addFactoryDeclaration(procedure, factoryDeclaration); | 585 currentDeclaration.addFactoryDeclaration(procedure, factoryDeclaration); |
590 addBuilder(name, procedure, charOffset); | 586 addBuilder(name, procedure, charOffset); |
591 if (nativeMethodName != null) { | 587 if (nativeMethodName != null) { |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 mixinApplicationClasses.putIfAbsent(name, () => builder); | 843 mixinApplicationClasses.putIfAbsent(name, () => builder); |
848 if (existing != builder) { | 844 if (existing != builder) { |
849 part.scope.local.remove(name); | 845 part.scope.local.remove(name); |
850 } | 846 } |
851 }); | 847 }); |
852 super.includePart(part); | 848 super.includePart(part); |
853 nativeMethods.addAll(part.nativeMethods); | 849 nativeMethods.addAll(part.nativeMethods); |
854 boundlessTypeVariables.addAll(part.boundlessTypeVariables); | 850 boundlessTypeVariables.addAll(part.boundlessTypeVariables); |
855 } | 851 } |
856 } | 852 } |
OLD | NEW |