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

Side by Side Diff: lib/compiler/implementation/dart_backend/backend.dart

Issue 10830359: dart2dart Fix collecting type of class fields (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | « no previous file | tests/compiler/dart2js/unparser_test.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) 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 class DartBackend extends Backend { 5 class DartBackend extends Backend {
6 final List<CompilerTask> tasks; 6 final List<CompilerTask> tasks;
7 final UnparseValidator unparseValidator; 7 final UnparseValidator unparseValidator;
8 8
9 Map<Element, TreeElements> get resolvedElements() => 9 Map<Element, TreeElements> get resolvedElements() =>
10 compiler.enqueuer.resolution.resolvedElements; 10 compiler.enqueuer.resolution.resolvedElements;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 131 }
132 132
133 /** 133 /**
134 * Some elements are not recorded by resolver now, 134 * Some elements are not recorded by resolver now,
135 * for example, typedefs or classes which are only 135 * for example, typedefs or classes which are only
136 * used in signatures, as/is operators or in super clauses 136 * used in signatures, as/is operators or in super clauses
137 * (just to name a few). Retraverse AST to pick those up. 137 * (just to name a few). Retraverse AST to pick those up.
138 */ 138 */
139 class ReferencedElementCollector extends AbstractVisitor { 139 class ReferencedElementCollector extends AbstractVisitor {
140 final Compiler compiler; 140 final Compiler compiler;
141 final Element rootElement; 141 Element rootElement;
142 final TreeElements treeElements; 142 final TreeElements treeElements;
143 final newTypedefElementCallback; 143 final newTypedefElementCallback;
144 final newClassElementCallback; 144 final newClassElementCallback;
145 145
146 ReferencedElementCollector( 146 ReferencedElementCollector(
147 this.compiler, 147 this.compiler,
148 this.rootElement, this.treeElements, 148 this.rootElement, this.treeElements,
149 this.newTypedefElementCallback, this.newClassElementCallback); 149 this.newTypedefElementCallback, this.newClassElementCallback);
150 150
151 visitClassNode(ClassNode node) { 151 visitClassNode(ClassNode node) {
(...skipping 12 matching lines...) Expand all
164 164
165 visitTypeAnnotation(TypeAnnotation typeAnnotation) { 165 visitTypeAnnotation(TypeAnnotation typeAnnotation) {
166 final type = compiler.resolveTypeAnnotation(rootElement, typeAnnotation); 166 final type = compiler.resolveTypeAnnotation(rootElement, typeAnnotation);
167 Element typeElement = type.element; 167 Element typeElement = type.element;
168 if (typeElement.isTypedef()) newTypedefElementCallback(typeElement); 168 if (typeElement.isTypedef()) newTypedefElementCallback(typeElement);
169 if (typeElement.isClass()) newClassElementCallback(typeElement); 169 if (typeElement.isClass()) newClassElementCallback(typeElement);
170 typeAnnotation.visitChildren(this); 170 typeAnnotation.visitChildren(this);
171 } 171 }
172 172
173 void collect() { 173 void collect() {
174 if (rootElement is VariableElement) {
Anton Muhin 2012/08/16 16:27:47 let's do that in ctor or in caller, ok?
Roman 2012/08/16 16:33:54 Done. Ternary expression in initializer does not l
Anton Muhin 2012/08/16 16:35:51 Caller might be the better place, but up to you O
175 rootElement = (rootElement as VariableElement).variables;
176 }
174 compiler.withCurrentElement(rootElement, () { 177 compiler.withCurrentElement(rootElement, () {
175 rootElement.parseNode(compiler).accept(this); 178 rootElement.parseNode(compiler).accept(this);
176 }); 179 });
177 } 180 }
178 } 181 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698