Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Defines static information collected by the type checker and used later by | 5 /// Defines static information collected by the type checker and used later by |
| 6 /// emitters to generate code. | 6 /// emitters to generate code. |
| 7 library dev_compiler.src.info; | 7 library dev_compiler.src.info; |
| 8 | 8 |
| 9 import 'dart:mirrors'; | 9 import 'dart:mirrors'; |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 final bool isEntry; | 40 final bool isEntry; |
| 41 | 41 |
| 42 /// Corresponding analyzer element. | 42 /// Corresponding analyzer element. |
| 43 final LibraryElement library; | 43 final LibraryElement library; |
| 44 | 44 |
| 45 LibraryInfo(library, this.isEntry) | 45 LibraryInfo(library, this.isEntry) |
| 46 : library = library, | 46 : library = library, |
| 47 name = utils.canonicalLibraryName(library); | 47 name = utils.canonicalLibraryName(library); |
| 48 } | 48 } |
| 49 | 49 |
| 50 class LibraryUnit { | |
| 51 final CompilationUnit library; | |
| 52 final List<CompilationUnit> parts; | |
| 53 | |
| 54 LibraryUnit(this.library, this.parts); | |
| 55 | |
| 56 Iterable<CompilationUnit> get units sync* { | |
|
Jennifer Messerly
2015/03/17 18:58:45
=D
| |
| 57 yield library; | |
|
Jennifer Messerly
2015/03/17 19:03:05
on second thought... we could just reverse the ord
Jennifer Messerly
2015/03/17 19:11:52
I went ahead and made both orders possible.
Kept a
| |
| 58 yield* parts; | |
| 59 } | |
| 60 } | |
| 61 | |
| 50 // The abstract type of coercions mapping one type to another. | 62 // The abstract type of coercions mapping one type to another. |
| 51 // This class also exposes static builder functions which | 63 // This class also exposes static builder functions which |
| 52 // check for errors and reduce redundant coercions to the identity. | 64 // check for errors and reduce redundant coercions to the identity. |
| 53 abstract class Coercion { | 65 abstract class Coercion { |
| 54 final DartType fromType; | 66 final DartType fromType; |
| 55 final DartType toType; | 67 final DartType toType; |
| 56 Coercion(this.fromType, this.toType); | 68 Coercion(this.fromType, this.toType); |
| 57 static Coercion cast(DartType fromT, DartType toT) => new Cast(fromT, toT); | 69 static Coercion cast(DartType fromT, DartType toT) => new Cast(fromT, toT); |
| 58 static Coercion identity(DartType type) => new Identity(type); | 70 static Coercion identity(DartType type) => new Identity(type); |
| 59 static Coercion error() => new CoercionError(); | 71 static Coercion error() => new CoercionError(); |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 582 for (var cls in declarations.where((d) => d is ClassMirror)) { | 594 for (var cls in declarations.where((d) => d is ClassMirror)) { |
| 583 if (cls.isSubtypeOf(infoMirror)) { | 595 if (cls.isSubtypeOf(infoMirror)) { |
| 584 allTypes.add(cls); | 596 allTypes.add(cls); |
| 585 baseTypes.add(cls.superclass); | 597 baseTypes.add(cls.superclass); |
| 586 } | 598 } |
| 587 } | 599 } |
| 588 allTypes.removeAll(baseTypes); | 600 allTypes.removeAll(baseTypes); |
| 589 return new List<Type>.from(allTypes.map((mirror) => mirror.reflectedType)) | 601 return new List<Type>.from(allTypes.map((mirror) => mirror.reflectedType)) |
| 590 ..sort((t1, t2) => '$t1'.compareTo('$t2')); | 602 ..sort((t1, t2) => '$t1'.compareTo('$t2')); |
| 591 }(); | 603 }(); |
| OLD | NEW |