| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 elements; | 5 library elements; |
| 6 | 6 |
| 7 import 'dart:uri'; | 7 import 'dart:uri'; |
| 8 | 8 |
| 9 import 'modelx.dart'; | 9 import 'modelx.dart'; |
| 10 import '../tree/tree.dart'; | 10 import '../tree/tree.dart'; |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 | 314 |
| 315 static bool isInstanceSend(Send send, TreeElements elements) { | 315 static bool isInstanceSend(Send send, TreeElements elements) { |
| 316 Element element = elements[send]; | 316 Element element = elements[send]; |
| 317 if (element == null) return !isClosureSend(send, element); | 317 if (element == null) return !isClosureSend(send, element); |
| 318 return isInstanceMethod(element) || isInstanceField(element); | 318 return isInstanceMethod(element) || isInstanceField(element); |
| 319 } | 319 } |
| 320 | 320 |
| 321 static bool isClosureSend(Send send, Element element) { | 321 static bool isClosureSend(Send send, Element element) { |
| 322 if (send.isPropertyAccess) return false; | 322 if (send.isPropertyAccess) return false; |
| 323 if (send.receiver != null) return false; | 323 if (send.receiver != null) return false; |
| 324 Node selector = send.selector; |
| 325 // this(). |
| 326 if (selector.isThis()) return true; |
| 324 // (o)() or foo()(). | 327 // (o)() or foo()(). |
| 325 if (element == null && send.selector.asIdentifier() == null) return true; | 328 if (element == null && selector.asIdentifier() == null) return true; |
| 326 if (element == null) return false; | 329 if (element == null) return false; |
| 327 // foo() with foo a local or a parameter. | 330 // foo() with foo a local or a parameter. |
| 328 return isLocal(element); | 331 return isLocal(element); |
| 329 } | 332 } |
| 330 | 333 |
| 331 static SourceString constructConstructorName(SourceString receiver, | 334 static SourceString constructConstructorName(SourceString receiver, |
| 332 SourceString selector) { | 335 SourceString selector) { |
| 333 String r = receiver.slowToString(); | 336 String r = receiver.slowToString(); |
| 334 String s = selector.slowToString(); | 337 String s = selector.slowToString(); |
| 335 return new SourceString('$r\$$s'); | 338 return new SourceString('$r\$$s'); |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 int get resolutionState; | 861 int get resolutionState; |
| 859 Token get beginToken; | 862 Token get beginToken; |
| 860 Token get endToken; | 863 Token get endToken; |
| 861 | 864 |
| 862 // TODO(kasperl): Try to get rid of these. | 865 // TODO(kasperl): Try to get rid of these. |
| 863 void set annotatedElement(Element value); | 866 void set annotatedElement(Element value); |
| 864 void set resolutionState(int value); | 867 void set resolutionState(int value); |
| 865 | 868 |
| 866 MetadataAnnotation ensureResolved(Compiler compiler); | 869 MetadataAnnotation ensureResolved(Compiler compiler); |
| 867 } | 870 } |
| OLD | NEW |