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

Side by Side Diff: pkg/compiler/lib/src/inferrer/node_tracer.dart

Issue 2941033002: Finish strong mode cleaning of dart2js. (Closed)
Patch Set: 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 compiler.src.inferrer.node_tracer; 5 library compiler.src.inferrer.node_tracer;
6 6
7 import '../common/names.dart' show Identifiers; 7 import '../common/names.dart' show Identifiers;
8 import '../compiler.dart' show Compiler; 8 import '../compiler.dart' show Compiler;
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../types/types.dart' show ContainerTypeMask, MapTypeMask; 10 import '../types/types.dart' show ContainerTypeMask, MapTypeMask;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 addNewEscapeInformation(info); 213 addNewEscapeInformation(info);
214 } 214 }
215 } 215 }
216 216
217 void analyzeStoredIntoList(ListTypeInformation list) { 217 void analyzeStoredIntoList(ListTypeInformation list) {
218 inferrer.analyzeListAndEnqueue(list); 218 inferrer.analyzeListAndEnqueue(list);
219 if (list.bailedOut) { 219 if (list.bailedOut) {
220 bailout('Stored in a list that bailed out'); 220 bailout('Stored in a list that bailed out');
221 } else { 221 } else {
222 list.flowsInto.forEach((flow) { 222 list.flowsInto.forEach((flow) {
223 flow.users.forEach((user) { 223 flow.users.forEach((dynamic user) {
224 if (user is! DynamicCallSiteTypeInformation) return; 224 if (user is! DynamicCallSiteTypeInformation) return;
225 if (user.receiver != flow) return; 225 if (user.receiver != flow) return;
226 if (inferrer.returnsListElementTypeSet.contains(user.selector)) { 226 if (inferrer.returnsListElementTypeSet.contains(user.selector)) {
227 addNewEscapeInformation(user); 227 addNewEscapeInformation(user);
228 } else if (!doesNotEscapeListSet.contains(user.selector.name)) { 228 } else if (!doesNotEscapeListSet.contains(user.selector.name)) {
229 bailout('Escape from a list via [${user.selector.name}]'); 229 bailout('Escape from a list via [${user.selector.name}]');
230 } 230 }
231 }); 231 });
232 }); 232 });
233 } 233 }
234 } 234 }
235 235
236 void analyzeStoredIntoMap(MapTypeInformation map) { 236 void analyzeStoredIntoMap(MapTypeInformation map) {
237 inferrer.analyzeMapAndEnqueue(map); 237 inferrer.analyzeMapAndEnqueue(map);
238 if (map.bailedOut) { 238 if (map.bailedOut) {
239 bailout('Stored in a map that bailed out'); 239 bailout('Stored in a map that bailed out');
240 } else { 240 } else {
241 map.flowsInto.forEach((flow) { 241 map.flowsInto.forEach((flow) {
242 flow.users.forEach((user) { 242 flow.users.forEach((dynamic user) {
243 if (user is! DynamicCallSiteTypeInformation) return; 243 if (user is! DynamicCallSiteTypeInformation) return;
244 if (user.receiver != flow) return; 244 if (user.receiver != flow) return;
245 if (user.selector.isIndex) { 245 if (user.selector.isIndex) {
246 addNewEscapeInformation(user); 246 addNewEscapeInformation(user);
247 } else if (!doesNotEscapeMapSet.contains(user.selector.name)) { 247 } else if (!doesNotEscapeMapSet.contains(user.selector.name)) {
248 bailout('Escape from a map via [${user.selector.name}]'); 248 bailout('Escape from a map via [${user.selector.name}]');
249 } 249 }
250 }); 250 });
251 }); 251 });
252 } 252 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 } 385 }
386 386
387 if (info.targetsIncludeComplexNoSuchMethod(inferrer) && 387 if (info.targetsIncludeComplexNoSuchMethod(inferrer) &&
388 info.arguments != null && 388 info.arguments != null &&
389 info.arguments.contains(currentUser)) { 389 info.arguments.contains(currentUser)) {
390 bailout('Passed to noSuchMethod'); 390 bailout('Passed to noSuchMethod');
391 } 391 }
392 392
393 Iterable<Element> inferredTargetTypes = 393 Iterable<Element> inferredTargetTypes =
394 info.targets.map((MemberElement element) { 394 info.targets.map((MemberElement element) {
395 // TODO(ahe): Is this a bug?
ahe 2017/06/15 09:36:39 I'll file a bug and update the comment.
ahe 2017/06/15 11:41:57 Done.
396 // ignore: RETURN_OF_INVALID_TYPE
395 return inferrer.types.getInferredTypeOf(element); 397 return inferrer.types.getInferredTypeOf(element);
396 }); 398 });
397 if (inferredTargetTypes.any((user) => user == currentUser)) { 399 if (inferredTargetTypes.any((user) => user == currentUser)) {
398 addNewEscapeInformation(info); 400 addNewEscapeInformation(info);
399 } 401 }
400 } 402 }
401 403
402 /** 404 /**
403 * Check whether element is the parameter of a list adding method. 405 * Check whether element is the parameter of a list adding method.
404 * The definition of what a list adding method is has to stay in sync with 406 * The definition of what a list adding method is has to stay in sync with
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 } 473 }
472 if (isParameterOfListAddingMethod(element) || 474 if (isParameterOfListAddingMethod(element) ||
473 isParameterOfMapAddingMethod(element)) { 475 isParameterOfMapAddingMethod(element)) {
474 // These elements are being handled in 476 // These elements are being handled in
475 // [visitDynamicCallSiteTypeInformation]. 477 // [visitDynamicCallSiteTypeInformation].
476 return; 478 return;
477 } 479 }
478 addNewEscapeInformation(info); 480 addNewEscapeInformation(info);
479 } 481 }
480 } 482 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698