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

Unified Diff: pkg/compiler/lib/src/closure.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/closure.dart
diff --git a/pkg/compiler/lib/src/closure.dart b/pkg/compiler/lib/src/closure.dart
index dfb5ba9fe143ff1650b200f540ce6396a1431a7c..0ba5b471abf44dcb1082b384590f469ddaa6fe56 100644
--- a/pkg/compiler/lib/src/closure.dart
+++ b/pkg/compiler/lib/src/closure.dart
@@ -55,10 +55,10 @@ class ClosureTask extends CompilerTask {
return new ClosureClassMap(null, null, null, new ThisLocal(element));
} else {
assert(element.isField);
- VariableElement field = element;
- if (field.initializer != null) {
+ Node initializer = resolvedAst.body;
+ if (initializer != null) {
// The lazy initializer of a static.
- translator.translateLazyInitializer(element, node, field.initializer);
+ translator.translateLazyInitializer(element, node, initializer);
} else {
assert(element.isInstanceMember);
closureMappingCache[node] =
@@ -320,11 +320,17 @@ class ThisLocal extends Local {
class SynthesizedCallMethodElementX extends BaseFunctionElementX
implements MethodElement {
final LocalFunctionElement expression;
+ final FunctionExpression node;
+ final TreeElements treeElements;
SynthesizedCallMethodElementX(
- String name, LocalFunctionElementX other, ClosureClassElement enclosing)
+ String name,
+ LocalFunctionElement other,
+ ClosureClassElement enclosing,
+ this.node,
+ this.treeElements)
: expression = other,
- super(name, other.kind, other.modifiers, enclosing) {
+ super(name, other.kind, Modifiers.EMPTY, enclosing) {
asyncMarker = other.asyncMarker;
functionSignature = other.functionSignature;
}
@@ -339,18 +345,16 @@ class SynthesizedCallMethodElementX extends BaseFunctionElementX
return closureClass.methodElement.memberContext;
}
- bool get hasNode => expression.hasNode;
-
- FunctionExpression get node => expression.node;
+ bool get hasNode => node != null;
FunctionExpression parseNode(ParsingContext parsing) => node;
+ Element get analyzableElement => closureClass.methodElement.analyzableElement;
+
ResolvedAst get resolvedAst {
return new ParsedResolvedAst(this, node, node.body, treeElements);
}
- Element get analyzableElement => closureClass.methodElement.analyzableElement;
-
accept(ElementVisitor visitor, arg) {
return visitor.visitMethodElement(this, arg);
}
@@ -1032,7 +1036,7 @@ class ClosureTranslator extends Visitor {
compiler.world
.registerClass(globalizedElement, isDirectlyInstantiated: true);
FunctionElement callElement = new SynthesizedCallMethodElementX(
- Identifiers.call, element, globalizedElement);
+ Identifiers.call, element, globalizedElement, node, elements);
backend.maybeMarkClosureAsNeededForReflection(
globalizedElement, callElement, element);
MemberElement enclosing = element.memberContext;
« no previous file with comments | « no previous file | pkg/compiler/lib/src/common/codegen.dart » ('j') | pkg/compiler/lib/src/resolution/enum_creator.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698