| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 } | 399 } |
| 400 } | 400 } |
| 401 | 401 |
| 402 /** | 402 /** |
| 403 * Check whether element is the parameter of a list adding method. | 403 * 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 | 404 * The definition of what a list adding method is has to stay in sync with |
| 405 * [mightAddToContainer]. | 405 * [mightAddToContainer]. |
| 406 */ | 406 */ |
| 407 bool isParameterOfListAddingMethod(Element element) { | 407 bool isParameterOfListAddingMethod(Element element) { |
| 408 if (!element.isRegularParameter) return false; | 408 if (!element.isRegularParameter) return false; |
| 409 if (element.enclosingClass != compiler.commonElements.jsArrayClass) { | 409 if (element.enclosingClass != |
| 410 inferrer.closedWorld.commonElements.jsArrayClass) { |
| 410 return false; | 411 return false; |
| 411 } | 412 } |
| 412 String name = element.enclosingElement.name; | 413 String name = element.enclosingElement.name; |
| 413 return (name == '[]=') || (name == 'add') || (name == 'insert'); | 414 return (name == '[]=') || (name == 'add') || (name == 'insert'); |
| 414 } | 415 } |
| 415 | 416 |
| 416 /** | 417 /** |
| 417 * Check whether element is the parameter of a list adding method. | 418 * Check whether element is the parameter of a list adding method. |
| 418 * The definition of what a list adding method is has to stay in sync with | 419 * The definition of what a list adding method is has to stay in sync with |
| 419 * [isIndexSetKey] and [isIndexSetValue]. | 420 * [isIndexSetKey] and [isIndexSetValue]. |
| 420 */ | 421 */ |
| 421 bool isParameterOfMapAddingMethod(Element element) { | 422 bool isParameterOfMapAddingMethod(Element element) { |
| 422 if (!element.isRegularParameter) return false; | 423 if (!element.isRegularParameter) return false; |
| 423 if (element.enclosingClass != compiler.commonElements.mapLiteralClass) { | 424 if (element.enclosingClass != |
| 425 inferrer.closedWorld.commonElements.mapLiteralClass) { |
| 424 return false; | 426 return false; |
| 425 } | 427 } |
| 426 String name = element.enclosingElement.name; | 428 String name = element.enclosingElement.name; |
| 427 return (name == '[]='); | 429 return (name == '[]='); |
| 428 } | 430 } |
| 429 | 431 |
| 430 bool isClosure(Element element) { | 432 bool isClosure(Element element) { |
| 431 if (!element.isFunction) return false; | 433 if (!element.isFunction) return false; |
| 432 | 434 |
| 433 /// Creating an instance of a class that implements [Function] also | 435 /// Creating an instance of a class that implements [Function] also |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 } | 471 } |
| 470 if (isParameterOfListAddingMethod(element) || | 472 if (isParameterOfListAddingMethod(element) || |
| 471 isParameterOfMapAddingMethod(element)) { | 473 isParameterOfMapAddingMethod(element)) { |
| 472 // These elements are being handled in | 474 // These elements are being handled in |
| 473 // [visitDynamicCallSiteTypeInformation]. | 475 // [visitDynamicCallSiteTypeInformation]. |
| 474 return; | 476 return; |
| 475 } | 477 } |
| 476 addNewEscapeInformation(info); | 478 addNewEscapeInformation(info); |
| 477 } | 479 } |
| 478 } | 480 } |
| OLD | NEW |