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