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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 /// Creates the [ResolutionWorkItem] for the deserialized [element]. | 59 /// Creates the [ResolutionWorkItem] for the deserialized [element]. |
60 ResolutionWorkItem createResolutionWorkItem( | 60 ResolutionWorkItem createResolutionWorkItem( |
61 Element element, ItemCompilationContext context) { | 61 Element element, ItemCompilationContext context) { |
62 assert(deserializer != null); | 62 assert(deserializer != null); |
63 assert(isDeserialized(element)); | 63 assert(isDeserialized(element)); |
64 return new DeserializedResolutionWorkItem( | 64 return new DeserializedResolutionWorkItem( |
65 element, context, deserializer.computeWorldImpact(element)); | 65 element, context, deserializer.computeWorldImpact(element)); |
66 } | 66 } |
67 | 67 |
68 bool hasResolvedAst(Element element) { | 68 bool hasResolvedAst(ExecutableElement element) { |
69 return deserializer != null ? deserializer.hasResolvedAst(element) : false; | 69 return deserializer != null ? deserializer.hasResolvedAst(element) : false; |
70 } | 70 } |
71 | 71 |
72 ResolvedAst getResolvedAst(Element element) { | 72 ResolvedAst getResolvedAst(ExecutableElement element) { |
73 return deserializer != null ? deserializer.getResolvedAst(element) : null; | 73 return deserializer != null ? deserializer.getResolvedAst(element) : null; |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 /// A [ResolutionWorkItem] for a deserialized element. | 77 /// A [ResolutionWorkItem] for a deserialized element. |
78 /// | 78 /// |
79 /// This will not resolve the element but only compute the [WorldImpact]. | 79 /// This will not resolve the element but only compute the [WorldImpact]. |
80 class DeserializedResolutionWorkItem implements ResolutionWorkItem { | 80 class DeserializedResolutionWorkItem implements ResolutionWorkItem { |
81 final Element element; | 81 final Element element; |
82 final ItemCompilationContext compilationContext; | 82 final ItemCompilationContext compilationContext; |
(...skipping 12 matching lines...) Expand all Loading... |
95 world.registerProcessedElement(element); | 95 world.registerProcessedElement(element); |
96 return worldImpact; | 96 return worldImpact; |
97 } | 97 } |
98 } | 98 } |
99 | 99 |
100 /// The interface for a system that supports deserialization of libraries and | 100 /// The interface for a system that supports deserialization of libraries and |
101 /// elements. | 101 /// elements. |
102 abstract class DeserializerSystem { | 102 abstract class DeserializerSystem { |
103 Future<LibraryElement> readLibrary(Uri resolvedUri); | 103 Future<LibraryElement> readLibrary(Uri resolvedUri); |
104 bool isDeserialized(Element element); | 104 bool isDeserialized(Element element); |
105 bool hasResolvedAst(Element element); | 105 bool hasResolvedAst(ExecutableElement element); |
106 ResolvedAst getResolvedAst(Element element); | 106 ResolvedAst getResolvedAst(ExecutableElement element); |
107 bool hasResolutionImpact(Element element); | 107 bool hasResolutionImpact(Element element); |
108 ResolutionImpact getResolutionImpact(Element element); | 108 ResolutionImpact getResolutionImpact(Element element); |
109 WorldImpact computeWorldImpact(Element element); | 109 WorldImpact computeWorldImpact(Element element); |
110 } | 110 } |
OLD | NEW |