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

Side by Side Diff: pkg/compiler/lib/src/resolution/constructors.dart

Issue 2000223002: Revert "Adjusts dart2js backend to handle method type arguments." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 dart2js.resolution.constructors; 5 library dart2js.resolution.constructors;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/resolution.dart' show Feature; 8 import '../common/resolution.dart' show Feature;
9 import '../compiler.dart' show Compiler; 9 import '../compiler.dart' show Compiler;
10 import '../constants/constructors.dart' 10 import '../constants/constructors.dart'
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 MessageKind.NOT_A_TYPE, {'node': node}, error.name, error); 712 MessageKind.NOT_A_TYPE, {'node': node}, error.name, error);
713 registry.registerFeature(Feature.THROW_RUNTIME_ERROR); 713 registry.registerFeature(Feature.THROW_RUNTIME_ERROR);
714 } 714 }
715 return new ConstructorResult.forError(ConstructorResultKind.INVALID_TYPE, 715 return new ConstructorResult.forError(ConstructorResultKind.INVALID_TYPE,
716 error, new MalformedType(error, null)); 716 error, new MalformedType(error, null));
717 } 717 }
718 718
719 ConstructorResult constructorResultForType(Node node, DartType type, 719 ConstructorResult constructorResultForType(Node node, DartType type,
720 {PrefixElement prefix}) { 720 {PrefixElement prefix}) {
721 String name = type.name; 721 String name = type.name;
722 if (type.isTypeVariable) { 722 if (type.isMalformed) {
723 return reportAndCreateErroneousConstructorElement(
724 node,
725 ConstructorResultKind.INVALID_TYPE,
726 type,
727 resolver.enclosingElement,
728 name,
729 MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE,
730 {'typeVariableName': name});
731 } else if (type.isMalformed) {
732 // `type is MalformedType`: `MethodTypeVariableType` is handled above.
733 return new ConstructorResult.forError( 723 return new ConstructorResult.forError(
734 ConstructorResultKind.INVALID_TYPE, type.element, type); 724 ConstructorResultKind.INVALID_TYPE, type.element, type);
735 } else if (type.isInterfaceType) { 725 } else if (type.isInterfaceType) {
736 return new ConstructorResult.forType(prefix, type); 726 return new ConstructorResult.forType(prefix, type);
737 } else if (type.isTypedef) { 727 } else if (type.isTypedef) {
738 return reportAndCreateErroneousConstructorElement( 728 return reportAndCreateErroneousConstructorElement(
739 node, 729 node,
740 ConstructorResultKind.INVALID_TYPE, 730 ConstructorResultKind.INVALID_TYPE,
741 type, 731 type,
742 resolver.enclosingElement, 732 resolver.enclosingElement,
743 name, 733 name,
744 MessageKind.CANNOT_INSTANTIATE_TYPEDEF, 734 MessageKind.CANNOT_INSTANTIATE_TYPEDEF,
745 {'typedefName': name}); 735 {'typedefName': name});
736 } else if (type.isTypeVariable) {
737 return reportAndCreateErroneousConstructorElement(
738 node,
739 ConstructorResultKind.INVALID_TYPE,
740 type,
741 resolver.enclosingElement,
742 name,
743 MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE,
744 {'typeVariableName': name});
746 } 745 }
747 return reporter.internalError(node, "Unexpected constructor type $type"); 746 return reporter.internalError(node, "Unexpected constructor type $type");
748 } 747 }
749 } 748 }
750 749
751 /// The kind of constructor found by the [ConstructorResolver]. 750 /// The kind of constructor found by the [ConstructorResolver].
752 enum ConstructorResultKind { 751 enum ConstructorResultKind {
753 /// A generative or redirecting generative constructor. 752 /// A generative or redirecting generative constructor.
754 GENERATIVE, 753 GENERATIVE,
755 754
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 // constructors. 849 // constructors.
851 return null; 850 return null;
852 } 851 }
853 // TODO(johnniwinther): Use [Name] for lookup. 852 // TODO(johnniwinther): Use [Name] for lookup.
854 ConstructorElement constructor = cls.lookupConstructor(constructorName); 853 ConstructorElement constructor = cls.lookupConstructor(constructorName);
855 if (constructor != null) { 854 if (constructor != null) {
856 constructor = constructor.declaration; 855 constructor = constructor.declaration;
857 } 856 }
858 return constructor; 857 return constructor;
859 } 858 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/runtime_types.dart ('k') | pkg/compiler/lib/src/resolution/signatures.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698