OLD | NEW |
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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 } | 326 } |
327 } | 327 } |
328 | 328 |
329 /** | 329 /** |
330 * Check whether element is the parameter of a list adding method. | 330 * Check whether element is the parameter of a list adding method. |
331 * The definition of what a list adding method is has to stay in sync with | 331 * The definition of what a list adding method is has to stay in sync with |
332 * [isAddedToContainer]. | 332 * [isAddedToContainer]. |
333 */ | 333 */ |
334 bool isParameterOfListAddingMethod(Element element) { | 334 bool isParameterOfListAddingMethod(Element element) { |
335 if (!element.isRegularParameter) return false; | 335 if (!element.isRegularParameter) return false; |
336 if (element.enclosingClass != compiler.backend.listImplementation) { | 336 if (element.enclosingClass != |
| 337 compiler.backend.backendClasses.listImplementation) { |
337 return false; | 338 return false; |
338 } | 339 } |
339 Element method = element.enclosingElement; | 340 Element method = element.enclosingElement; |
340 return (method.name == '[]=') || | 341 return (method.name == '[]=') || |
341 (method.name == 'add') || | 342 (method.name == 'add') || |
342 (method.name == 'insert'); | 343 (method.name == 'insert'); |
343 } | 344 } |
344 | 345 |
345 /** | 346 /** |
346 * Check whether element is the parameter of a list adding method. | 347 * Check whether element is the parameter of a list adding method. |
347 * The definition of what a list adding method is has to stay in sync with | 348 * The definition of what a list adding method is has to stay in sync with |
348 * [isValueAddedToMap] and [isKeyAddedToMap]. | 349 * [isValueAddedToMap] and [isKeyAddedToMap]. |
349 */ | 350 */ |
350 bool isParameterOfMapAddingMethod(Element element) { | 351 bool isParameterOfMapAddingMethod(Element element) { |
351 if (!element.isRegularParameter) return false; | 352 if (!element.isRegularParameter) return false; |
352 if (element.enclosingClass != compiler.backend.mapImplementation) { | 353 if (element.enclosingClass != |
| 354 compiler.backend.backendClasses.mapImplementation) { |
353 return false; | 355 return false; |
354 } | 356 } |
355 Element method = element.enclosingElement; | 357 Element method = element.enclosingElement; |
356 return (method.name == '[]='); | 358 return (method.name == '[]='); |
357 } | 359 } |
358 | 360 |
359 bool isClosure(Element element) { | 361 bool isClosure(Element element) { |
360 if (!element.isFunction) return false; | 362 if (!element.isFunction) return false; |
361 | 363 |
362 /// Creating an instance of a class that implements [Function] also | 364 /// Creating an instance of a class that implements [Function] also |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 } | 398 } |
397 if (isParameterOfListAddingMethod(info.element) || | 399 if (isParameterOfListAddingMethod(info.element) || |
398 isParameterOfMapAddingMethod(info.element)) { | 400 isParameterOfMapAddingMethod(info.element)) { |
399 // These elements are being handled in | 401 // These elements are being handled in |
400 // [visitDynamicCallSiteTypeInformation]. | 402 // [visitDynamicCallSiteTypeInformation]. |
401 return; | 403 return; |
402 } | 404 } |
403 addNewEscapeInformation(info); | 405 addNewEscapeInformation(info); |
404 } | 406 } |
405 } | 407 } |
OLD | NEW |