Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: pkg/compiler/lib/src/serialization/task.dart

Issue 1892093003: Support deserialized compilation of the empty program. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 48
49 /// Creates the [ResolutionWorkItem] for the deserialized [element]. 49 /// Creates the [ResolutionWorkItem] for the deserialized [element].
50 ResolutionWorkItem createResolutionWorkItem( 50 ResolutionWorkItem createResolutionWorkItem(
51 Element element, ItemCompilationContext context) { 51 Element element, ItemCompilationContext context) {
52 assert(deserializer != null); 52 assert(deserializer != null);
53 assert(isDeserialized(element)); 53 assert(isDeserialized(element));
54 return new DeserializedResolutionWorkItem( 54 return new DeserializedResolutionWorkItem(
55 element, context, deserializer.computeWorldImpact(element)); 55 element, context, deserializer.computeWorldImpact(element));
56 } 56 }
57
58 bool hasResolvedAst(Element element) {
59 return deserializer != null ? deserializer.hasResolvedAst(element) : false;
60 }
61
62 ResolvedAst getResolvedAst(Element element) {
63 return deserializer != null ? deserializer.getResolvedAst(element) : null;
64 }
57 } 65 }
58 66
59 /// A [ResolutionWorkItem] for a deserialized element. 67 /// A [ResolutionWorkItem] for a deserialized element.
60 /// 68 ///
61 /// This will not resolve the element but only compute the [WorldImpact]. 69 /// This will not resolve the element but only compute the [WorldImpact].
62 class DeserializedResolutionWorkItem implements ResolutionWorkItem { 70 class DeserializedResolutionWorkItem implements ResolutionWorkItem {
63 final Element element; 71 final Element element;
64 final ItemCompilationContext compilationContext; 72 final ItemCompilationContext compilationContext;
65 final WorldImpact worldImpact; 73 final WorldImpact worldImpact;
66 bool _isAnalyzed = false; 74 bool _isAnalyzed = false;
(...skipping 10 matching lines...) Expand all
77 world.registerProcessedElement(element); 85 world.registerProcessedElement(element);
78 return worldImpact; 86 return worldImpact;
79 } 87 }
80 } 88 }
81 89
82 /// The interface for a system that supports deserialization of libraries and 90 /// The interface for a system that supports deserialization of libraries and
83 /// elements. 91 /// elements.
84 abstract class DeserializerSystem { 92 abstract class DeserializerSystem {
85 Future<LibraryElement> readLibrary(Uri resolvedUri); 93 Future<LibraryElement> readLibrary(Uri resolvedUri);
86 bool isDeserialized(Element element); 94 bool isDeserialized(Element element);
95 bool hasResolvedAst(Element element);
87 ResolvedAst getResolvedAst(Element element); 96 ResolvedAst getResolvedAst(Element element);
88 ResolutionImpact getResolutionImpact(Element element); 97 ResolutionImpact getResolutionImpact(Element element);
89 WorldImpact computeWorldImpact(Element element); 98 WorldImpact computeWorldImpact(Element element);
90 } 99 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698