| 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 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 mapping.setSelector(node, Selector.INDEX); | 1045 mapping.setSelector(node, Selector.INDEX); |
| 1046 } else if (node.isPropertyAccess) { | 1046 } else if (node.isPropertyAccess) { |
| 1047 mapping.setSelector(node, Selector.GETTER); | 1047 mapping.setSelector(node, Selector.GETTER); |
| 1048 } else { | 1048 } else { |
| 1049 handleArguments(node); | 1049 handleArguments(node); |
| 1050 } | 1050 } |
| 1051 if (target != null && target.kind == ElementKind.ABSTRACT_FIELD) { | 1051 if (target != null && target.kind == ElementKind.ABSTRACT_FIELD) { |
| 1052 AbstractFieldElement field = target; | 1052 AbstractFieldElement field = target; |
| 1053 target = field.getter; | 1053 target = field.getter; |
| 1054 } | 1054 } |
| 1055 // TODO(ngeoffray): We should do the check in |
| 1056 // visitExpressionStatement instead. |
| 1057 if (target === compiler.assertMethod && !node.isCall) { |
| 1058 // We can only use assert by calling it. |
| 1059 if (!inInstanceContext) { |
| 1060 error(node, MessageKind.MISSING_ARGUMENTS_TO_ASSERT, [node]); |
| 1061 } |
| 1062 target = null; |
| 1063 } |
| 1055 // TODO(ngeoffray): Warn if target is null and the send is | 1064 // TODO(ngeoffray): Warn if target is null and the send is |
| 1056 // unqualified. | 1065 // unqualified. |
| 1057 useElement(node, target); | 1066 useElement(node, target); |
| 1058 if (node.isPropertyAccess) return target; | 1067 if (node.isPropertyAccess) return target; |
| 1059 } | 1068 } |
| 1060 | 1069 |
| 1061 visitSendSet(SendSet node) { | 1070 visitSendSet(SendSet node) { |
| 1062 Element target = resolveSend(node); | 1071 Element target = resolveSend(node); |
| 1063 Element setter = null; | 1072 Element setter = null; |
| 1064 Element getter = null; | 1073 Element getter = null; |
| (...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2004 | 2013 |
| 2005 TopScope(LibraryElement library) : super(null, library); | 2014 TopScope(LibraryElement library) : super(null, library); |
| 2006 Element lookup(SourceString name) { | 2015 Element lookup(SourceString name) { |
| 2007 return library.find(name); | 2016 return library.find(name); |
| 2008 } | 2017 } |
| 2009 | 2018 |
| 2010 Element add(Element newElement) { | 2019 Element add(Element newElement) { |
| 2011 throw "Cannot add an element in the top scope"; | 2020 throw "Cannot add an element in the top scope"; |
| 2012 } | 2021 } |
| 2013 } | 2022 } |
| OLD | NEW |