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

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

Issue 9211005: Support static/global field initializations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added test. 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 while (!toResolve.isEmpty()) { 50 while (!toResolve.isEmpty()) {
51 toResolve.removeFirst().resolve(compiler); 51 toResolve.removeFirst().resolve(compiler);
52 } 52 }
53 return visitor.mapping; 53 return visitor.mapping;
54 } 54 }
55 55
56 TreeElements resolveFieldElement(Element element) { 56 TreeElements resolveFieldElement(Element element) {
57 Node tree = element.parseNode(compiler, compiler); 57 Node tree = element.parseNode(compiler, compiler);
58 ResolverVisitor visitor = new FullResolverVisitor(compiler, element); 58 ResolverVisitor visitor = new FullResolverVisitor(compiler, element);
59 if (tree is SendSet) { 59 if (tree is SendSet) {
60 compiler.unimplemented("Field initializers", node: tree);
61 SendSet send = tree; 60 SendSet send = tree;
62 visitor.visit(send.arguments.head); 61 visitor.visit(send.arguments.head);
63 } 62 }
64 return visitor.mapping; 63 return visitor.mapping;
65 } 64 }
66 65
67 bool isInitializer(SendSet node) { 66 bool isInitializer(SendSet node) {
68 if (node.selector.asIdentifier() == null) return false; 67 if (node.selector.asIdentifier() == null) return false;
69 if (node.receiver == null) return true; 68 if (node.receiver == null) return true;
70 if (node.receiver.asIdentifier() == null) return false; 69 if (node.receiver.asIdentifier() == null) return false;
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 class TopScope extends Scope { 779 class TopScope extends Scope {
781 Universe universe; 780 Universe universe;
782 781
783 TopScope(Universe this.universe) : super(null, null); 782 TopScope(Universe this.universe) : super(null, null);
784 Element lookup(SourceString name) => universe.find(name); 783 Element lookup(SourceString name) => universe.find(name);
785 784
786 Element add(Element element) { 785 Element add(Element element) {
787 throw "Cannot add an element in the top scope"; 786 throw "Cannot add an element in the top scope";
788 } 787 }
789 } 788 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698