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

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: Update test status 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
« no previous file with comments | « frog/leg/namer.dart ('k') | 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 310
311 static bool isLogicalOperator(Identifier op) { 311 static bool isLogicalOperator(Identifier op) {
312 String str = op.source.stringValue; 312 String str = op.source.stringValue;
313 return (str === '&&' || str == '||' || str == '!'); 313 return (str === '&&' || str == '||' || str == '!');
314 } 314 }
315 315
316 Element resolveSend(Send node) { 316 Element resolveSend(Send node) {
317 Element receiver = visit(node.receiver); 317 Element receiver = visit(node.receiver);
318 visit(node.argumentsNode); 318 visit(node.argumentsNode);
319 319
320 Identifier selector = node.selector; 320 Identifier selector = node.selector.asIdentifier();
321 if (selector === null) {
322 // We are calling a closure returned from an expression.
323 assert(node.selector.asExpression() !== null);
324 assert(receiver === null);
325 visit(node.selector);
326 return null;
327 }
328
321 SourceString name = selector.source; 329 SourceString name = selector.source;
322 // No need to assign an element for a logical operation. 330 // No need to assign an element for a logical operation.
323 if (isLogicalOperator(selector)) return null; 331 if (isLogicalOperator(selector)) return null;
324 332
325 Element target = null; 333 Element target = null;
326 if (node.isOperator) { 334 if (node.isOperator) {
327 return null; 335 return null;
328 } else if (node.receiver === null) { 336 } else if (node.receiver === null) {
329 target = lookup(node, name); 337 target = lookup(node, name);
330 if (target == null && !enclosingElement.isInstanceMember()) { 338 if (target == null && !enclosingElement.isInstanceMember()) {
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 class TopScope extends Scope { 713 class TopScope extends Scope {
706 Universe universe; 714 Universe universe;
707 715
708 TopScope(Universe this.universe) : super(null, null); 716 TopScope(Universe this.universe) : super(null, null);
709 Element lookup(SourceString name) => universe.find(name); 717 Element lookup(SourceString name) => universe.find(name);
710 718
711 Element add(Element element) { 719 Element add(Element element) {
712 throw "Cannot add an element in the top scope"; 720 throw "Cannot add an element in the top scope";
713 } 721 }
714 } 722 }
OLDNEW
« no previous file with comments | « frog/leg/namer.dart ('k') | frog/leg/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698