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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 201613006: Introduces the new syntax for deferred loading (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Ambigous elements are not top-level. Created 6 years, 9 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: sdk/lib/_internal/compiler/implementation/ssa/builder.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
index b42ae6af9dff58125321df4620d161b83b7f5af6..989e881a3454f32539fc2fb44a2341c8abd4109a 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -2968,10 +2968,22 @@ class SsaBuilder extends ResolvedVisitor {
generateInstanceGetterWithCompiledReceiver(
send, elements.getSelector(send), receiver);
} else if (Elements.isStaticOrTopLevelFunction(element)) {
- // TODO(5346): Try to avoid the need for calling [declaration] before
- // creating an [HStatic].
- push(new HStatic(element.declaration, backend.nonNullType));
- // TODO(ahe): This should be registered in codegen.
+ if (element.isDeferredLoaderGetter()) {
floitsch 2014/03/19 21:04:51 Can't you handle this one like all the other forei
sigurdm 2014/03/20 12:26:33 Other foreigns are only handled as calls (not in a
+ FunctionElement deferredLoader = element;
+ Element loadFunction = compiler.loadLibraryFunction;
+ PrefixElement prefixElement = deferredLoader.enclosingElement;
+ String loadId =
+ compiler.deferredLoadTask.importDeferName[prefixElement.import];
+ var inputs = [graph.addConstantString(
+ new ast.DartString.literal(loadId), compiler)];
+ push(new HInvokeStatic(loadFunction, inputs, backend.nonNullType,
+ targetCanThrow: false));
+ } else {
+ // TODO(5346): Try to avoid the need for calling [declaration] before
+ // creating an [HStatic].
+ push(new HStatic(element.declaration, backend.nonNullType));
+ // TODO(ahe): This should be registered in codegen.
+ }
compiler.enqueuer.codegen.registerGetOfStaticFunction(
element.declaration);
} else if (Elements.isErroneousElement(element)) {

Powered by Google App Engine
This is Rietveld 408576698