Chromium Code Reviews| 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 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1186 mapping.setSelector(node, Selector.INDEX); | 1186 mapping.setSelector(node, Selector.INDEX); |
| 1187 } else if (node.isPropertyAccess) { | 1187 } else if (node.isPropertyAccess) { |
| 1188 mapping.setSelector(node, Selector.GETTER); | 1188 mapping.setSelector(node, Selector.GETTER); |
| 1189 } else { | 1189 } else { |
| 1190 handleArguments(node); | 1190 handleArguments(node); |
| 1191 } | 1191 } |
| 1192 if (target != null && target.kind == ElementKind.ABSTRACT_FIELD) { | 1192 if (target != null && target.kind == ElementKind.ABSTRACT_FIELD) { |
| 1193 AbstractFieldElement field = target; | 1193 AbstractFieldElement field = target; |
| 1194 target = field.getter; | 1194 target = field.getter; |
| 1195 } | 1195 } |
| 1196 if (node.isCall && | |
| 1197 (target == null || | |
|
ahe
2012/08/10 09:11:35
=== for consistency with the rest of the file.
floitsch
2012/08/10 12:19:16
Done.
| |
| 1198 target.isGetter() || | |
|
ahe
2012/08/10 09:11:35
I think you also need:
target.isInstanceMember()
ahe
2012/08/10 09:15:49
Never mind.
| |
| 1199 Elements.isClosureSend(node, target))) { | |
| 1200 world.registerDynamicInvocation(compiler.namer.CLOSURE_INVOCATION_NAME, | |
| 1201 mapping.getSelector(node)); | |
| 1202 } | |
| 1196 // TODO(ngeoffray): We should do the check in | 1203 // TODO(ngeoffray): We should do the check in |
| 1197 // visitExpressionStatement instead. | 1204 // visitExpressionStatement instead. |
| 1198 if (target === compiler.assertMethod && !node.isCall) { | 1205 if (target === compiler.assertMethod && !node.isCall) { |
| 1199 // We can only use assert by calling it. | 1206 // We can only use assert by calling it. |
| 1200 if (!inInstanceContext) { | 1207 if (!inInstanceContext) { |
| 1201 error(node, MessageKind.MISSING_ARGUMENTS_TO_ASSERT, [node]); | 1208 error(node, MessageKind.MISSING_ARGUMENTS_TO_ASSERT, [node]); |
| 1202 } | 1209 } |
| 1203 target = null; | 1210 target = null; |
| 1204 } | 1211 } |
| 1205 // TODO(ngeoffray): Warn if target is null and the send is | 1212 // TODO(ngeoffray): Warn if target is null and the send is |
| (...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2301 TopScope(LibraryElement library) : super(null, library); | 2308 TopScope(LibraryElement library) : super(null, library); |
| 2302 Element lookup(SourceString name) { | 2309 Element lookup(SourceString name) { |
| 2303 return library.find(name); | 2310 return library.find(name); |
| 2304 } | 2311 } |
| 2305 | 2312 |
| 2306 Element add(Element newElement) { | 2313 Element add(Element newElement) { |
| 2307 throw "Cannot add an element in the top scope"; | 2314 throw "Cannot add an element in the top scope"; |
| 2308 } | 2315 } |
| 2309 String toString() => '$element'; | 2316 String toString() => '$element'; |
| 2310 } | 2317 } |
| OLD | NEW |