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

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

Issue 9086010: closure calls (just the invocation part). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add test file. 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
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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 307
308 static bool isLogicalOperator(Identifier op) { 308 static bool isLogicalOperator(Identifier op) {
309 String str = op.source.stringValue; 309 String str = op.source.stringValue;
310 return (str === '&&' || str == '||' || str == '!'); 310 return (str === '&&' || str == '||' || str == '!');
311 } 311 }
312 312
313 Element resolveSend(Send node) { 313 Element resolveSend(Send node) {
314 Element receiver = visit(node.receiver); 314 Element receiver = visit(node.receiver);
315 visit(node.argumentsNode); 315 visit(node.argumentsNode);
316 316
317 Identifier selector = node.selector; 317 Identifier selector = node.selector.asIdentifier();
318 if (selector === null) {
kasperl 2012/01/05 07:01:52 Could we have a tester on node.selector instead? S
floitsch 2012/01/05 12:18:38 done. except in the resolver since the test needs
319 // Closure call.
ngeoffray 2012/01/05 14:05:46 Closure call -> We're calling a closure returned f
floitsch 2012/01/24 13:28:37 Done.
320 assert(node.selector.asExpression() !== null);
321 assert(receiver === null);
322 visit(node.selector);
323 return null;
324 }
325
318 SourceString name = selector.source; 326 SourceString name = selector.source;
319 // No need to assign an element for a logical operation. 327 // No need to assign an element for a logical operation.
320 if (isLogicalOperator(selector)) return null; 328 if (isLogicalOperator(selector)) return null;
321 329
322 Element target = null; 330 Element target = null;
323 if (node.isOperator) { 331 if (node.isOperator) {
324 return null; 332 return null;
325 } else if (node.receiver === null) { 333 } else if (node.receiver === null) {
326 target = lookup(node, name); 334 target = lookup(node, name);
327 if (target == null && !enclosingElement.isInstanceMember()) { 335 if (target == null && !enclosingElement.isInstanceMember()) {
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 class TopScope extends Scope { 696 class TopScope extends Scope {
689 Universe universe; 697 Universe universe;
690 698
691 TopScope(Universe this.universe) : super(null, null); 699 TopScope(Universe this.universe) : super(null, null);
692 Element lookup(SourceString name) => universe.find(name); 700 Element lookup(SourceString name) => universe.find(name);
693 701
694 Element add(Element element) { 702 Element add(Element element) {
695 throw "Cannot add an element in the top scope"; 703 throw "Cannot add an element in the top scope";
696 } 704 }
697 } 705 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698