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

Unified Diff: pkg/analyzer/lib/src/summary/resynthesize.dart

Issue 2986493002: Delay finishing dart:core and dart:async libraries until after TypeProvider is set for the context. (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/summary/package_bundle_reader.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/resynthesize.dart
diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
index ed58c09989bded3337471bb163355f991ef6af3f..35be255fa59e5fa9d693c23db73455c66d16837c 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -40,6 +40,16 @@ abstract class SummaryResynthesizer extends ElementResynthesizer {
final Map<String, Source> _sources = <String, Source>{};
/**
+ * The `dart:core` library for the context.
+ */
+ LibraryElementImpl _coreLibrary;
+
+ /**
+ * The `dart:async` library for the context.
+ */
+ LibraryElementImpl _asyncLibrary;
+
+ /**
* The [TypeProvider] used to obtain SDK types during resynthesis.
*/
TypeProvider _typeProvider;
@@ -89,6 +99,16 @@ abstract class SummaryResynthesizer extends ElementResynthesizer {
*/
TypeProvider get typeProvider => _typeProvider;
+ /**
+ * The client installed this resynthesizer into the context, and set its
+ * type provider, so it is not safe to access type provider to create
+ * additional types.
+ */
+ void finishCoreAsyncLibraries() {
+ _coreLibrary.createLoadLibraryFunction(_typeProvider);
+ _asyncLibrary.createLoadLibraryFunction(_typeProvider);
+ }
+
@override
Element getElement(ElementLocation location) {
List<String> components = location.components;
@@ -261,13 +281,11 @@ abstract class SummaryResynthesizer extends ElementResynthesizer {
bool hasLibrarySummary(String uri);
void _buildTypeProvider() {
- var coreLibrary = getLibraryElement('dart:core') as LibraryElementImpl;
- var asyncLibrary = getLibraryElement('dart:async') as LibraryElementImpl;
+ _coreLibrary = getLibraryElement('dart:core') as LibraryElementImpl;
+ _asyncLibrary = getLibraryElement('dart:async') as LibraryElementImpl;
SummaryTypeProvider summaryTypeProvider = new SummaryTypeProvider();
- summaryTypeProvider.initializeCore(coreLibrary);
- summaryTypeProvider.initializeAsync(asyncLibrary);
- coreLibrary.createLoadLibraryFunction(summaryTypeProvider);
- asyncLibrary.createLoadLibraryFunction(summaryTypeProvider);
+ summaryTypeProvider.initializeCore(_coreLibrary);
+ summaryTypeProvider.initializeAsync(_asyncLibrary);
_typeProvider = summaryTypeProvider;
}
« no previous file with comments | « pkg/analyzer/lib/src/summary/package_bundle_reader.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698