Chromium Code Reviews| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 newTypedefElementCallback = (TypedefElement element) { | 296 newTypedefElementCallback = (TypedefElement element) { |
| 297 if (!shouldOutput(element)) return; | 297 if (!shouldOutput(element)) return; |
| 298 addTopLevel(element, | 298 addTopLevel(element, |
| 299 new ElementAst.forClassLike(parse(element))); | 299 new ElementAst.forClassLike(parse(element))); |
| 300 }; | 300 }; |
| 301 newClassElementCallback = (ClassElement classElement) { | 301 newClassElementCallback = (ClassElement classElement) { |
| 302 if (!shouldOutput(classElement)) return; | 302 if (!shouldOutput(classElement)) return; |
| 303 addClass(classElement); | 303 addClass(classElement); |
| 304 }; | 304 }; |
| 305 | 305 |
| 306 compiler.resolverWorld.instantiatedClasses.forEach((ClassElement classElemen t) { | |
|
ahe
2012/10/26 14:13:49
Long line.
Roman
2012/10/29 18:14:12
Done.
| |
| 307 if (shouldOutput(classElement)) addClass(classElement); | |
| 308 }); | |
| 306 resolvedElements.forEach((element, treeElements) { | 309 resolvedElements.forEach((element, treeElements) { |
| 307 if (!shouldOutput(element)) return; | 310 if (!shouldOutput(element)) return; |
| 308 | 311 |
| 309 var elementAst = new ElementAst.rewrite( | 312 var elementAst = new ElementAst.rewrite( |
| 310 compiler, parse(element), treeElements, stripAsserts); | 313 compiler, parse(element), treeElements, stripAsserts); |
| 311 if (element.isField()) { | 314 if (element.isField()) { |
| 312 final list = (element as VariableElement).variables; | 315 final list = (element as VariableElement).variables; |
| 313 elementAst = elementAsts.putIfAbsent( | 316 elementAst = elementAsts.putIfAbsent( |
| 314 list, () => new VariableListAst(parse(list))); | 317 list, () => new VariableListAst(parse(list))); |
| 315 (elementAst as VariableListAst).add(element, treeElements); | 318 (elementAst as VariableListAst).add(element, treeElements); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 536 } | 539 } |
| 537 | 540 |
| 538 compareElements(e0, e1) { | 541 compareElements(e0, e1) { |
| 539 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); | 542 int result = compareBy((e) => e.getLibrary().uri.toString())(e0, e1); |
| 540 if (result != 0) return result; | 543 if (result != 0) return result; |
| 541 return compareBy((e) => e.position().charOffset)(e0, e1); | 544 return compareBy((e) => e.position().charOffset)(e0, e1); |
| 542 } | 545 } |
| 543 | 546 |
| 544 List<Element> sortElements(Collection<Element> elements) => | 547 List<Element> sortElements(Collection<Element> elements) => |
| 545 sorted(elements, compareElements); | 548 sorted(elements, compareElements); |
| OLD | NEW |