| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 } | 390 } |
| 391 } | 391 } |
| 392 | 392 |
| 393 /** | 393 /** |
| 394 * Check whether element is the parameter of a list adding method. | 394 * Check whether element is the parameter of a list adding method. |
| 395 * The definition of what a list adding method is has to stay in sync with | 395 * The definition of what a list adding method is has to stay in sync with |
| 396 * [mightAddToContainer]. | 396 * [mightAddToContainer]. |
| 397 */ | 397 */ |
| 398 bool isParameterOfListAddingMethod(Element element) { | 398 bool isParameterOfListAddingMethod(Element element) { |
| 399 if (!element.isRegularParameter) return false; | 399 if (!element.isRegularParameter) return false; |
| 400 if (element.enclosingClass != compiler.backend.backendClasses.listClass) { | 400 if (element.enclosingClass != compiler.commonElements.jsArrayClass) { |
| 401 return false; | 401 return false; |
| 402 } | 402 } |
| 403 String name = element.enclosingElement.name; | 403 String name = element.enclosingElement.name; |
| 404 return (name == '[]=') || (name == 'add') || (name == 'insert'); | 404 return (name == '[]=') || (name == 'add') || (name == 'insert'); |
| 405 } | 405 } |
| 406 | 406 |
| 407 /** | 407 /** |
| 408 * Check whether element is the parameter of a list adding method. | 408 * Check whether element is the parameter of a list adding method. |
| 409 * The definition of what a list adding method is has to stay in sync with | 409 * The definition of what a list adding method is has to stay in sync with |
| 410 * [isIndexSetKey] and [isIndexSetValue]. | 410 * [isIndexSetKey] and [isIndexSetValue]. |
| 411 */ | 411 */ |
| 412 bool isParameterOfMapAddingMethod(Element element) { | 412 bool isParameterOfMapAddingMethod(Element element) { |
| 413 if (!element.isRegularParameter) return false; | 413 if (!element.isRegularParameter) return false; |
| 414 if (element.enclosingClass != compiler.backend.backendClasses.mapClass) { | 414 if (element.enclosingClass != compiler.commonElements.mapLiteralClass) { |
| 415 return false; | 415 return false; |
| 416 } | 416 } |
| 417 String name = element.enclosingElement.name; | 417 String name = element.enclosingElement.name; |
| 418 return (name == '[]='); | 418 return (name == '[]='); |
| 419 } | 419 } |
| 420 | 420 |
| 421 bool isClosure(Element element) { | 421 bool isClosure(Element element) { |
| 422 if (!element.isFunction) return false; | 422 if (!element.isFunction) return false; |
| 423 | 423 |
| 424 /// Creating an instance of a class that implements [Function] also | 424 /// Creating an instance of a class that implements [Function] also |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 } | 460 } |
| 461 if (isParameterOfListAddingMethod(element) || | 461 if (isParameterOfListAddingMethod(element) || |
| 462 isParameterOfMapAddingMethod(element)) { | 462 isParameterOfMapAddingMethod(element)) { |
| 463 // These elements are being handled in | 463 // These elements are being handled in |
| 464 // [visitDynamicCallSiteTypeInformation]. | 464 // [visitDynamicCallSiteTypeInformation]. |
| 465 return; | 465 return; |
| 466 } | 466 } |
| 467 addNewEscapeInformation(info); | 467 addNewEscapeInformation(info); |
| 468 } | 468 } |
| 469 } | 469 } |
| OLD | NEW |