Index: pkg/compiler/lib/src/js_backend/backend.dart |
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart |
index 3c29d53801701a35b290d5757e094517f2039ae5..1c4df41cc3329ef7b377ff679a46f6fab1a8c5c2 100644 |
--- a/pkg/compiler/lib/src/js_backend/backend.dart |
+++ b/pkg/compiler/lib/src/js_backend/backend.dart |
@@ -511,6 +511,8 @@ class JavaScriptBackend extends Backend { |
final BackendHelpers helpers; |
final BackendImpacts impacts; |
+ final JSFrontendAccess frontend; |
+ |
JavaScriptBackend(Compiler compiler, |
{bool generateSourceMap: true, |
bool useStartupEmitter: false, |
@@ -529,6 +531,7 @@ class JavaScriptBackend extends Backend { |
: const JavaScriptSourceInformationStrategy(), |
helpers = new BackendHelpers(compiler), |
impacts = new BackendImpacts(compiler), |
+ frontend = new JSFrontendAccess(compiler), |
super(compiler) { |
emitter = new CodeEmitterTask( |
compiler, namer, generateSourceMap, useStartupEmitter); |
@@ -2475,6 +2478,32 @@ class JavaScriptBackend extends Backend { |
} |
} |
+class JSFrontendAccess implements Frontend { |
+ final Compiler compiler; |
+ |
+ JSFrontendAccess(this.compiler); |
+ |
+ Resolution get resolution => compiler.resolution; |
+ |
+ @override |
+ ResolutionImpact getResolutionImpact(Element element) { |
+ return resolution.getResolutionImpact(element); |
+ } |
+ |
+ @override |
+ ResolvedAst getResolvedAst(Element element) { |
+ if (element is SynthesizedCallMethodElementX) { |
+ return element.resolvedAst; |
+ } else if (element is ConstructorBodyElementX) { |
+ return element.resolvedAst; |
+ } else { |
+ assert(invariant(element, resolution.hasResolvedAst(element.declaration), |
+ message: 'No ResolvedAst for $element')); |
+ return resolution.getResolvedAst(element.declaration); |
+ } |
+ } |
+} |
+ |
/// Handling of special annotations for tests. |
class Annotations { |
static final Uri PACKAGE_EXPECT = |