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

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

Issue 88153003: Add synthetic type variables to unnamed mixin applications. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 years 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 2e98925a21c83a16ceb5894176c248d04712195d..693ec5fb5011992483b59580362fd9d60b4fb58f 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
@@ -1770,11 +1770,10 @@ abstract class BaseClassElementX extends ElementX implements ClassElement {
bool get isUnnamedMixinApplication => false;
- // TODO(johnniwinther): Add [thisType] getter similar to [rawType].
- InterfaceType computeType(Compiler compiler) {
+ void computeThisAndRawType(Compiler compiler, Link<DartType> typeVariables) {
if (thisType == null) {
if (origin == null) {
- Link<DartType> parameters = computeTypeParameters(compiler);
+ Link<DartType> parameters = typeVariables;
thisType = new InterfaceType(this, parameters);
if (parameters.isEmpty) {
rawTypeCache = thisType;
@@ -1791,6 +1790,13 @@ abstract class BaseClassElementX extends ElementX implements ClassElement {
rawTypeCache = origin.rawType;
}
}
+ }
+
+ // TODO(johnniwinther): Add [thisType] getter similar to [rawType].
+ InterfaceType computeType(Compiler compiler) {
+ if (thisType == null) {
+ computeThisAndRawType(compiler, computeTypeParameters(compiler));
+ }
return thisType;
}
@@ -2296,7 +2302,11 @@ class MixinApplicationElementX extends BaseClassElementX
Link<DartType> computeTypeParameters(Compiler compiler) {
NamedMixinApplication named = node.asNamedMixinApplication();
- if (named == null) return const Link<DartType>();
+ if (named == null) {
+ throw new SpannableAssertionFailure(node,
+ "Type variables on unnamed mixin applications must be set on "
+ "creation.");
+ }
return TypeDeclarationElementX.createTypeVariables(
this, named.typeParameters);
}
@@ -2377,7 +2387,7 @@ class TypeVariableElementX extends ElementX implements TypeVariableElement {
TypeVariableType type;
DartType bound;
- TypeVariableElementX(name, Element enclosing, this.cachedNode,
+ TypeVariableElementX(String name, Element enclosing, this.cachedNode,
[this.type, this.bound])
: super(name, ElementKind.TYPE_VARIABLE, enclosing);

Powered by Google App Engine
This is Rietveld 408576698