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 library dart2js.serialization.task; | 5 library dart2js.serialization.task; |
6 | 6 |
7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
8 import '../common/resolution.dart' show ResolutionImpact, ResolutionWorkItem; | 8 import '../common/resolution.dart' show ResolutionImpact, ResolutionWorkItem; |
9 import '../common/tasks.dart' show CompilerTask; | 9 import '../common/tasks.dart' show CompilerTask; |
10 import '../common/work.dart' show ItemCompilationContext; | 10 import '../common/work.dart' show ItemCompilationContext; |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 DeserializerSystem deserializer; | 28 DeserializerSystem deserializer; |
29 | 29 |
30 String get name => 'Serialization'; | 30 String get name => 'Serialization'; |
31 | 31 |
32 /// If `true`, data must be retained to support serialization. | 32 /// If `true`, data must be retained to support serialization. |
33 // TODO(johnniwinther): Make this more precise in terms of what needs to be | 33 // TODO(johnniwinther): Make this more precise in terms of what needs to be |
34 // retained, for instance impacts, resolution data etc. | 34 // retained, for instance impacts, resolution data etc. |
35 bool supportSerialization = false; | 35 bool supportSerialization = false; |
36 | 36 |
| 37 /// If `true`, deserialized data is supported. |
| 38 bool get supportsDeserialization => deserializer != null; |
| 39 |
37 /// Returns the [LibraryElement] for [resolvedUri] if available from | 40 /// Returns the [LibraryElement] for [resolvedUri] if available from |
38 /// serialization. | 41 /// serialization. |
39 Future<LibraryElement> readLibrary(Uri resolvedUri) { | 42 Future<LibraryElement> readLibrary(Uri resolvedUri) { |
40 if (deserializer == null) return new Future<LibraryElement>.value(); | 43 if (deserializer == null) return new Future<LibraryElement>.value(); |
41 return deserializer.readLibrary(resolvedUri); | 44 return deserializer.readLibrary(resolvedUri); |
42 } | 45 } |
43 | 46 |
44 /// Returns `true` if [element] has been deserialized. | 47 /// Returns `true` if [element] has been deserialized. |
45 bool isDeserialized(Element element) { | 48 bool isDeserialized(Element element) { |
46 return deserializer != null && deserializer.isDeserialized(element); | 49 return deserializer != null && deserializer.isDeserialized(element); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 /// elements. | 104 /// elements. |
102 abstract class DeserializerSystem { | 105 abstract class DeserializerSystem { |
103 Future<LibraryElement> readLibrary(Uri resolvedUri); | 106 Future<LibraryElement> readLibrary(Uri resolvedUri); |
104 bool isDeserialized(Element element); | 107 bool isDeserialized(Element element); |
105 bool hasResolvedAst(ExecutableElement element); | 108 bool hasResolvedAst(ExecutableElement element); |
106 ResolvedAst getResolvedAst(ExecutableElement element); | 109 ResolvedAst getResolvedAst(ExecutableElement element); |
107 bool hasResolutionImpact(Element element); | 110 bool hasResolutionImpact(Element element); |
108 ResolutionImpact getResolutionImpact(Element element); | 111 ResolutionImpact getResolutionImpact(Element element); |
109 WorldImpact computeWorldImpact(Element element); | 112 WorldImpact computeWorldImpact(Element element); |
110 } | 113 } |
OLD | NEW |