Chromium Code Reviews| 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 elements.modelx; | 5 library elements.modelx; |
| 6 | 6 |
| 7 import 'common.dart'; | 7 import 'common.dart'; |
| 8 import 'elements.dart'; | 8 import 'elements.dart'; |
| 9 import '../constants/constant_constructors.dart'; | 9 import '../constants/constant_constructors.dart'; |
| 10 import '../constants/constructors.dart'; | 10 import '../constants/constructors.dart'; |
| (...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1005 if (origin != null) { | 1005 if (origin != null) { |
| 1006 result = origin.importScope[elementName]; | 1006 result = origin.importScope[elementName]; |
| 1007 if (result != null) return result; | 1007 if (result != null) return result; |
| 1008 } | 1008 } |
| 1009 return null; | 1009 return null; |
| 1010 } | 1010 } |
| 1011 | 1011 |
| 1012 /** Look up a top-level element in this library, but only look for | 1012 /** Look up a top-level element in this library, but only look for |
| 1013 * non-imported elements. Returns null if no such element exist. */ | 1013 * non-imported elements. Returns null if no such element exist. */ |
| 1014 Element findLocal(String elementName) { | 1014 Element findLocal(String elementName) { |
| 1015 // TODO(johnniwinther): How to handle injected elements in the patch | |
| 1016 // library? | |
| 1017 Element result = localScope.lookup(elementName); | 1015 Element result = localScope.lookup(elementName); |
| 1016 if (result == null && isPatched) { | |
| 1017 result = patch.localScope.lookup(elementName); | |
| 1018 } | |
|
Lasse Reichstein Nielsen
2015/08/12 09:46:55
Unrelated change?
floitsch
2015/08/12 13:30:46
No. necessary, because we are looking up an elemen
| |
| 1018 if (result == null || result.library != this) return null; | 1019 if (result == null || result.library != this) return null; |
| 1019 return result; | 1020 return result; |
| 1020 } | 1021 } |
| 1021 | 1022 |
| 1022 Element findExported(String elementName) { | 1023 Element findExported(String elementName) { |
| 1023 for (Link link = exports; !link.isEmpty; link = link.tail) { | 1024 for (Link link = exports; !link.isEmpty; link = link.tail) { |
| 1024 Element element = link.head; | 1025 Element element = link.head; |
| 1025 if (element.name == elementName) return element; | 1026 if (element.name == elementName) return element; |
| 1026 } | 1027 } |
| 1027 return null; | 1028 return null; |
| (...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2906 AstElement get definingElement; | 2907 AstElement get definingElement; |
| 2907 | 2908 |
| 2908 bool get hasResolvedAst => definingElement.hasTreeElements; | 2909 bool get hasResolvedAst => definingElement.hasTreeElements; |
| 2909 | 2910 |
| 2910 ResolvedAst get resolvedAst { | 2911 ResolvedAst get resolvedAst { |
| 2911 return new ResolvedAst(declaration, | 2912 return new ResolvedAst(declaration, |
| 2912 definingElement.node, definingElement.treeElements); | 2913 definingElement.node, definingElement.treeElements); |
| 2913 } | 2914 } |
| 2914 | 2915 |
| 2915 } | 2916 } |
| OLD | NEW |