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

Side by Side Diff: lib/type_propagation/builder.dart

Issue 2439043002: Introduce Substitution class and Supertype class. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « lib/type_algebra.dart ('k') | lib/visitor.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 library kernel.type_propagation.builder; 4 library kernel.type_propagation.builder;
5 5
6 import '../ast.dart'; 6 import '../ast.dart';
7 import '../class_hierarchy.dart'; 7 import '../class_hierarchy.dart';
8 import '../core_types.dart'; 8 import '../core_types.dart';
9 import 'canonicalizer.dart'; 9 import 'canonicalizer.dart';
10 import 'constraints.dart'; 10 import 'constraints.dart';
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // subtype information. 168 // subtype information.
169 for (int i = 0; i < hierarchy.classes.length; ++i) { 169 for (int i = 0; i < hierarchy.classes.length; ++i) {
170 Class class_ = hierarchy.classes[i]; 170 Class class_ = hierarchy.classes[i];
171 List<int> supers = <int>[]; 171 List<int> supers = <int>[];
172 if (class_.supertype != null) { 172 if (class_.supertype != null) {
173 supers.add(getLatticePointForSubtypesOfClass(class_.superclass)); 173 supers.add(getLatticePointForSubtypesOfClass(class_.superclass));
174 } 174 }
175 if (class_.mixedInType != null) { 175 if (class_.mixedInType != null) {
176 supers.add(getLatticePointForSubtypesOfClass(class_.mixedInClass)); 176 supers.add(getLatticePointForSubtypesOfClass(class_.mixedInClass));
177 } 177 }
178 for (InterfaceType supertype in class_.implementedTypes) { 178 for (Supertype supertype in class_.implementedTypes) {
179 supers.add(getLatticePointForSubtypesOfClass(supertype.classNode)); 179 supers.add(getLatticePointForSubtypesOfClass(supertype.classNode));
180 } 180 }
181 int subtypePoint = newLatticePoint(supers, class_, 181 int subtypePoint = newLatticePoint(supers, class_,
182 i == 0 ? BaseClassKind.Subclass : BaseClassKind.Subtype); 182 i == 0 ? BaseClassKind.Subclass : BaseClassKind.Subtype);
183 lattice.subtypesOfClass[i] = subtypePoint; 183 lattice.subtypesOfClass[i] = subtypePoint;
184 visualizer?.annotateLatticePoint(subtypePoint, class_, 'subtype'); 184 visualizer?.annotateLatticePoint(subtypePoint, class_, 'subtype');
185 } 185 }
186 186
187 // Build the lattice points for subclasses and exact classes. 187 // Build the lattice points for subclasses and exact classes.
188 for (int i = 0; i < hierarchy.classes.length; ++i) { 188 for (int i = 0; i < hierarchy.classes.length; ++i) {
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
1972 environment.addStore(input, field, argument); 1972 environment.addStore(input, field, argument);
1973 } 1973 }
1974 } 1974 }
1975 for (int arity = minArity; arity <= maxArity; ++arity) { 1975 for (int arity = minArity; arity <= maxArity; ++arity) {
1976 int returnLocation = 1976 int returnLocation =
1977 environment.getLoad(input, fieldNames.getReturnField(arity)); 1977 environment.getLoad(input, fieldNames.getReturnField(arity));
1978 visitContravariant(node.returnType, returnLocation); 1978 visitContravariant(node.returnType, returnLocation);
1979 } 1979 }
1980 } 1980 }
1981 } 1981 }
OLDNEW
« no previous file with comments | « lib/type_algebra.dart ('k') | lib/visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698