| 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 | 347 |
| 348 // TODO(antonm): check with AAR team if there is better approach. | 348 // TODO(antonm): check with AAR team if there is better approach. |
| 349 // As an idea: provide template as a Dart code---class C { C.name(); }--- | 349 // As an idea: provide template as a Dart code---class C { C.name(); }--- |
| 350 // and then overwrite necessary parts. | 350 // and then overwrite necessary parts. |
| 351 SynthesizedConstructorElement constructor = | 351 SynthesizedConstructorElement constructor = |
| 352 new SynthesizedConstructorElement(classElement); | 352 new SynthesizedConstructorElement(classElement); |
| 353 constructor.type = new FunctionType( | 353 constructor.type = new FunctionType( |
| 354 compiler.types.voidType, const Link<DartType>(), | 354 compiler.types.voidType, const Link<DartType>(), |
| 355 constructor); | 355 constructor); |
| 356 constructor.cachedNode = new FunctionExpression( | 356 constructor.cachedNode = new FunctionExpression( |
| 357 new Send(receiver: classElement.parseNode(compiler).name, | 357 new Send(classElement.parseNode(compiler).name, |
| 358 selector: synthesizedIdentifier), | 358 synthesizedIdentifier), |
| 359 new NodeList(new StringToken(OPEN_PAREN_INFO, '(', -1), | 359 new NodeList(new StringToken(OPEN_PAREN_INFO, '(', -1), |
| 360 const Link<Node>(), | 360 const Link<Node>(), |
| 361 new StringToken(CLOSE_PAREN_INFO, ')', -1)), | 361 new StringToken(CLOSE_PAREN_INFO, ')', -1)), |
| 362 new EmptyStatement(new StringToken(SEMICOLON_INFO, ';', -1)), | 362 new EmptyStatement(new StringToken(SEMICOLON_INFO, ';', -1)), |
| 363 null, Modifiers.EMPTY, null, null); | 363 null, Modifiers.EMPTY, null, null); |
| 364 | 364 |
| 365 classMembers[classElement].add(constructor); | 365 classMembers[classElement].add(constructor); |
| 366 elementAsts[constructor] = | 366 elementAsts[constructor] = |
| 367 new ElementAst(constructor.cachedNode, new TreeElementMapping()); | 367 new ElementAst(constructor.cachedNode, new TreeElementMapping()); |
| 368 } | 368 } |
| (...skipping 167 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 |