Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart

Issue 2917853002: Compute correct return type for factory methods. (Closed)
Patch Set: Include changes from CL 2916533003. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 void addFactoryMethod( 553 void addFactoryMethod(
554 List<MetadataBuilder> metadata, 554 List<MetadataBuilder> metadata,
555 int modifiers, 555 int modifiers,
556 ConstructorReferenceBuilder constructorNameReference, 556 ConstructorReferenceBuilder constructorNameReference,
557 List<FormalParameterBuilder> formals, 557 List<FormalParameterBuilder> formals,
558 ConstructorReferenceBuilder redirectionTarget, 558 ConstructorReferenceBuilder redirectionTarget,
559 int charOffset, 559 int charOffset,
560 int charOpenParenOffset, 560 int charOpenParenOffset,
561 int charEndOffset, 561 int charEndOffset,
562 String nativeMethodName) { 562 String nativeMethodName) {
563 KernelTypeBuilder returnType = addNamedType(
564 currentDeclaration.parent.name, <KernelTypeBuilder>[], charOffset);
563 // Nested declaration began in `OutlineBuilder.beginFactoryMethod`. 565 // Nested declaration began in `OutlineBuilder.beginFactoryMethod`.
564 DeclarationBuilder<KernelTypeBuilder> factoryDeclaration = 566 DeclarationBuilder<KernelTypeBuilder> factoryDeclaration =
565 endNestedDeclaration(); 567 endNestedDeclaration();
566 String name = constructorNameReference.name; 568 String name = constructorNameReference.name;
567 String constructorName = 569 String constructorName =
568 computeAndValidateConstructorName(name, charOffset); 570 computeAndValidateConstructorName(name, charOffset);
569 if (constructorName != null) { 571 if (constructorName != null) {
570 name = constructorName; 572 name = constructorName;
571 } 573 }
572 assert(constructorNameReference.suffix == null); 574 assert(constructorNameReference.suffix == null);
573 KernelProcedureBuilder procedure = new KernelProcedureBuilder( 575 KernelProcedureBuilder procedure = new KernelProcedureBuilder(
574 metadata, 576 metadata,
575 staticMask | modifiers, 577 staticMask | modifiers,
576 null, 578 returnType,
577 name, 579 name,
578 <TypeVariableBuilder>[], 580 <TypeVariableBuilder>[],
579 formals, 581 formals,
580 ProcedureKind.Factory, 582 ProcedureKind.Factory,
581 this, 583 this,
582 charOffset, 584 charOffset,
583 charOpenParenOffset, 585 charOpenParenOffset,
584 charEndOffset, 586 charEndOffset,
585 nativeMethodName, 587 nativeMethodName,
586 redirectionTarget); 588 redirectionTarget);
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 mixinApplicationClasses.putIfAbsent(name, () => builder); 847 mixinApplicationClasses.putIfAbsent(name, () => builder);
846 if (existing != builder) { 848 if (existing != builder) {
847 part.scope.local.remove(name); 849 part.scope.local.remove(name);
848 } 850 }
849 }); 851 });
850 super.includePart(part); 852 super.includePart(part);
851 nativeMethods.addAll(part.nativeMethods); 853 nativeMethods.addAll(part.nativeMethods);
852 boundlessTypeVariables.addAll(part.boundlessTypeVariables); 854 boundlessTypeVariables.addAll(part.boundlessTypeVariables);
853 } 855 }
854 } 856 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/body_builder.dart ('k') | pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698