| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 for (final member in classElement.localMembers) { | 221 for (final member in classElement.localMembers) { |
| 222 final name = member.name.slowToString(); | 222 final name = member.name.slowToString(); |
| 223 // Skip operator names. | 223 // Skip operator names. |
| 224 if (name.startsWith(@'operator$')) continue; | 224 if (name.startsWith(r'operator$')) continue; |
| 225 // Fetch name of named constructors and factories if any, | 225 // Fetch name of named constructors and factories if any, |
| 226 // otherwise store regular name. | 226 // otherwise store regular name. |
| 227 // TODO(antonm): better way to analyze the name. | 227 // TODO(antonm): better way to analyze the name. |
| 228 fixedMemberNames.add(name.split(@'$').last()); | 228 fixedMemberNames.add(name.split(r'$').last()); |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 // Even class names are added due to a delicate problem we have: | 231 // Even class names are added due to a delicate problem we have: |
| 232 // if one imports dart:core with a prefix, we cannot tell prefix.name | 232 // if one imports dart:core with a prefix, we cannot tell prefix.name |
| 233 // from dynamic invocation (alas!). So we'd better err on preserving | 233 // from dynamic invocation (alas!). So we'd better err on preserving |
| 234 // those names. | 234 // those names. |
| 235 fixedMemberNames.add(element.name.slowToString()); | 235 fixedMemberNames.add(element.name.slowToString()); |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 // TODO(antonm): TypeError.srcType and TypeError.dstType are defined in | 238 // TODO(antonm): TypeError.srcType and TypeError.dstType are defined in |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 } | 451 } |
| 452 | 452 |
| 453 compareElements(e0, e1) { | 453 compareElements(e0, e1) { |
| 454 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); | 454 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); |
| 455 if (result != 0) return result; | 455 if (result != 0) return result; |
| 456 return compareBy((e) => e.position().charOffset)(e0, e1); | 456 return compareBy((e) => e.position().charOffset)(e0, e1); |
| 457 } | 457 } |
| 458 | 458 |
| 459 List<Element> sortElements(Collection<Element> elements) => | 459 List<Element> sortElements(Collection<Element> elements) => |
| 460 sorted(elements, compareElements); | 460 sorted(elements, compareElements); |
| OLD | NEW |