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

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

Issue 1942763002: Rebased and retested version of CL 1915123008. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « pkg/compiler/lib/src/elements/elements.dart ('k') | pkg/compiler/lib/src/parser/node_listener.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e6304dfeed30a800bb6e90cef3aba59000219829..9fe76f82af39cb9068bf1c2500d7ed3a97fa98e7 100644
--- a/pkg/compiler/lib/src/elements/modelx.dart
+++ b/pkg/compiler/lib/src/elements/modelx.dart
@@ -15,7 +15,11 @@ import '../diagnostics/messages.dart' show MessageTemplate;
import '../ordered_typeset.dart' show OrderedTypeSet;
import '../resolution/class_members.dart' show ClassMemberMixin;
import '../resolution/scope.dart'
- show ClassScope, LibraryScope, Scope, TypeDeclarationScope;
+ show
+ ClassScope,
+ LibraryScope,
+ Scope,
+ TypeDeclarationScope;
import '../resolution/resolution.dart' show AnalyzableElementX;
import '../resolution/tree_elements.dart' show TreeElements;
import '../resolution/typedefs.dart' show TypedefCyclicVisitor;
@@ -283,6 +287,9 @@ class ErroneousElementX extends ElementX implements ErroneousElement {
@override
bool get isFromEnvironmentConstructor => false;
+
+ @override
+ List<DartType> get typeVariables => unsupported();
}
/// A constructor that was synthesized to recover from a compile-time error.
@@ -1665,6 +1672,9 @@ class FormalElementX extends ElementX
final Identifier identifier;
DartType typeCache;
+ @override
+ List<DartType> get typeVariables => functionSignature.typeVariables;
+
/**
* Function signature for a variable with a function type. The signature is
* kept to provide full information about parameter names through the mirror
@@ -1894,6 +1904,7 @@ class AbstractFieldElementX extends ElementX implements AbstractFieldElement {
// TODO(karlklose): all these lists should have element type [FormalElement].
class FunctionSignatureX extends FunctionSignatureCommon
implements FunctionSignature {
+ final List<DartType> typeVariables;
final List<Element> requiredParameters;
final List<Element> optionalParameters;
final int requiredParameterCount;
@@ -1904,7 +1915,8 @@ class FunctionSignatureX extends FunctionSignatureCommon
final bool hasOptionalParameters;
FunctionSignatureX(
- {this.requiredParameters: const <Element>[],
+ {this.typeVariables: const <DartType>[],
+ this.requiredParameters: const <Element>[],
this.requiredParameterCount: 0,
List<Element> optionalParameters: const <Element>[],
this.optionalParameterCount: 0,
@@ -1985,6 +1997,9 @@ abstract class BaseFunctionElementX extends ElementX
FunctionElement asFunctionElement() => this;
+ @override
+ Scope buildScope() => new TypeDeclarationScope(super.buildScope(), this);
+
String toString() {
if (isPatch) {
return 'patch ${super.toString()}';
@@ -1999,6 +2014,9 @@ abstract class BaseFunctionElementX extends ElementX
// A function is defined by the implementation element.
AstElement get definingElement => implementation;
+
+ @override
+ List<DartType> get typeVariables => functionSignature.typeVariables;
}
abstract class FunctionElementX extends BaseFunctionElementX
@@ -2156,6 +2174,10 @@ abstract class ConstantConstructorMixin implements ConstructorElement {
enclosingClass.name == 'int' ||
enclosingClass.name == 'String');
}
+
+ /// Returns the empty list of type variables by default.
+ @override
+ List<DartType> get typeVariables => functionSignature.typeVariables;
}
abstract class ConstructorElementX extends FunctionElementX
@@ -3086,10 +3108,10 @@ class TypeVariableElementX extends ElementX
DartType boundCache;
TypeVariableElementX(
- String name, TypeDeclarationElement enclosing, this.index, this.node)
+ String name, GenericElement enclosing, this.index, this.node)
: super(name, ElementKind.TYPE_VARIABLE, enclosing);
- TypeDeclarationElement get typeDeclaration => enclosingElement;
+ GenericElement get typeDeclaration => enclosingElement;
TypeVariableType computeType(Resolution resolution) => type;
« no previous file with comments | « pkg/compiler/lib/src/elements/elements.dart ('k') | pkg/compiler/lib/src/parser/node_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698