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

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

Issue 10823293: Support resolution of indexed operators. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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
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 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 name, 1309 name,
1310 node.argumentsNode is Prefix); 1310 node.argumentsNode is Prefix);
1311 } 1311 }
1312 Selector selector = mapping.getSelector(node); 1312 Selector selector = mapping.getSelector(node);
1313 if (Selector.GETTER === selector) { 1313 if (Selector.GETTER === selector) {
1314 world.registerDynamicGetter(name, selector); 1314 world.registerDynamicGetter(name, selector);
1315 } else if (Selector.SETTER === selector) { 1315 } else if (Selector.SETTER === selector) {
1316 world.registerDynamicSetter(name, selector); 1316 world.registerDynamicSetter(name, selector);
1317 // Also register the getter for compound assignments. 1317 // Also register the getter for compound assignments.
1318 world.registerDynamicGetter(name, Selector.GETTER); 1318 world.registerDynamicGetter(name, Selector.GETTER);
1319 } else { 1319 } else {
kasperl 2012/08/14 07:13:13 Turn this into else-if and move Selector.INDEX_AND
Anton Muhin 2012/08/14 11:34:44 Done.
1320 world.registerDynamicInvocation(name, selector); 1320 if (selector === Selector.INDEX_AND_INDEX_SET) {
1321 register(op, selector) {
kasperl 2012/08/14 07:13:13 This looks fine for now, but I'll probably have to
Anton Muhin 2012/08/14 11:34:44 Sure
1322 world.registerDynamicInvocation(Elements.constructOperatorName(
1323 const SourceString('operator'),
1324 new SourceString(op)), selector);
1325 }
1326 register('[]', Selector.INDEX);
1327 register('[]=', Selector.INDEX_SET);
1328 } else {
1329 world.registerDynamicInvocation(name, selector);
1330 }
1321 } 1331 }
1322 var interceptor = new Interceptors(compiler).getStaticInterceptor( 1332 var interceptor = new Interceptors(compiler).getStaticInterceptor(
1323 name, 1333 name,
1324 node.argumentCount()); 1334 node.argumentCount());
1325 if (interceptor !== null) { 1335 if (interceptor !== null) {
1326 world.registerStaticUse(interceptor); 1336 world.registerStaticUse(interceptor);
1327 } 1337 }
1328 } 1338 }
1329 1339
1330 visitLiteralInt(LiteralInt node) { 1340 visitLiteralInt(LiteralInt node) {
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
2399 TopScope(LibraryElement library) : super(null, library); 2409 TopScope(LibraryElement library) : super(null, library);
2400 Element lookup(SourceString name) { 2410 Element lookup(SourceString name) {
2401 return library.find(name); 2411 return library.find(name);
2402 } 2412 }
2403 2413
2404 Element add(Element newElement) { 2414 Element add(Element newElement) {
2405 throw "Cannot add an element in the top scope"; 2415 throw "Cannot add an element in the top scope";
2406 } 2416 }
2407 String toString() => '$element'; 2417 String toString() => '$element';
2408 } 2418 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/resolver_test.dart » ('j') | tests/compiler/dart2js/resolver_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698