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 class ElementAst { | 5 class ElementAst { |
6 final Node ast; | 6 final Node ast; |
7 final TreeElements treeElements; | 7 final TreeElements treeElements; |
8 | 8 |
9 ElementAst(this.ast, this.treeElements); | 9 ElementAst(this.ast, this.treeElements); |
10 | 10 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 // TODO(smok): Figure out if there is a better way to fill local | 230 // TODO(smok): Figure out if there is a better way to fill local |
231 // members. | 231 // members. |
232 element.parseNode(compiler); | 232 element.parseNode(compiler); |
233 for (final member in classElement.localMembers) { | 233 for (final member in classElement.localMembers) { |
234 final name = member.name.slowToString(); | 234 final name = member.name.slowToString(); |
235 // Skip operator names. | 235 // Skip operator names. |
236 if (name.startsWith(r'operator$')) continue; | 236 if (name.startsWith(r'operator$')) continue; |
237 // Fetch name of named constructors and factories if any, | 237 // Fetch name of named constructors and factories if any, |
238 // otherwise store regular name. | 238 // otherwise store regular name. |
239 // TODO(antonm): better way to analyze the name. | 239 // TODO(antonm): better way to analyze the name. |
240 fixedMemberNames.add(name.split(r'$').last()); | 240 fixedMemberNames.add(name.split(r'$').last); |
241 } | 241 } |
242 } | 242 } |
243 // Even class names are added due to a delicate problem we have: | 243 // Even class names are added due to a delicate problem we have: |
244 // if one imports dart:core with a prefix, we cannot tell prefix.name | 244 // if one imports dart:core with a prefix, we cannot tell prefix.name |
245 // from dynamic invocation (alas!). So we'd better err on preserving | 245 // from dynamic invocation (alas!). So we'd better err on preserving |
246 // those names. | 246 // those names. |
247 fixedMemberNames.add(element.name.slowToString()); | 247 fixedMemberNames.add(element.name.slowToString()); |
248 }); | 248 }); |
249 } | 249 } |
250 // TODO(antonm): TypeError.srcType and TypeError.dstType are defined in | 250 // TODO(antonm): TypeError.srcType and TypeError.dstType are defined in |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 } | 536 } |
537 | 537 |
538 compareElements(e0, e1) { | 538 compareElements(e0, e1) { |
539 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); | 539 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); |
540 if (result != 0) return result; | 540 if (result != 0) return result; |
541 return compareBy((e) => e.position().charOffset)(e0, e1); | 541 return compareBy((e) => e.position().charOffset)(e0, e1); |
542 } | 542 } |
543 | 543 |
544 List<Element> sortElements(Collection<Element> elements) => | 544 List<Element> sortElements(Collection<Element> elements) => |
545 sorted(elements, compareElements); | 545 sorted(elements, compareElements); |
OLD | NEW |