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

Side by Side Diff: pkg/compiler/lib/src/dart_backend/placeholder_collector.dart

Issue 1030103004: Implement ResolvedVisitor using SemanticSendVisitor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cleanups. Created 5 years, 9 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of dart_backend; 5 part of dart_backend;
6 6
7 class LocalPlaceholder { 7 class LocalPlaceholder {
8 final String identifier; 8 final String identifier;
9 final Set<Node> nodes; 9 final Set<Node> nodes;
10 LocalPlaceholder(this.identifier) : nodes = new Set<Node>(); 10 LocalPlaceholder(this.identifier) : nodes = new Set<Node>();
(...skipping 19 matching lines...) Expand all
30 30
31 ConstructorPlaceholder(this.node, this.element); 31 ConstructorPlaceholder(this.node, this.element);
32 } 32 }
33 33
34 class DeclarationTypePlaceholder { 34 class DeclarationTypePlaceholder {
35 final TypeAnnotation typeNode; 35 final TypeAnnotation typeNode;
36 final bool requiresVar; 36 final bool requiresVar;
37 DeclarationTypePlaceholder(this.typeNode, this.requiresVar); 37 DeclarationTypePlaceholder(this.typeNode, this.requiresVar);
38 } 38 }
39 39
40 class SendVisitor extends ResolvedVisitor { 40 class SendVisitor extends OldResolvedVisitor {
41 final PlaceholderCollector collector; 41 final PlaceholderCollector collector;
42 42
43 SendVisitor(this.collector, TreeElements elements) 43 SendVisitor(this.collector, TreeElements elements)
44 : super(elements); 44 : super(elements);
45 45
46 visitOperatorSend(Send node) { 46 visitOperatorSend(Send node) {
47 } 47 }
48 48
49 visitForeignSend(Send node) {} 49 visitForeignSend(Send node) {}
50 50
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // in case of A(int this.f()); 93 // in case of A(int this.f());
94 if (node.selector is Identifier) { 94 if (node.selector is Identifier) {
95 collector.tryMakeLocalPlaceholder(element, node.selector); 95 collector.tryMakeLocalPlaceholder(element, node.selector);
96 } else { 96 } else {
97 assert(node.selector is FunctionExpression); 97 assert(node.selector is FunctionExpression);
98 } 98 }
99 } 99 }
100 } 100 }
101 } 101 }
102 102
103 visitAssert(node) { 103 visitAssertSend(node) {
104 visitStaticSend(node); 104 visitStaticSend(node);
105 } 105 }
106 106
107 visitStaticSend(Send node) { 107 visitStaticSend(Send node) {
108 Element element = elements[node]; 108 Element element = elements[node];
109 collector.mirrorRenamer.registerStaticSend( 109 collector.mirrorRenamer.registerStaticSend(
110 collector.currentElement, element, node); 110 collector.currentElement, element, node);
111 111
112 if (Elements.isUnresolved(element) 112 if (Elements.isUnresolved(element)
113 || elements.isAssert(node) 113 || elements.isAssert(node)
(...skipping 13 matching lines...) Expand all
127 collector.makeElementPlaceholder(node.selector, element); 127 collector.makeElementPlaceholder(node.selector, element);
128 // Another ugly case: <lib prefix>.<top level> is represented as 128 // Another ugly case: <lib prefix>.<top level> is represented as
129 // receiver: lib prefix, selector: top level. 129 // receiver: lib prefix, selector: top level.
130 if (element.isTopLevel && node.receiver != null) { 130 if (element.isTopLevel && node.receiver != null) {
131 assert(elements[node.receiver].isPrefix); 131 assert(elements[node.receiver].isPrefix);
132 // Hack: putting null into map overrides receiver of original node. 132 // Hack: putting null into map overrides receiver of original node.
133 collector.makeErasePrefixPlaceholder(node.receiver); 133 collector.makeErasePrefixPlaceholder(node.receiver);
134 } 134 }
135 } 135 }
136 136
137 internalError(String reason, {Node node}) { 137 internalError(Spannable node, String reason) {
138 collector.internalError(reason, node: node); 138 collector.internalError(reason, node: node);
139 } 139 }
140 140
141 visitTypePrefixSend(Send node) { 141 visitTypePrefixSend(Send node) {
142 collector.makeElementPlaceholder(node, elements[node]); 142 collector.makeElementPlaceholder(node, elements[node]);
143 } 143 }
144 144
145 visitTypeLiteralSend(Send node) { 145 visitTypeLiteralSend(Send node) {
146 DartType type = elements.getTypeLiteralType(node); 146 DartType type = elements.getTypeLiteralType(node);
147 if (!type.isDynamic) { 147 if (!type.isDynamic) {
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 700
701 visitBlock(Block node) { 701 visitBlock(Block node) {
702 for (Node statement in node.statements.nodes) { 702 for (Node statement in node.statements.nodes) {
703 if (statement is VariableDefinitions) { 703 if (statement is VariableDefinitions) {
704 makeVarDeclarationTypePlaceholder(statement); 704 makeVarDeclarationTypePlaceholder(statement);
705 } 705 }
706 } 706 }
707 node.visitChildren(this); 707 node.visitChildren(this);
708 } 708 }
709 } 709 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698