| 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 if (element.isMember()) { | 319 if (element.isMember()) { |
| 320 ClassElement enclosingClass = element.getEnclosingClass(); | 320 ClassElement enclosingClass = element.getEnclosingClass(); |
| 321 assert(enclosingClass.isClass()); | 321 assert(enclosingClass.isClass()); |
| 322 assert(enclosingClass.isTopLevel()); | 322 assert(enclosingClass.isTopLevel()); |
| 323 assert(shouldOutput(enclosingClass)); | 323 assert(shouldOutput(enclosingClass)); |
| 324 addClass(enclosingClass); | 324 addClass(enclosingClass); |
| 325 classMembers[enclosingClass].add(element); | 325 classMembers[enclosingClass].add(element); |
| 326 processElement(element, elementAst); | 326 processElement(element, elementAst); |
| 327 } else { | 327 } else { |
| 328 if (!element.isTopLevel()) { | 328 if (!element.isTopLevel()) { |
| 329 compiler.cancel(reason: 'Cannot process $element', element: element); | 329 compiler.cancel('Cannot process $element', element: element); |
| 330 } | 330 } |
| 331 addTopLevel(element, elementAst); | 331 addTopLevel(element, elementAst); |
| 332 } | 332 } |
| 333 }); | 333 }); |
| 334 | 334 |
| 335 // Add synthesized constructors to classes with no resolved constructors, | 335 // Add synthesized constructors to classes with no resolved constructors, |
| 336 // but which originally had any constructor. That should prevent | 336 // but which originally had any constructor. That should prevent |
| 337 // those classes from being instantiable with default constructor. | 337 // those classes from being instantiable with default constructor. |
| 338 Identifier synthesizedIdentifier = | 338 Identifier synthesizedIdentifier = |
| 339 new Identifier(new StringToken(IDENTIFIER_INFO, '', -1)); | 339 new Identifier(new StringToken(IDENTIFIER_INFO, '', -1)); |
| (...skipping 196 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 |