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

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

Issue 1970703002: Store ResolvedAst on AstElement (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
« no previous file with comments | « pkg/compiler/lib/src/serialization/modelz.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 de45dd1314fbcf58968e8e23346f6bb0bd3b70f2..9b4e0d363455a39055f85af7a9e6dcc905dc0e51 100644
--- a/pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart
+++ b/pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart
@@ -25,6 +25,7 @@ import 'keys.dart';
import 'modelz.dart';
import 'serialization.dart';
import 'serialization_util.dart';
+import 'modelz.dart';
/// Visitor that computes a node-index mapping.
class AstIndexComputer extends Visitor {
@@ -344,18 +345,18 @@ class ResolvedAstDeserializer {
ObjectDecoder objectDecoder,
ParsingContext parsing,
Token getBeginToken(Uri uri, int charOffset),
- DeserializerPlugin nativeDataDeserializer,
- Map<Element, ResolvedAst> resolvedAstMap) {
+ DeserializerPlugin nativeDataDeserializer) {
ResolvedAstKind kind =
objectDecoder.getEnum(Key.KIND, ResolvedAstKind.values);
switch (kind) {
case ResolvedAstKind.PARSED:
deserializeParsed(element, objectDecoder, parsing, getBeginToken,
- nativeDataDeserializer, resolvedAstMap);
+ nativeDataDeserializer);
break;
case ResolvedAstKind.DEFAULT_CONSTRUCTOR:
case ResolvedAstKind.FORWARDING_CONSTRUCTOR:
- resolvedAstMap[element] = new SynthesizedResolvedAst(element, kind);
+ (element as AstElementMixinZ).resolvedAst =
+ new SynthesizedResolvedAst(element, kind);
break;
}
}
@@ -364,12 +365,11 @@ class ResolvedAstDeserializer {
/// method, or field) and its nested closures. The [ResolvedAst]s are added
/// to [resolvedAstMap].
static void deserializeParsed(
- Element element,
+ AstElementMixinZ element,
ObjectDecoder objectDecoder,
ParsingContext parsing,
Token getBeginToken(Uri uri, int charOffset),
- DeserializerPlugin nativeDataDeserializer,
- Map<Element, ResolvedAst> resolvedAstMap) {
+ DeserializerPlugin nativeDataDeserializer) {
CompilationUnitElement compilationUnit = element.compilationUnit;
DiagnosticReporter reporter = parsing.reporter;
Uri uri = objectDecoder.getUri(Key.URI);
@@ -480,7 +480,7 @@ class ResolvedAstDeserializer {
builder.emptyStatement());
return constructorNode;
case AstKind.ENUM_CONSTANT:
- EnumConstantElement enumConstant = element;
+ EnumConstantElementZ enumConstant = element;
EnumClassElement enumClass = element.enclosingClass;
int index = enumConstant.index;
AstBuilder builder = new AstBuilder(element.sourcePosition.begin);
@@ -660,13 +660,11 @@ class ResolvedAstDeserializer {
elements.registerNativeData(node, nativeData);
}
}
- FunctionElement function =
+ LocalFunctionElementZ function =
objectDecoder.getElement(Key.FUNCTION, isOptional: true);
if (function != null) {
FunctionExpression functionExpression = node;
- assert(invariant(function, !resolvedAstMap.containsKey(function),
- message: "ResolvedAst has already been computed for $function."));
- resolvedAstMap[function] = new ParsedResolvedAst(function,
+ function.resolvedAst = new ParsedResolvedAst(function,
functionExpression, functionExpression.body, elements, uri);
}
// TODO(johnniwinther): Remove these when inference doesn't need `.node`
@@ -683,9 +681,7 @@ class ResolvedAstDeserializer {
}
}
}
- assert(invariant(element, !resolvedAstMap.containsKey(element),
- message: "ResolvedAst has already been computed for $element."));
- resolvedAstMap[element] =
+ element.resolvedAst =
new ParsedResolvedAst(element, root, body, elements, uri);
}
}
« no previous file with comments | « pkg/compiler/lib/src/serialization/modelz.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698