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 28 matching lines...) Expand all Loading... |
39 Future<LibraryElement> readLibrary(Uri resolvedUri) { | 39 Future<LibraryElement> readLibrary(Uri resolvedUri) { |
40 if (deserializer == null) return new Future<LibraryElement>.value(); | 40 if (deserializer == null) return new Future<LibraryElement>.value(); |
41 return deserializer.readLibrary(resolvedUri); | 41 return deserializer.readLibrary(resolvedUri); |
42 } | 42 } |
43 | 43 |
44 /// Returns `true` if [element] has been deserialized. | 44 /// Returns `true` if [element] has been deserialized. |
45 bool isDeserialized(Element element) { | 45 bool isDeserialized(Element element) { |
46 return deserializer != null && deserializer.isDeserialized(element); | 46 return deserializer != null && deserializer.isDeserialized(element); |
47 } | 47 } |
48 | 48 |
| 49 bool hasResolutionImpact(Element element) { |
| 50 return deserializer != null && deserializer.hasResolutionImpact(element); |
| 51 } |
| 52 |
| 53 ResolutionImpact getResolutionImpact(Element element) { |
| 54 return deserializer != null |
| 55 ? deserializer.getResolutionImpact(element) |
| 56 : null; |
| 57 } |
| 58 |
49 /// Creates the [ResolutionWorkItem] for the deserialized [element]. | 59 /// Creates the [ResolutionWorkItem] for the deserialized [element]. |
50 ResolutionWorkItem createResolutionWorkItem( | 60 ResolutionWorkItem createResolutionWorkItem( |
51 Element element, ItemCompilationContext context) { | 61 Element element, ItemCompilationContext context) { |
52 assert(deserializer != null); | 62 assert(deserializer != null); |
53 assert(isDeserialized(element)); | 63 assert(isDeserialized(element)); |
54 return new DeserializedResolutionWorkItem( | 64 return new DeserializedResolutionWorkItem( |
55 element, context, deserializer.computeWorldImpact(element)); | 65 element, context, deserializer.computeWorldImpact(element)); |
56 } | 66 } |
57 } | 67 } |
58 | 68 |
(...skipping 19 matching lines...) Expand all Loading... |
78 return worldImpact; | 88 return worldImpact; |
79 } | 89 } |
80 } | 90 } |
81 | 91 |
82 /// The interface for a system that supports deserialization of libraries and | 92 /// The interface for a system that supports deserialization of libraries and |
83 /// elements. | 93 /// elements. |
84 abstract class DeserializerSystem { | 94 abstract class DeserializerSystem { |
85 Future<LibraryElement> readLibrary(Uri resolvedUri); | 95 Future<LibraryElement> readLibrary(Uri resolvedUri); |
86 bool isDeserialized(Element element); | 96 bool isDeserialized(Element element); |
87 ResolvedAst getResolvedAst(Element element); | 97 ResolvedAst getResolvedAst(Element element); |
| 98 bool hasResolutionImpact(Element element); |
88 ResolutionImpact getResolutionImpact(Element element); | 99 ResolutionImpact getResolutionImpact(Element element); |
89 WorldImpact computeWorldImpact(Element element); | 100 WorldImpact computeWorldImpact(Element element); |
90 } | 101 } |
OLD | NEW |