| 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(@'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(@'$').last()); |
| 229 } | 229 } |
| 230 } else { | |
| 231 fixedMemberNames.add(element.name.slowToString()); | |
| 232 } | 230 } |
| 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 |
| 233 // from dynamic invocation (alas!). So we'd better err on preserving |
| 234 // those names. |
| 235 fixedMemberNames.add(element.name.slowToString()); |
| 233 } | 236 } |
| 234 } | 237 } |
| 235 // TODO(antonm): TypeError.srcType and TypeError.dstType are defined in | 238 // TODO(antonm): TypeError.srcType and TypeError.dstType are defined in |
| 236 // runtime/lib/error.dart. Overall, all DartVM specific libs should be | 239 // runtime/lib/error.dart. Overall, all DartVM specific libs should be |
| 237 // accounted for. | 240 // accounted for. |
| 238 fixedMemberNames.add('srcType'); | 241 fixedMemberNames.add('srcType'); |
| 239 fixedMemberNames.add('dstType'); | 242 fixedMemberNames.add('dstType'); |
| 240 | 243 |
| 241 /** | 244 /** |
| 242 * Tells whether we should output given element. Corelib classes like | 245 * Tells whether we should output given element. Corelib classes like |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 } | 451 } |
| 449 | 452 |
| 450 compareElements(e0, e1) { | 453 compareElements(e0, e1) { |
| 451 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); | 454 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); |
| 452 if (result != 0) return result; | 455 if (result != 0) return result; |
| 453 return compareBy((e) => e.position().charOffset)(e0, e1); | 456 return compareBy((e) => e.position().charOffset)(e0, e1); |
| 454 } | 457 } |
| 455 | 458 |
| 456 List<Element> sortElements(Collection<Element> elements) => | 459 List<Element> sortElements(Collection<Element> elements) => |
| 457 sorted(elements, compareElements); | 460 sorted(elements, compareElements); |
| OLD | NEW |