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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 name, | 538 name, |
539 typeVariables, | 539 typeVariables, |
540 formals, | 540 formals, |
541 kind, | 541 kind, |
542 this, | 542 this, |
543 charOffset, | 543 charOffset, |
544 charOpenParenOffset, | 544 charOpenParenOffset, |
545 charEndOffset, | 545 charEndOffset, |
546 nativeMethodName); | 546 nativeMethodName); |
547 } | 547 } |
| 548 checkTypeVariables(typeVariables, procedure); |
548 addBuilder(name, procedure, charOffset); | 549 addBuilder(name, procedure, charOffset); |
549 if (nativeMethodName != null) { | 550 if (nativeMethodName != null) { |
550 addNativeMethod(procedure); | 551 addNativeMethod(procedure); |
551 } | 552 } |
552 } | 553 } |
553 | 554 |
554 void addFactoryMethod( | 555 void addFactoryMethod( |
555 List<MetadataBuilder> metadata, | 556 List<MetadataBuilder> metadata, |
556 int modifiers, | 557 int modifiers, |
557 ConstructorReferenceBuilder constructorNameReference, | 558 ConstructorReferenceBuilder constructorNameReference, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 | 606 |
606 void addFunctionTypeAlias( | 607 void addFunctionTypeAlias( |
607 List<MetadataBuilder> metadata, | 608 List<MetadataBuilder> metadata, |
608 KernelTypeBuilder returnType, | 609 KernelTypeBuilder returnType, |
609 String name, | 610 String name, |
610 List<TypeVariableBuilder> typeVariables, | 611 List<TypeVariableBuilder> typeVariables, |
611 List<FormalParameterBuilder> formals, | 612 List<FormalParameterBuilder> formals, |
612 int charOffset) { | 613 int charOffset) { |
613 FunctionTypeAliasBuilder typedef = new KernelFunctionTypeAliasBuilder( | 614 FunctionTypeAliasBuilder typedef = new KernelFunctionTypeAliasBuilder( |
614 metadata, returnType, name, typeVariables, formals, this, charOffset); | 615 metadata, returnType, name, typeVariables, formals, this, charOffset); |
| 616 checkTypeVariables(typeVariables, typedef); |
615 // Nested declaration began in `OutlineBuilder.beginFunctionTypeAlias`. | 617 // Nested declaration began in `OutlineBuilder.beginFunctionTypeAlias`. |
616 endNestedDeclaration().resolveTypes(typeVariables, this); | 618 endNestedDeclaration().resolveTypes(typeVariables, this); |
617 addBuilder(name, typedef, charOffset); | 619 addBuilder(name, typedef, charOffset); |
618 } | 620 } |
619 | 621 |
620 KernelFunctionTypeBuilder addFunctionType( | 622 KernelFunctionTypeBuilder addFunctionType( |
621 KernelTypeBuilder returnType, | 623 KernelTypeBuilder returnType, |
622 List<TypeVariableBuilder> typeVariables, | 624 List<TypeVariableBuilder> typeVariables, |
623 List<FormalParameterBuilder> formals, | 625 List<FormalParameterBuilder> formals, |
624 int charOffset) { | 626 int charOffset) { |
625 return addType(new KernelFunctionTypeBuilder( | 627 var builder = new KernelFunctionTypeBuilder( |
626 charOffset, fileUri, returnType, typeVariables, formals)); | 628 charOffset, fileUri, returnType, typeVariables, formals); |
| 629 checkTypeVariables(typeVariables, builder); |
| 630 return addType(builder); |
627 } | 631 } |
628 | 632 |
629 KernelFormalParameterBuilder addFormalParameter( | 633 KernelFormalParameterBuilder addFormalParameter( |
630 List<MetadataBuilder> metadata, | 634 List<MetadataBuilder> metadata, |
631 int modifiers, | 635 int modifiers, |
632 KernelTypeBuilder type, | 636 KernelTypeBuilder type, |
633 String name, | 637 String name, |
634 bool hasThis, | 638 bool hasThis, |
635 int charOffset) { | 639 int charOffset) { |
636 return new KernelFormalParameterBuilder( | 640 return new KernelFormalParameterBuilder( |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 mixinApplicationClasses.putIfAbsent(name, () => builder); | 849 mixinApplicationClasses.putIfAbsent(name, () => builder); |
846 if (existing != builder) { | 850 if (existing != builder) { |
847 part.scope.local.remove(name); | 851 part.scope.local.remove(name); |
848 } | 852 } |
849 }); | 853 }); |
850 super.includePart(part); | 854 super.includePart(part); |
851 nativeMethods.addAll(part.nativeMethods); | 855 nativeMethods.addAll(part.nativeMethods); |
852 boundlessTypeVariables.addAll(part.boundlessTypeVariables); | 856 boundlessTypeVariables.addAll(part.boundlessTypeVariables); |
853 } | 857 } |
854 } | 858 } |
OLD | NEW |