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

Unified Diff: pkg/compiler/lib/src/closure.dart

Issue 1881013002: Expand ResolvedAst to handle synthetic constructors. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments + fix test, cps and compilation units for injected members. 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/common/backend_api.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/closure.dart
diff --git a/pkg/compiler/lib/src/closure.dart b/pkg/compiler/lib/src/closure.dart
index 2d0ee9978392aaab089b9cd05f0a4bf5eb672b49..440e251dcc5acfe306f1451a333640397c205c34 100644
--- a/pkg/compiler/lib/src/closure.dart
+++ b/pkg/compiler/lib/src/closure.dart
@@ -30,9 +30,15 @@ class ClosureTask extends CompilerTask {
String get name => "Closure Simplifier";
- ClosureClassMap computeClosureToClassMapping(
- Element element, Node node, TreeElements elements) {
+ ClosureClassMap computeClosureToClassMapping(ResolvedAst resolvedAst) {
return measure(() {
+ Element element = resolvedAst.element;
+ if (resolvedAst.kind != ResolvedAstKind.PARSED) {
+ return new ClosureClassMap(null, null, null, new ThisLocal(element));
+ }
+ Node node = resolvedAst.node;
+ TreeElements elements = resolvedAst.elements;
+
ClosureClassMap cached = closureMappingCache[node];
if (cached != null) return cached;
@@ -44,6 +50,8 @@ class ClosureTask extends CompilerTask {
if (node is FunctionExpression) {
translator.translateFunction(element, node);
} else if (element.isSynthesized) {
+ reporter.internalError(
+ element, "Unexpected synthesized element: $element");
return new ClosureClassMap(null, null, null, new ThisLocal(element));
} else {
assert(element.isField);
@@ -123,7 +131,7 @@ class ClosureFieldElement extends ElementX
bool get hasResolvedAst => hasTreeElements;
ResolvedAst get resolvedAst {
- return new ResolvedAst(this, null, treeElements);
+ return new ParsedResolvedAst(this, null, treeElements);
}
Expression get initializer {
@@ -338,7 +346,7 @@ class SynthesizedCallMethodElementX extends BaseFunctionElementX
FunctionExpression parseNode(Parsing parsing) => node;
ResolvedAst get resolvedAst {
- return new ResolvedAst(this, node, treeElements);
+ return new ParsedResolvedAst(this, node, treeElements);
}
Element get analyzableElement => closureClass.methodElement.analyzableElement;
« no previous file with comments | « no previous file | pkg/compiler/lib/src/common/backend_api.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698