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

Side by Side Diff: frog/leg/resolver.dart

Issue 9169008: Do not resolve the selector to find the getter, but the receiver instead. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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 | « no previous file | frog/leg/ssa/builder.dart » ('j') | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class TreeElements { 5 class TreeElements {
6 Map<Node, Element> map; 6 Map<Node, Element> map;
7 TreeElements() : map = new LinkedHashMap<Node, Element>(); 7 TreeElements() : map = new LinkedHashMap<Node, Element>();
8 operator []=(Node node, Element element) => map[node] = element; 8 operator []=(Node node, Element element) => map[node] = element;
9 operator [](Node node) => map[node]; 9 operator [](Node node) => map[node];
10 } 10 }
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 Element target = resolveSend(node); 363 Element target = resolveSend(node);
364 // TODO(ngeoffray): If target is a field, check that there's a 364 // TODO(ngeoffray): If target is a field, check that there's a
365 // setter. 365 // setter.
366 // TODO(ngeoffray): Check if the target can be assigned. 366 // TODO(ngeoffray): Check if the target can be assigned.
367 Identifier op = node.assignmentOperator; 367 Identifier op = node.assignmentOperator;
368 if (op.source.stringValue !== '=') { 368 if (op.source.stringValue !== '=') {
369 // Resolve the getter for the lhs (receiver+selector). 369 // Resolve the getter for the lhs (receiver+selector).
370 // Currently this is the same as the setter. 370 // Currently this is the same as the setter.
371 // TODO(ngeoffray): Adapt for fields. 371 // TODO(ngeoffray): Adapt for fields.
372 Element getter; 372 Element getter;
373 if (node.isIndex) { 373 if (node.isIndex) {
ahe 2012/01/10 11:42:26 I don't think there is a need for this if-test.
ngeoffray 2012/01/10 11:45:35 Indeed, I just wanted to have different code paths
374 getter = target; 374 getter = target;
375 } else { 375 } else {
376 // TODO(ngeoffray): Find the getter from the setter. 376 // TODO(ngeoffray): Find the getter from the setter.
377 getter = context.lookup(node.selector.asIdentifier().source); 377 getter = target;
378 } 378 }
379 useElement(node.selector, getter); 379 useElement(node.selector, getter);
380 } 380 }
381 return useElement(node, target); 381 return useElement(node, target);
382 } 382 }
383 383
384 visitLiteralInt(LiteralInt node) { 384 visitLiteralInt(LiteralInt node) {
385 } 385 }
386 386
387 visitLiteralDouble(LiteralDouble node) { 387 visitLiteralDouble(LiteralDouble node) {
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 class TopScope extends Scope { 714 class TopScope extends Scope {
715 Universe universe; 715 Universe universe;
716 716
717 TopScope(Universe this.universe) : super(null, null); 717 TopScope(Universe this.universe) : super(null, null);
718 Element lookup(SourceString name) => universe.find(name); 718 Element lookup(SourceString name) => universe.find(name);
719 719
720 Element add(Element element) { 720 Element add(Element element) {
721 throw "Cannot add an element in the top scope"; 721 throw "Cannot add an element in the top scope";
722 } 722 }
723 } 723 }
OLDNEW
« no previous file with comments | « no previous file | frog/leg/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698