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

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

Issue 2729943003: Recover from bad supertypes. (Closed)
Patch Set: Update status files. Created 3 years, 9 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_class_builder; 5 library fasta.kernel_class_builder;
6 6
7 import 'package:kernel/ast.dart' 7 import 'package:kernel/ast.dart'
8 show 8 show
9 Class, 9 Class,
10 DartType, 10 DartType,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 LibraryBuilder parent, 55 LibraryBuilder parent,
56 int charOffset) 56 int charOffset)
57 : super(metadata, modifiers, name, typeVariables, supertype, interfaces, 57 : super(metadata, modifiers, name, typeVariables, supertype, interfaces,
58 members, parent, charOffset); 58 members, parent, charOffset);
59 59
60 Class get cls; 60 Class get cls;
61 61
62 Class get target => cls; 62 Class get target => cls;
63 63
64 /// [arguments] have already been built. 64 /// [arguments] have already been built.
65 InterfaceType buildTypesWithBuiltArguments(List<DartType> arguments) { 65 InterfaceType buildTypesWithBuiltArguments(
66 LibraryBuilder library, List<DartType> arguments) {
66 return arguments == null 67 return arguments == null
67 ? cls.rawType 68 ? cls.rawType
68 : new InterfaceType( 69 : new InterfaceType(
69 cls, 70 cls,
70 // TODO(ahe): Not sure what to do if `arguments.length != 71 // TODO(ahe): Not sure what to do if `arguments.length !=
71 // cls.typeParameters.length`. 72 // cls.typeParameters.length`.
72 computeDefaultTypeArguments(cls.typeParameters, arguments)); 73 computeDefaultTypeArguments(cls.typeParameters, arguments));
73 } 74 }
74 75
75 InterfaceType buildType(List<KernelTypeBuilder> arguments) { 76 InterfaceType buildType(
77 LibraryBuilder library, List<KernelTypeBuilder> arguments) {
76 List<DartType> typeArguments; 78 List<DartType> typeArguments;
77 if (arguments != null) { 79 if (arguments != null) {
78 typeArguments = <DartType>[]; 80 typeArguments = <DartType>[];
79 for (KernelTypeBuilder builder in arguments) { 81 for (KernelTypeBuilder builder in arguments) {
80 DartType type = builder.build(); 82 DartType type = builder.build(library);
81 if (type == null) { 83 if (type == null) {
82 internalError("Bad type: ${builder.runtimeType}"); 84 internalError("Bad type: ${builder.runtimeType}");
83 } 85 }
84 typeArguments.add(type); 86 typeArguments.add(type);
85 } 87 }
86 } 88 }
87 return buildTypesWithBuiltArguments(typeArguments); 89 return buildTypesWithBuiltArguments(library, typeArguments);
88 } 90 }
89 91
90 Supertype buildSupertype(List<KernelTypeBuilder> arguments) { 92 Supertype buildSupertype(
93 LibraryBuilder library, List<KernelTypeBuilder> arguments) {
91 List<DartType> typeArguments; 94 List<DartType> typeArguments;
92 if (arguments != null) { 95 if (arguments != null) {
93 typeArguments = <DartType>[]; 96 typeArguments = <DartType>[];
94 for (KernelTypeBuilder builder in arguments) { 97 for (KernelTypeBuilder builder in arguments) {
95 DartType type = builder.build(); 98 DartType type = builder.build(library);
96 if (type == null) { 99 if (type == null) {
97 internalError("Bad type: ${builder.runtimeType}"); 100 internalError("Bad type: ${builder.runtimeType}");
98 } 101 }
99 typeArguments.add(type); 102 typeArguments.add(type);
100 } 103 }
101 return new Supertype(cls, typeArguments); 104 return new Supertype(cls, typeArguments);
102 } else { 105 } else {
103 return cls.asRawSupertype; 106 return cls.asRawSupertype;
104 } 107 }
105 } 108 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 fileUri: cls.fileUri)..fileOffset = cls.fileOffset; 167 fileUri: cls.fileUri)..fileOffset = cls.fileOffset;
165 cls.addMember(field); 168 cls.addMember(field);
166 return new DillMemberBuilder(field, this); 169 return new DillMemberBuilder(field, this);
167 }); 170 });
168 Field field = constructorsField.target; 171 Field field = constructorsField.target;
169 ListLiteral literal = field.initializer; 172 ListLiteral literal = field.initializer;
170 literal.expressions 173 literal.expressions
171 .add(new StaticGet(constructor.target)..parent = literal); 174 .add(new StaticGet(constructor.target)..parent = literal);
172 } 175 }
173 } 176 }
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_enum_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698