Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 engine.resolver.element_resolver; | 5 library engine.resolver.element_resolver; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'ast.dart'; | 9 import 'ast.dart'; |
| 10 import 'element.dart'; | 10 import 'element.dart'; |
| (...skipping 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2486 if (element is PropertyAccessorElement) { | 2486 if (element is PropertyAccessorElement) { |
| 2487 element = (element as PropertyAccessorElement).variable; | 2487 element = (element as PropertyAccessorElement).variable; |
| 2488 } | 2488 } |
| 2489 name.staticElement = element; | 2489 name.staticElement = element; |
| 2490 } | 2490 } |
| 2491 } | 2491 } |
| 2492 } | 2492 } |
| 2493 } | 2493 } |
| 2494 | 2494 |
| 2495 /** | 2495 /** |
| 2496 * Given an invocation of the form 'C.x()' where 'C' is a class, find and retu rn the element 'x' | 2496 * Given that we are accessing a property of the given [classElement] with |
| 2497 * in 'C'. | 2497 * the given [propertyName], return the element that represents the property. |
| 2498 * | |
| 2499 * @param classElement the class element | |
| 2500 * @param nameNode the member name node | |
| 2501 */ | 2498 */ |
| 2502 Element _resolveElement(ClassElementImpl classElement, | 2499 Element _resolveElement(ClassElementImpl classElement, |
| 2503 SimpleIdentifier nameNode) { | 2500 SimpleIdentifier propertyName) { |
| 2504 String name = nameNode.name; | 2501 String name = propertyName.name; |
| 2505 Element element = classElement.getMethod(name); | 2502 Element element = null; |
| 2506 if (element == null && nameNode.inSetterContext()) { | 2503 if (propertyName.inSetterContext()) { |
| 2507 element = classElement.getSetter(name); | 2504 element = classElement.getSetter(name); |
| 2508 } | 2505 } |
| 2509 if (element == null && nameNode.inGetterContext()) { | 2506 if (element == null) { |
| 2510 element = classElement.getGetter(name); | 2507 element = classElement.getGetter(name); |
| 2511 } | 2508 } |
| 2509 if (element == null) { | |
| 2510 element = classElement.getMethod(name); | |
| 2511 } | |
|
Brian Wilkerson
2015/02/15 22:49:43
I don't really understand why it was necessary to
scheglov
2015/02/16 05:35:53
It corresponds to _resolveProperty() now.
| |
| 2512 if (element != null && element.isAccessibleIn(_definingLibrary)) { | 2512 if (element != null && element.isAccessibleIn(_definingLibrary)) { |
| 2513 return element; | 2513 return element; |
| 2514 } | 2514 } |
| 2515 return null; | 2515 return null; |
| 2516 } | 2516 } |
| 2517 | 2517 |
| 2518 /** | 2518 /** |
| 2519 * Given an invocation of the form 'm(a1, ..., an)', resolve 'm' to the elemen t being invoked. If | 2519 * Given an invocation of the form 'm(a1, ..., an)', resolve 'm' to the elemen t being invoked. If |
| 2520 * the returned element is a method, then the method will be invoked. If the r eturned element is a | 2520 * the returned element is a method, then the method will be invoked. If the r eturned element is a |
| 2521 * getter, the getter will be invoked without arguments and the result of that invocation will | 2521 * getter, the getter will be invoked without arguments and the result of that invocation will |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3123 @override | 3123 @override |
| 3124 Element get staticElement => null; | 3124 Element get staticElement => null; |
| 3125 | 3125 |
| 3126 @override | 3126 @override |
| 3127 accept(AstVisitor visitor) => null; | 3127 accept(AstVisitor visitor) => null; |
| 3128 | 3128 |
| 3129 @override | 3129 @override |
| 3130 void visitChildren(AstVisitor visitor) { | 3130 void visitChildren(AstVisitor visitor) { |
| 3131 } | 3131 } |
| 3132 } | 3132 } |
| OLD | NEW |