| 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 interface TreeElements { | 5 interface TreeElements { |
| 6 Element operator[](Node node); | 6 Element operator[](Node node); |
| 7 Selector getSelector(Send send); | 7 Selector getSelector(Send send); |
| 8 Type getType(TypeAnnotation annotation); | 8 Type getType(TypeAnnotation annotation); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 mapping.setSelector(node, Selector.INDEX); | 1188 mapping.setSelector(node, Selector.INDEX); |
| 1189 } else if (node.isPropertyAccess) { | 1189 } else if (node.isPropertyAccess) { |
| 1190 mapping.setSelector(node, Selector.GETTER); | 1190 mapping.setSelector(node, Selector.GETTER); |
| 1191 } else { | 1191 } else { |
| 1192 handleArguments(node); | 1192 handleArguments(node); |
| 1193 } | 1193 } |
| 1194 if (target != null && target.kind == ElementKind.ABSTRACT_FIELD) { | 1194 if (target != null && target.kind == ElementKind.ABSTRACT_FIELD) { |
| 1195 AbstractFieldElement field = target; | 1195 AbstractFieldElement field = target; |
| 1196 target = field.getter; | 1196 target = field.getter; |
| 1197 } | 1197 } |
| 1198 if (node.isCall && | |
| 1199 (target === null || | |
| 1200 target.isGetter() || | |
| 1201 Elements.isClosureSend(node, target))) { | |
| 1202 world.registerDynamicInvocation(compiler.namer.CLOSURE_INVOCATION_NAME, | |
| 1203 mapping.getSelector(node)); | |
| 1204 } | |
| 1205 // TODO(ngeoffray): We should do the check in | 1198 // TODO(ngeoffray): We should do the check in |
| 1206 // visitExpressionStatement instead. | 1199 // visitExpressionStatement instead. |
| 1207 if (target === compiler.assertMethod && !node.isCall) { | 1200 if (target === compiler.assertMethod && !node.isCall) { |
| 1208 // We can only use assert by calling it. | 1201 // We can only use assert by calling it. |
| 1209 if (!inInstanceContext) { | 1202 if (!inInstanceContext) { |
| 1210 error(node, MessageKind.MISSING_ARGUMENTS_TO_ASSERT, [node]); | 1203 error(node, MessageKind.MISSING_ARGUMENTS_TO_ASSERT, [node]); |
| 1211 } | 1204 } |
| 1212 target = null; | 1205 target = null; |
| 1213 } | 1206 } |
| 1214 // TODO(ngeoffray): Warn if target is null and the send is | 1207 // TODO(ngeoffray): Warn if target is null and the send is |
| (...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2310 TopScope(LibraryElement library) : super(null, library); | 2303 TopScope(LibraryElement library) : super(null, library); |
| 2311 Element lookup(SourceString name) { | 2304 Element lookup(SourceString name) { |
| 2312 return library.find(name); | 2305 return library.find(name); |
| 2313 } | 2306 } |
| 2314 | 2307 |
| 2315 Element add(Element newElement) { | 2308 Element add(Element newElement) { |
| 2316 throw "Cannot add an element in the top scope"; | 2309 throw "Cannot add an element in the top scope"; |
| 2317 } | 2310 } |
| 2318 String toString() => '$element'; | 2311 String toString() => '$element'; |
| 2319 } | 2312 } |
| OLD | NEW |