| 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 libraryThenParts sync* { |
| 57 yield library; |
| 58 yield* parts; |
| 59 } |
| 60 |
| 61 Iterable<CompilationUnit> get partsThenLibrary sync* { |
| 62 yield* parts; |
| 63 yield library; |
| 64 } |
| 65 } |
| 66 |
| 50 // The abstract type of coercions mapping one type to another. | 67 // The abstract type of coercions mapping one type to another. |
| 51 // This class also exposes static builder functions which | 68 // This class also exposes static builder functions which |
| 52 // check for errors and reduce redundant coercions to the identity. | 69 // check for errors and reduce redundant coercions to the identity. |
| 53 abstract class Coercion { | 70 abstract class Coercion { |
| 54 final DartType fromType; | 71 final DartType fromType; |
| 55 final DartType toType; | 72 final DartType toType; |
| 56 Coercion(this.fromType, this.toType); | 73 Coercion(this.fromType, this.toType); |
| 57 static Coercion cast(DartType fromT, DartType toT) => new Cast(fromT, toT); | 74 static Coercion cast(DartType fromT, DartType toT) => new Cast(fromT, toT); |
| 58 static Coercion identity(DartType type) => new Identity(type); | 75 static Coercion identity(DartType type) => new Identity(type); |
| 59 static Coercion error() => new CoercionError(); | 76 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)) { | 599 for (var cls in declarations.where((d) => d is ClassMirror)) { |
| 583 if (cls.isSubtypeOf(infoMirror)) { | 600 if (cls.isSubtypeOf(infoMirror)) { |
| 584 allTypes.add(cls); | 601 allTypes.add(cls); |
| 585 baseTypes.add(cls.superclass); | 602 baseTypes.add(cls.superclass); |
| 586 } | 603 } |
| 587 } | 604 } |
| 588 allTypes.removeAll(baseTypes); | 605 allTypes.removeAll(baseTypes); |
| 589 return new List<Type>.from(allTypes.map((mirror) => mirror.reflectedType)) | 606 return new List<Type>.from(allTypes.map((mirror) => mirror.reflectedType)) |
| 590 ..sort((t1, t2) => '$t1'.compareTo('$t2')); | 607 ..sort((t1, t2) => '$t1'.compareTo('$t2')); |
| 591 }(); | 608 }(); |
| OLD | NEW |