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

Unified Diff: pkg/compiler/lib/src/elements/modelx.dart

Issue 2125823002: Handle redirects to unresolved redirects (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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/elements/modelx.dart
diff --git a/pkg/compiler/lib/src/elements/modelx.dart b/pkg/compiler/lib/src/elements/modelx.dart
index bb331d96027f82fb2e26338ecc1b4130fdc95288..6b7d3765d1998a207a7c1c24242046c35407c289 100644
--- a/pkg/compiler/lib/src/elements/modelx.dart
+++ b/pkg/compiler/lib/src/elements/modelx.dart
@@ -398,8 +398,18 @@ class ErroneousConstructorElementX extends ErroneousElementX
}
@override
- set immediateRedirectionTarget(_) {
- throw new UnsupportedError("immediateRedirectionTarget=");
+ get _immediateRedirectionTarget {
+ throw new UnsupportedError("_immediateRedirectionTarget");
+ }
+
+ @override
+ set _immediateRedirectionTarget(_) {
+ throw new UnsupportedError("_immediateRedirectionTarget=");
+ }
+
+ @override
+ setImmediateRedirectionTarget(a, b) {
+ throw new UnsupportedError("setImmediateRedirectionTarget=");
Harry Terkelsen 2016/07/06 16:40:07 nit: remove the '='
Johnni Winther 2016/07/08 09:17:26 Done.
}
@override
@@ -428,8 +438,13 @@ class ErroneousConstructorElementX extends ErroneousElementX
}
@override
- set redirectionDeferredPrefix(_) {
- throw new UnsupportedError("redirectionDeferredPrefix=");
+ get _redirectionDeferredPrefix {
+ throw new UnsupportedError("_redirectionDeferredPrefix");
+ }
+
+ @override
+ set _redirectionDeferredPrefix(_) {
+ throw new UnsupportedError("_redirectionDeferredPrefix=");
}
}
@@ -2197,8 +2212,10 @@ abstract class ConstructorElementX extends FunctionElementX
String name, ElementKind kind, Modifiers modifiers, Element enclosing)
: super(name, kind, modifiers, enclosing);
- FunctionElement immediateRedirectionTarget;
- PrefixElement redirectionDeferredPrefix;
+ ConstructorElement _immediateRedirectionTarget;
+ PrefixElement _redirectionDeferredPrefix;
+
+ ConstructorElementX get patch => super.patch;
bool get isRedirectingFactory => immediateRedirectionTarget != null;
@@ -2211,45 +2228,93 @@ abstract class ConstructorElementX extends FunctionElementX
DartType _effectiveTargetType;
bool _isEffectiveTargetMalformed;
- bool get hasEffectiveTarget => effectiveTargetInternal != null;
+ bool get hasEffectiveTarget {
+ if (isPatched) {
+ return patch.hasEffectiveTarget;
+ }
+ return effectiveTargetInternal != null;
+ }
+
+ void setImmediateRedirectionTarget(
+ ConstructorElement target, PrefixElement prefix) {
+ if (isPatched) {
+ patch.setImmediateRedirectionTarget(target, prefix);
+ } else {
+ assert(invariant(this, _immediateRedirectionTarget == null,
+ message: "Immediate redirection target has already been "
+ "set on $this."));
+ _immediateRedirectionTarget = target;
+ _redirectionDeferredPrefix = prefix;
+ }
+ }
+
+ ConstructorElement get immediateRedirectionTarget {
+ if (isPatched) {
+ return patch.immediateRedirectionTarget;
+ }
+ return _immediateRedirectionTarget;
+ }
+
+ PrefixElement get redirectionDeferredPrefix {
+ if (isPatched) {
+ return patch.redirectionDeferredPrefix;
+ }
+ return _redirectionDeferredPrefix;
+ }
void setEffectiveTarget(ConstructorElement target, DartType type,
{bool isMalformed: false}) {
- assert(invariant(this, target != null,
- message: 'No effective target provided for $this.'));
- assert(invariant(this, effectiveTargetInternal == null,
- message: 'Effective target has already been computed for $this.'));
- effectiveTargetInternal = target;
- _effectiveTargetType = type;
- _isEffectiveTargetMalformed = isMalformed;
+ if (isPatched) {
+ patch.setEffectiveTarget(target, type, isMalformed: isMalformed);
+ } else {
+ assert(invariant(this, target != null,
+ message: 'No effective target provided for $this.'));
+ assert(invariant(this, effectiveTargetInternal == null,
+ message: 'Effective target has already been computed for $this.'));
+ assert(invariant(this, !target.isMalformed || isMalformed,
+ message: 'Effective target is not marked as malformed for $this: '
+ 'target=$target, type=$type, isMalformed: $isMalformed'));
+ assert(invariant(this, isMalformed || type.isInterfaceType,
+ message: 'Effective target type is not an interface type for $this: '
+ 'target=$target, type=$type, isMalformed: $isMalformed'));
+ effectiveTargetInternal = target;
+ _effectiveTargetType = type;
+ _isEffectiveTargetMalformed = isMalformed;
+ }
}
ConstructorElement get effectiveTarget {
- if (Elements.isMalformed(immediateRedirectionTarget)) {
- return immediateRedirectionTarget;
+ if (isPatched) {
+ return patch.effectiveTarget;
}
- assert(!isRedirectingFactory || effectiveTargetInternal != null);
if (isRedirectingFactory) {
+ assert(effectiveTargetInternal != null);
return effectiveTargetInternal;
}
- if (isPatched) {
- return effectiveTargetInternal ?? this;
- }
return this;
}
- InterfaceType get effectiveTargetType {
+ DartType get effectiveTargetType {
+ if (isPatched) {
+ return patch.effectiveTargetType;
+ }
assert(invariant(this, _effectiveTargetType != null,
message: 'Effective target type has not yet been computed for $this.'));
return _effectiveTargetType;
}
- InterfaceType computeEffectiveTargetType(InterfaceType newType) {
+ DartType computeEffectiveTargetType(InterfaceType newType) {
+ if (isPatched) {
Harry Terkelsen 2016/07/06 16:40:07 given how every method in this class has a differe
Johnni Winther 2016/07/08 09:17:25 Unfortunately we don't know if it is going to be p
+ return patch.computeEffectiveTargetType(newType);
+ }
if (!isRedirectingFactory) return newType;
return effectiveTargetType.substByContext(newType);
}
bool get isEffectiveTargetMalformed {
+ if (isPatched) {
+ return patch.isEffectiveTargetMalformed;
+ }
if (!isRedirectingFactory) return false;
assert(invariant(this, _isEffectiveTargetMalformed != null,
message: 'Malformedness has not yet been computed for $this.'));
« no previous file with comments | « no previous file | pkg/compiler/lib/src/resolution/members.dart » ('j') | pkg/compiler/lib/src/resolution/resolution.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698