| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 new ElementAst.forClassLike(parse(element))); | 274 new ElementAst.forClassLike(parse(element))); |
| 275 }; | 275 }; |
| 276 newClassElementCallback = (ClassElement classElement) { | 276 newClassElementCallback = (ClassElement classElement) { |
| 277 if (!shouldOutput(classElement)) return; | 277 if (!shouldOutput(classElement)) return; |
| 278 addClass(classElement); | 278 addClass(classElement); |
| 279 }; | 279 }; |
| 280 | 280 |
| 281 resolvedElements.forEach((element, treeElements) { | 281 resolvedElements.forEach((element, treeElements) { |
| 282 if (!shouldOutput(element)) return; | 282 if (!shouldOutput(element)) return; |
| 283 | 283 |
| 284 var elementAst = new ElementAst.rewrite(compiler, parse(element), treeElem
ents); | 284 var elementAst = |
| 285 new ElementAst.rewrite(compiler, parse(element), treeElements); |
| 285 if (element.isField()) { | 286 if (element.isField()) { |
| 286 final list = (element as VariableElement).variables; | 287 final list = (element as VariableElement).variables; |
| 287 elementAst = elementAsts.putIfAbsent( | 288 elementAst = elementAsts.putIfAbsent( |
| 288 list, () => new VariableListAst(parse(list))); | 289 list, () => new VariableListAst(parse(list))); |
| 289 (elementAst as VariableListAst).add(element, treeElements); | 290 (elementAst as VariableListAst).add(element, treeElements); |
| 290 element = list; | 291 element = list; |
| 291 } | 292 } |
| 292 | 293 |
| 293 if (element.isMember()) { | 294 if (element.isMember()) { |
| 294 ClassElement enclosingClass = element.getEnclosingClass(); | 295 ClassElement enclosingClass = element.getEnclosingClass(); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 } | 433 } |
| 433 | 434 |
| 434 compareElements(e0, e1) { | 435 compareElements(e0, e1) { |
| 435 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); | 436 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); |
| 436 if (result != 0) return result; | 437 if (result != 0) return result; |
| 437 return compareBy((e) => e.position().charOffset)(e0, e1); | 438 return compareBy((e) => e.position().charOffset)(e0, e1); |
| 438 } | 439 } |
| 439 | 440 |
| 440 List<Element> sortElements(Collection<Element> elements) => | 441 List<Element> sortElements(Collection<Element> elements) => |
| 441 sorted(elements, compareElements); | 442 sorted(elements, compareElements); |
| OLD | NEW |