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 // TODO(ahe): This class is simply wrong. This backend should use | 5 // TODO(ahe): This class is simply wrong. This backend should use |
6 // elements when it can, not AST nodes. Perhaps a [Map<Element, | 6 // elements when it can, not AST nodes. Perhaps a [Map<Element, |
7 // TreeElements>] is what is needed. | 7 // TreeElements>] is what is needed. |
8 class ElementAst { | 8 class ElementAst { |
9 final Node ast; | 9 final Node ast; |
10 final TreeElements treeElements; | 10 final TreeElements treeElements; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // TODO(smok): Figure out if there is a better way to fill local | 235 // TODO(smok): Figure out if there is a better way to fill local |
236 // members. | 236 // members. |
237 element.parseNode(compiler); | 237 element.parseNode(compiler); |
238 for (final member in classElement.localMembers) { | 238 for (final member in classElement.localMembers) { |
239 final name = member.name.slowToString(); | 239 final name = member.name.slowToString(); |
240 // Skip operator names. | 240 // Skip operator names. |
241 if (name.startsWith(r'operator$')) continue; | 241 if (name.startsWith(r'operator$')) continue; |
242 // Fetch name of named constructors and factories if any, | 242 // Fetch name of named constructors and factories if any, |
243 // otherwise store regular name. | 243 // otherwise store regular name. |
244 // TODO(antonm): better way to analyze the name. | 244 // TODO(antonm): better way to analyze the name. |
245 fixedMemberNames.add(name.split(r'$').last()); | 245 fixedMemberNames.add(name.split(r'$').last); |
246 } | 246 } |
247 } | 247 } |
248 // Even class names are added due to a delicate problem we have: | 248 // Even class names are added due to a delicate problem we have: |
249 // if one imports dart:core with a prefix, we cannot tell prefix.name | 249 // if one imports dart:core with a prefix, we cannot tell prefix.name |
250 // from dynamic invocation (alas!). So we'd better err on preserving | 250 // from dynamic invocation (alas!). So we'd better err on preserving |
251 // those names. | 251 // those names. |
252 fixedMemberNames.add(element.name.slowToString()); | 252 fixedMemberNames.add(element.name.slowToString()); |
253 }); | 253 }); |
254 } | 254 } |
255 // TODO(antonm): TypeError.srcType and TypeError.dstType are defined in | 255 // TODO(antonm): TypeError.srcType and TypeError.dstType are defined in |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 } | 541 } |
542 | 542 |
543 compareElements(e0, e1) { | 543 compareElements(e0, e1) { |
544 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); | 544 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); |
545 if (result != 0) return result; | 545 if (result != 0) return result; |
546 return compareBy((e) => e.position().charOffset)(e0, e1); | 546 return compareBy((e) => e.position().charOffset)(e0, e1); |
547 } | 547 } |
548 | 548 |
549 List<Element> sortElements(Collection<Element> elements) => | 549 List<Element> sortElements(Collection<Element> elements) => |
550 sorted(elements, compareElements); | 550 sorted(elements, compareElements); |
OLD | NEW |