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

Unified Diff: pkg/compiler/lib/src/serialization/system.dart

Issue 2013763002: Add names and support for preserialized data to serialization tests (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 7 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
Index: pkg/compiler/lib/src/serialization/system.dart
diff --git a/pkg/compiler/lib/src/serialization/system.dart b/pkg/compiler/lib/src/serialization/system.dart
index 02a716bdda787d67ca4bdf30929fefb93b50dd7f..8b54e98d5754d6af2c62bce641f9d0502aff6b15 100644
--- a/pkg/compiler/lib/src/serialization/system.dart
+++ b/pkg/compiler/lib/src/serialization/system.dart
@@ -71,8 +71,8 @@ class DeserializerSystemImpl extends DeserializerSystem {
.readScript(script.readableUri)
.then((Script newScript) {
script.file = newScript.file;
- _resolvedAstDeserializer.sourceFiles[script.resourceUri] =
- newScript.file;
+ script.isSynthesized = newScript.isSynthesized;
+ _resolvedAstDeserializer.scripts[script.resourceUri] = script;
});
}).then((_) => library);
}
@@ -200,7 +200,7 @@ class ResolvedAstSerializerPlugin extends SerializerPlugin {
class ResolvedAstDeserializerPlugin extends DeserializerPlugin {
final ParsingContext parsingContext;
final DeserializerPlugin nativeDataDeserializer;
- final Map<Uri, SourceFile> sourceFiles = <Uri, SourceFile>{};
+ final Map<Uri, Script> scripts = <Uri, Script>{};
Map<MemberElement, ObjectDecoder> _decoderMap =
<MemberElement, ObjectDecoder>{};
@@ -232,13 +232,15 @@ class ResolvedAstDeserializerPlugin extends DeserializerPlugin {
Token findToken(Uri uri, int offset) {
Token beginToken = beginTokenMap.putIfAbsent(uri, () {
- SourceFile sourceFile = sourceFiles[uri];
- if (sourceFile == null) {
- throw 'No source file found for $uri in:\n '
- '${sourceFiles.keys.join('\n ')}';
+ Script script = scripts[uri];
+ if (script == null) {
+ parsingContext.reporter.internalError(NO_LOCATION_SPANNABLE,
+ 'No source file found for $uri in:\n ${scripts.keys.join('\n ')}');
}
- return new Scanner(sourceFile).tokenize();
+ if (script.isSynthesized) return null;
+ return new Scanner(script.file).tokenize();
});
+ if (beginToken == null) return null;
return ResolvedAstDeserializer.findTokenInStream(beginToken, offset);
}

Powered by Google App Engine
This is Rietveld 408576698