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

Side by Side Diff: pkg/compiler/lib/src/serialization/system.dart

Issue 2456643006: More functionality in kernel_impact. (Closed)
Patch Set: Fix errors. Created 4 years, 1 month 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 | « pkg/compiler/lib/src/resolution/signatures.dart ('k') | pkg/compiler/lib/src/ssa/builder.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 4
5 library dart2js.serialization_system; 5 library dart2js.serialization_system;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../common/resolution.dart'; 10 import '../common/resolution.dart';
11 import '../compiler.dart'; 11 import '../compiler.dart';
12 import '../dart_types.dart';
12 import '../elements/elements.dart'; 13 import '../elements/elements.dart';
13 import '../scanner/scanner.dart'; 14 import '../scanner/scanner.dart';
14 import '../script.dart'; 15 import '../script.dart';
15 import '../serialization/impact_serialization.dart'; 16 import '../serialization/impact_serialization.dart';
16 import '../tokens/token.dart'; 17 import '../tokens/token.dart';
17 import '../universe/call_structure.dart'; 18 import '../universe/call_structure.dart';
18 import '../universe/use.dart'; 19 import '../universe/use.dart';
19 import '../universe/world_impact.dart'; 20 import '../universe/world_impact.dart';
20 import 'modelz.dart'; 21 import 'modelz.dart';
21 import 'resolved_ast_serialization.dart'; 22 import 'resolved_ast_serialization.dart';
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 element.enclosingClass.isUnnamedMixinApplication) { 150 element.enclosingClass.isUnnamedMixinApplication) {
150 return true; 151 return true;
151 } 152 }
152 return _resolutionImpactDeserializer.hasResolutionImpact(element); 153 return _resolutionImpactDeserializer.hasResolutionImpact(element);
153 } 154 }
154 155
155 @override 156 @override
156 ResolutionImpact getResolutionImpact(Element element) { 157 ResolutionImpact getResolutionImpact(Element element) {
157 if (element.isConstructor && 158 if (element.isConstructor &&
158 element.enclosingClass.isUnnamedMixinApplication) { 159 element.enclosingClass.isUnnamedMixinApplication) {
159 ClassElement superclass = element.enclosingClass.superclass; 160 ConstructorElement constructor = element;
161 ClassElement superclass = constructor.enclosingClass.superclass;
160 ConstructorElement superclassConstructor = 162 ConstructorElement superclassConstructor =
161 superclass.lookupConstructor(element.name); 163 superclass.lookupConstructor(constructor.name);
162 assert(invariant(element, superclassConstructor != null, 164 assert(invariant(element, superclassConstructor != null,
163 message: "Superclass constructor '${element.name}' called from " 165 message: "Superclass constructor '${constructor.name}' called from "
164 "${element} not found in ${superclass}.")); 166 "${element} not found in ${superclass}."));
165 // TODO(johnniwinther): Compute callStructure. Currently not used. 167 // TODO(johnniwinther): Compute callStructure. Currently not used.
166 CallStructure callStructure; 168 CallStructure callStructure;
167 return _resolutionImpactDeserializer.registerResolutionImpact(element, 169 return _resolutionImpactDeserializer.registerResolutionImpact(constructor,
168 () { 170 () {
171 List<TypeUse> typeUses = <TypeUse>[];
172 void addCheckedModeCheck(DartType type) {
173 if (!type.isDynamic) {
174 typeUses.add(new TypeUse.checkedModeCheck(type));
175 }
176 }
177
178 FunctionType type = constructor.type;
179 // TODO(johnniwinther): Remove this substitution when synthesized
180 // constructors handle type variables correctly.
181 type = type.substByContext(constructor.enclosingClass
182 .asInstanceOf(constructor.enclosingClass));
183 type.parameterTypes.forEach(addCheckedModeCheck);
184 type.optionalParameterTypes.forEach(addCheckedModeCheck);
185 type.namedParameterTypes.forEach(addCheckedModeCheck);
169 return new DeserializedResolutionImpact(staticUses: <StaticUse>[ 186 return new DeserializedResolutionImpact(staticUses: <StaticUse>[
170 new StaticUse.superConstructorInvoke( 187 new StaticUse.superConstructorInvoke(
171 superclassConstructor, callStructure) 188 superclassConstructor, callStructure)
172 ]); 189 ], typeUses: typeUses);
173 }); 190 });
174 } 191 }
175 return _resolutionImpactDeserializer.getResolutionImpact(element); 192 return _resolutionImpactDeserializer.getResolutionImpact(element);
176 } 193 }
177 } 194 }
178 195
179 const String WORLD_IMPACT_TAG = 'worldImpact'; 196 const String WORLD_IMPACT_TAG = 'worldImpact';
180 197
181 class ResolutionImpactSerializer extends SerializerPlugin { 198 class ResolutionImpactSerializer extends SerializerPlugin {
182 final Resolution resolution; 199 final Resolution resolution;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 } 322 }
306 323
307 @override 324 @override
308 void onElement(Element element, ObjectDecoder getDecoder(String tag)) { 325 void onElement(Element element, ObjectDecoder getDecoder(String tag)) {
309 ObjectDecoder decoder = getDecoder(RESOLVED_AST_TAG); 326 ObjectDecoder decoder = getDecoder(RESOLVED_AST_TAG);
310 if (decoder != null) { 327 if (decoder != null) {
311 _decoderMap[element] = decoder; 328 _decoderMap[element] = decoder;
312 } 329 }
313 } 330 }
314 } 331 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/signatures.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698