Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: dart/lib/compiler/implementation/resolver.dart

Issue 10537129: Address review comments from https://chromiumcodereview.appspot.com/10542073/ (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dart/lib/compiler/implementation/enqueue.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 if (target === compiler.assertMethod && !node.isCall) { 1080 if (target === compiler.assertMethod && !node.isCall) {
1081 // We can only use assert by calling it. 1081 // We can only use assert by calling it.
1082 if (!inInstanceContext) { 1082 if (!inInstanceContext) {
1083 error(node, MessageKind.MISSING_ARGUMENTS_TO_ASSERT, [node]); 1083 error(node, MessageKind.MISSING_ARGUMENTS_TO_ASSERT, [node]);
1084 } 1084 }
1085 target = null; 1085 target = null;
1086 } 1086 }
1087 // TODO(ngeoffray): Warn if target is null and the send is 1087 // TODO(ngeoffray): Warn if target is null and the send is
1088 // unqualified. 1088 // unqualified.
1089 useElement(node, target); 1089 useElement(node, target);
1090 if (target === null) handleDynamicSend(node); 1090 if (target === null) registerDynamicSend(node);
1091 if (node.isPropertyAccess) return target; 1091 if (node.isPropertyAccess) return target;
1092 } 1092 }
1093 1093
1094 visitSendSet(SendSet node) { 1094 visitSendSet(SendSet node) {
1095 Element target = resolveSend(node); 1095 Element target = resolveSend(node);
1096 Element setter = null; 1096 Element setter = null;
1097 Element getter = null; 1097 Element getter = null;
1098 if (target != null && target.kind == ElementKind.ABSTRACT_FIELD) { 1098 if (target != null && target.kind == ElementKind.ABSTRACT_FIELD) {
1099 AbstractFieldElement field = target; 1099 AbstractFieldElement field = target;
1100 setter = field.setter; 1100 setter = field.setter;
(...skipping 15 matching lines...) Expand all
1116 useElement(node.selector, getter); 1116 useElement(node.selector, getter);
1117 } else if (node.isIndex) { 1117 } else if (node.isIndex) {
1118 selector = Selector.INDEX_SET; 1118 selector = Selector.INDEX_SET;
1119 } else { 1119 } else {
1120 selector = Selector.SETTER; 1120 selector = Selector.SETTER;
1121 } 1121 }
1122 visit(node.argumentsNode); 1122 visit(node.argumentsNode);
1123 mapping.setSelector(node, selector); 1123 mapping.setSelector(node, selector);
1124 // TODO(ngeoffray): Warn if target is null and the send is 1124 // TODO(ngeoffray): Warn if target is null and the send is
1125 // unqualified. 1125 // unqualified.
1126 handleDynamicSend(node); 1126 registerDynamicSend(node);
1127 return useElement(node, setter); 1127 return useElement(node, setter);
1128 } 1128 }
1129 1129
1130 handleDynamicSend(Send node) { 1130 registerDynamicSend(Send node) {
1131 Identifier id = node.selector.asIdentifier(); 1131 Identifier id = node.selector.asIdentifier();
1132 if (id === null) return; 1132 if (id === null) return;
1133 SourceString name = node.selector.asIdentifier().source; 1133 SourceString name = node.selector.asIdentifier().source;
1134 if (node.isIndex && !node.arguments.tail.isEmpty()) { 1134 if (node.isIndex && !node.arguments.tail.isEmpty()) {
1135 name = Elements.constructOperatorName( 1135 name = Elements.constructOperatorName(
1136 const SourceString('operator'), 1136 const SourceString('operator'),
1137 const SourceString('[]=')); 1137 const SourceString('[]='));
1138 } else if (node.selector.asOperator() != null) { 1138 } else if (node.selector.asOperator() != null) {
1139 switch (name.stringValue) { 1139 switch (name.stringValue) {
1140 case '===': 1140 case '===':
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
2093 2093
2094 TopScope(LibraryElement library) : super(null, library); 2094 TopScope(LibraryElement library) : super(null, library);
2095 Element lookup(SourceString name) { 2095 Element lookup(SourceString name) {
2096 return library.find(name); 2096 return library.find(name);
2097 } 2097 }
2098 2098
2099 Element add(Element newElement) { 2099 Element add(Element newElement) {
2100 throw "Cannot add an element in the top scope"; 2100 throw "Cannot add an element in the top scope";
2101 } 2101 }
2102 } 2102 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/enqueue.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698