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

Unified Diff: sdk/lib/_internal/compiler/implementation/elements/modelx.dart

Issue 201613006: Introduces the new syntax for deferred loading (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/elements/modelx.dart
diff --git a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
index eb48b99e04a22800f2bd563b2ab8db66228b09dc..480f3f6bdf6b3222b3d859fd5a3d2c56a1d94ec2 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
@@ -76,6 +76,7 @@ abstract class ElementX implements Element {
return enclosingElement != null && enclosingElement.isClass();
}
bool isInstanceMember() => false;
+ bool isDeferredLoaderFunction() => false;
bool isFactoryConstructor() => modifiers.isFactory();
bool isGenerativeConstructor() =>
@@ -1027,6 +1028,10 @@ class PrefixElementX extends ElementX implements PrefixElement {
bool isDeferred = false;
+ // Only needed for deferred imports.
+ Import _import;
floitsch 2014/03/17 14:15:41 I don't really like this. Every prefix comes from
Johnni Winther 2014/03/18 12:29:14 Or rename to `deferredImport` ?
sigurdm 2014/03/19 12:46:30 Done.
+ Import get import => _import;
+
PrefixElementX(String prefix, Element enclosing, this.firstPosition)
: super(prefix, ElementKind.PREFIX, enclosing);
@@ -1042,8 +1047,9 @@ class PrefixElementX extends ElementX implements PrefixElement {
accept(ElementVisitor visitor) => visitor.visitPrefixElement(this);
- void markAsDeferred() {
+ void markAsDeferred(Import import) {
isDeferred = true;
+ _import = import;
}
}
@@ -1655,6 +1661,33 @@ class FunctionElementX extends ElementX with AnalyzableElement
accept(ElementVisitor visitor) => visitor.visitFunctionElement(this);
}
+class DeferredLoaderFunctionElementX extends FunctionElementX {
karlklose 2014/03/17 14:05:00 This element should have source code information.
sigurdm 2014/03/19 12:46:30 Done.
+ PrefixElement prefix;
+ DeferredLoaderFunctionElementX(prefix)
karlklose 2014/03/17 14:05:00 `prefix` -> `this.prefix`.
sigurdm 2014/03/19 12:46:30 Not fixed - we still need to pass on the prefix to
+ : prefix = prefix,
+ super("loadLibrary",
+ ElementKind.FUNCTION,
+ Modifiers.EMPTY,
+ prefix, true);
+
+ FunctionSignature computeSignature(Compiler compiler) {
+ if (functionSignature != null) return functionSignature;
+ compiler.withCurrentElement(this, () {
+ functionSignature = new FunctionSignatureX(const Link(),
+ const Link(), 0, 0, false, compiler.types.dynamicType);
+ });
+ return functionSignature;
+ }
+
+ bool isMember() => false;
+
+ bool get isSynthesized => true;
+
+ bool isForeign(Compiler compiler) => true;
+
+ bool isDeferredLoaderFunction() => true;
+}
+
class ConstructorBodyElementX extends FunctionElementX
implements ConstructorBodyElement {
FunctionElement constructor;

Powered by Google App Engine
This is Rietveld 408576698