| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 ClassElement classElement = element; | 205 ClassElement classElement = element; |
| 206 for (final member in classElement.localMembers) { | 206 for (final member in classElement.localMembers) { |
| 207 final name = member.name.slowToString(); | 207 final name = member.name.slowToString(); |
| 208 // Skip operator names. | 208 // Skip operator names. |
| 209 if (name.startsWith(@'operator$')) continue; | 209 if (name.startsWith(@'operator$')) continue; |
| 210 // Fetch name of named constructors and factories if any, | 210 // Fetch name of named constructors and factories if any, |
| 211 // otherwise store regular name. | 211 // otherwise store regular name. |
| 212 // TODO(antonm): better way to analyze the name. | 212 // TODO(antonm): better way to analyze the name. |
| 213 fixedMemberNames.add(name.split(@'$').last()); | 213 fixedMemberNames.add(name.split(@'$').last()); |
| 214 } | 214 } |
| 215 } else { | |
| 216 fixedMemberNames.add(element.name.slowToString()); | |
| 217 } | 215 } |
| 216 // Even class names are added due to a delicate problem we have: |
| 217 // if one imports dart:core with a prefix, we cannot tell prefix.name |
| 218 // from dynamic invocation (alas!). So we'd better err on preserving |
| 219 // those names. |
| 220 fixedMemberNames.add(element.name.slowToString()); |
| 218 } | 221 } |
| 219 } | 222 } |
| 220 // TODO(antonm): TypeError.srcType and TypeError.dstType are defined in | 223 // TODO(antonm): TypeError.srcType and TypeError.dstType are defined in |
| 221 // runtime/lib/error.dart. Overall, all DartVM specific libs should be | 224 // runtime/lib/error.dart. Overall, all DartVM specific libs should be |
| 222 // accounted for. | 225 // accounted for. |
| 223 fixedMemberNames.add('srcType'); | 226 fixedMemberNames.add('srcType'); |
| 224 fixedMemberNames.add('dstType'); | 227 fixedMemberNames.add('dstType'); |
| 225 | 228 |
| 226 /** | 229 /** |
| 227 * Tells whether we should output given element. Corelib classes like | 230 * Tells whether we should output given element. Corelib classes like |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 } | 436 } |
| 434 | 437 |
| 435 compareElements(e0, e1) { | 438 compareElements(e0, e1) { |
| 436 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); | 439 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); |
| 437 if (result != 0) return result; | 440 if (result != 0) return result; |
| 438 return compareBy((e) => e.position().charOffset)(e0, e1); | 441 return compareBy((e) => e.position().charOffset)(e0, e1); |
| 439 } | 442 } |
| 440 | 443 |
| 441 List<Element> sortElements(Collection<Element> elements) => | 444 List<Element> sortElements(Collection<Element> elements) => |
| 442 sorted(elements, compareElements); | 445 sorted(elements, compareElements); |
| OLD | NEW |