Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |