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

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

Issue 1932183003: Handle deserialized compilation of closures (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart
diff --git a/pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart b/pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart
index eb03860b64f1da8900cfd5baf660e12fb6769fba..1d10378a5be5cd09132f862ddcfea036c300d51c 100644
--- a/pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart
+++ b/pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart
@@ -110,9 +110,6 @@ class ResolvedAstSerializer extends Visitor {
Key.URI,
elements.analyzedElement.compilationUnit.script.resourceUri,
elements.analyzedElement.compilationUnit.script.resourceUri);
- if (resolvedAst.body != null) {
- objectEncoder.setInt(Key.BODY, nodeIndices[resolvedAst.body]);
- }
AstKind kind;
if (element.enclosingClass is EnumClassElement) {
if (element.name == 'index') {
@@ -148,6 +145,12 @@ class ResolvedAstSerializer extends Visitor {
}
objectEncoder.setEnum(Key.SUB_KIND, kind);
root.accept(indexComputer);
+ if (resolvedAst.body != null) {
+ int index = nodeIndices[resolvedAst.body];
+ assert(invariant(element, index != null,
+ message: "No index for body of $element: ${resolvedAst.body} ($nodeIndices)."));
Siggi Cherem (dart-lang) 2016/04/30 00:08:11 nit: 80
Johnni Winther 2016/04/30 09:23:55 Done.
+ objectEncoder.setInt(Key.BODY, index);
+ }
root.accept(this);
if (jumpTargetMap.isNotEmpty) {
ListEncoder list = objectEncoder.createList(Key.JUMP_TARGETS);
@@ -489,12 +492,15 @@ class ResolvedAstDeserializer {
AstIndexComputer indexComputer = new AstIndexComputer();
Map<Node, int> nodeIndices = indexComputer.nodeIndices;
List<Node> nodeList = indexComputer.nodeList;
+ root.accept(indexComputer);
Node body;
int bodyNodeIndex = objectDecoder.getInt(Key.BODY, isOptional: true);
if (bodyNodeIndex != null) {
+ assert(invariant(element, bodyNodeIndex < nodeList.length,
+ message: "Body node index ${bodyNodeIndex} out of range. "
+ "Node count: ${nodeList.length}"));
body = nodeList[bodyNodeIndex];
}
- root.accept(indexComputer);
List<JumpTarget> jumpTargets = <JumpTarget>[];
Map<JumpTarget, List<int>> jumpTargetLabels = <JumpTarget, List<int>>{};

Powered by Google App Engine
This is Rietveld 408576698