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 part of dart_backend; | 5 part of dart_backend; |
6 | 6 |
7 // TODO(ahe): This class is simply wrong. This backend should use | 7 // TODO(ahe): This class is simply wrong. This backend should use |
8 // elements when it can, not AST nodes. Perhaps a [Map<Element, | 8 // elements when it can, not AST nodes. Perhaps a [Map<Element, |
9 // TreeElements>] is what is needed. | 9 // TreeElements>] is what is needed. |
10 class ElementAst { | 10 class ElementAst { |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 if (member.isConstructor()) continue NextClassElement; | 350 if (member.isConstructor()) continue NextClassElement; |
351 } | 351 } |
352 if (classElement.constructors.isEmpty) continue NextClassElement; | 352 if (classElement.constructors.isEmpty) continue NextClassElement; |
353 | 353 |
354 // TODO(antonm): check with AAR team if there is better approach. | 354 // TODO(antonm): check with AAR team if there is better approach. |
355 // As an idea: provide template as a Dart code---class C { C.name(); }--- | 355 // As an idea: provide template as a Dart code---class C { C.name(); }--- |
356 // and then overwrite necessary parts. | 356 // and then overwrite necessary parts. |
357 var classNode = classElement.parseNode(compiler); | 357 var classNode = classElement.parseNode(compiler); |
358 SynthesizedConstructorElementX constructor = | 358 SynthesizedConstructorElementX constructor = |
359 new SynthesizedConstructorElementX( | 359 new SynthesizedConstructorElementX( |
360 classElement.name, null, classElement); | 360 classElement.name, null, classElement, false); |
361 constructor.type = new FunctionType( | 361 constructor.type = new FunctionType( |
362 constructor, | 362 constructor, |
363 compiler.types.voidType, | 363 compiler.types.voidType, |
364 const Link<DartType>(), | 364 const Link<DartType>(), |
365 const Link<DartType>(), | 365 const Link<DartType>(), |
366 const Link<SourceString>(), | 366 const Link<SourceString>(), |
367 const Link<DartType>() | 367 const Link<DartType>() |
368 ); | 368 ); |
369 constructor.cachedNode = new FunctionExpression( | 369 constructor.cachedNode = new FunctionExpression( |
370 new Send(classNode.name, synthesizedIdentifier), | 370 new Send(classNode.name, synthesizedIdentifier), |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 } | 546 } |
547 | 547 |
548 compareElements(e0, e1) { | 548 compareElements(e0, e1) { |
549 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); | 549 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); |
550 if (result != 0) return result; | 550 if (result != 0) return result; |
551 return compareBy((e) => e.position().charOffset)(e0, e1); | 551 return compareBy((e) => e.position().charOffset)(e0, e1); |
552 } | 552 } |
553 | 553 |
554 List<Element> sortElements(Iterable<Element> elements) => | 554 List<Element> sortElements(Iterable<Element> elements) => |
555 sorted(elements, compareElements); | 555 sorted(elements, compareElements); |
OLD | NEW |