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

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

Issue 10990053: [dart2dart] Force-compile top-level elements in libraries to get local members correctly. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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/dart_backend_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 const bool REMOVE_ASSERTS = false; 5 const bool REMOVE_ASSERTS = false;
6 6
7 class ElementAst { 7 class ElementAst {
8 final Node ast; 8 final Node ast;
9 final TreeElements treeElements; 9 final TreeElements treeElements;
10 10
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // Conservatively traverse all platform libraries and collect member names. 211 // Conservatively traverse all platform libraries and collect member names.
212 // TODO(antonm): ideally we should only collect names of used members, 212 // TODO(antonm): ideally we should only collect names of used members,
213 // however as of today there are problems with names of some core library 213 // however as of today there are problems with names of some core library
214 // interfaces, most probably for interfaces of literals. 214 // interfaces, most probably for interfaces of literals.
215 final fixedMemberNames = new Set<String>(); 215 final fixedMemberNames = new Set<String>();
216 for (final library in compiler.libraries.getValues()) { 216 for (final library in compiler.libraries.getValues()) {
217 if (!library.isPlatformLibrary) continue; 217 if (!library.isPlatformLibrary) continue;
218 for (final element in library.localMembers) { 218 for (final element in library.localMembers) {
219 if (element is ClassElement) { 219 if (element is ClassElement) {
220 ClassElement classElement = element; 220 ClassElement classElement = element;
221 // Make sure we parsed the class to initialize its local members.
222 element.parseNode(compiler);
Anton Muhin 2012/09/26 13:49:47 Feels somewhat like a hack. May you add a TODO to
Roman 2012/09/26 14:00:34 Done.
221 for (final member in classElement.localMembers) { 223 for (final member in classElement.localMembers) {
222 final name = member.name.slowToString(); 224 final name = member.name.slowToString();
223 // Skip operator names. 225 // Skip operator names.
224 if (name.startsWith(r'operator$')) continue; 226 if (name.startsWith(r'operator$')) continue;
225 // Fetch name of named constructors and factories if any, 227 // Fetch name of named constructors and factories if any,
226 // otherwise store regular name. 228 // otherwise store regular name.
227 // TODO(antonm): better way to analyze the name. 229 // TODO(antonm): better way to analyze the name.
228 fixedMemberNames.add(name.split(r'$').last()); 230 fixedMemberNames.add(name.split(r'$').last());
229 } 231 }
230 } 232 }
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 } 453 }
452 454
453 compareElements(e0, e1) { 455 compareElements(e0, e1) {
454 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); 456 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1);
455 if (result != 0) return result; 457 if (result != 0) return result;
456 return compareBy((e) => e.position().charOffset)(e0, e1); 458 return compareBy((e) => e.position().charOffset)(e0, e1);
457 } 459 }
458 460
459 List<Element> sortElements(Collection<Element> elements) => 461 List<Element> sortElements(Collection<Element> elements) =>
460 sorted(elements, compareElements); 462 sorted(elements, compareElements);
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/dart_backend_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698