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