Index: pkg/compiler/lib/src/resolution/signatures.dart |
diff --git a/pkg/compiler/lib/src/resolution/signatures.dart b/pkg/compiler/lib/src/resolution/signatures.dart |
index 04db4ebf27859e31ca1112242ba6f680f7a07c96..36ea970e008838fe9d2237f07eee05856c08998b 100644 |
--- a/pkg/compiler/lib/src/resolution/signatures.dart |
+++ b/pkg/compiler/lib/src/resolution/signatures.dart |
@@ -15,15 +15,14 @@ import '../elements/modelx.dart' |
FormalElementX, |
FunctionSignatureX, |
InitializingFormalElementX, |
- LocalParameterElementX, |
- TypeVariableElementX; |
+ LocalParameterElementX; |
import '../tree/tree.dart'; |
import '../universe/use.dart' show TypeUse; |
import '../util/util.dart' show Link, LinkBuilder; |
import 'members.dart' show ResolverVisitor; |
import 'registry.dart' show ResolutionRegistry; |
import 'resolution_common.dart' show MappingVisitor; |
-import 'scope.dart' show Scope, TypeVariablesScope; |
+import 'scope.dart' show Scope; |
/** |
* [SignatureResolver] resolves function signatures. |
@@ -41,13 +40,12 @@ class SignatureResolver extends MappingVisitor<FormalElementX> { |
VariableDefinitions currentDefinitions; |
SignatureResolver(Compiler compiler, FunctionTypedElement enclosingElement, |
- Scope scope, |
ResolutionRegistry registry, |
{this.defaultValuesError, this.createRealParameters}) |
- : this.scope = scope, |
- this.enclosingElement = enclosingElement, |
- this.resolver = new ResolverVisitor( |
- compiler, enclosingElement, registry, scope: scope), |
+ : this.enclosingElement = enclosingElement, |
+ this.scope = enclosingElement.buildScope(), |
+ this.resolver = |
+ new ResolverVisitor(compiler, enclosingElement, registry), |
super(compiler, registry); |
bool get defaultValuesAllowed => defaultValuesError == null; |
@@ -112,8 +110,6 @@ class SignatureResolver extends MappingVisitor<FormalElementX> { |
void computeFunctionType(FunctionExpression functionExpression) { |
FunctionSignature functionSignature = SignatureResolver.analyze( |
compiler, |
- scope, |
- functionExpression.typeVariables, |
functionExpression.parameters, |
functionExpression.returnType, |
element, |
@@ -291,8 +287,6 @@ class SignatureResolver extends MappingVisitor<FormalElementX> { |
*/ |
static FunctionSignature analyze( |
Compiler compiler, |
- Scope scope, |
- NodeList typeVariables, |
NodeList formalParameters, |
Node returnNode, |
FunctionTypedElement element, |
@@ -302,32 +296,8 @@ class SignatureResolver extends MappingVisitor<FormalElementX> { |
bool isFunctionExpression: false}) { |
DiagnosticReporter reporter = compiler.reporter; |
- List<DartType> createTypeVariables(NodeList typeVariableNodes) { |
- if (typeVariableNodes == null) return const <DartType>[]; |
- |
- // Create the types and elements corresponding to [typeVariableNodes]. |
- Link<Node> nodes = typeVariableNodes.nodes; |
- List<DartType> arguments = |
- new List.generate(nodes.slowLength(), (int index) { |
- TypeVariable node = nodes.head; |
- String variableName = node.name.source; |
- nodes = nodes.tail; |
- TypeVariableElementX variableElement = |
- new TypeVariableElementX(variableName, element, index, node); |
- // TODO(eernst): When type variables are implemented fully we will need |
- // to resolve the actual bounds; currently we just claim [dynamic]. |
- variableElement.boundCache = const DynamicType(); |
- TypeVariableType variableType = new TypeVariableType(variableElement); |
- variableElement.typeCache = variableType; |
- return variableType; |
- }, growable: false); |
- return arguments; |
- } |
- |
- List<DartType> typeVariableTypes = createTypeVariables(typeVariables); |
- scope = new FunctionSignatureBuildingScope(scope, typeVariableTypes); |
SignatureResolver visitor = new SignatureResolver( |
- compiler, element, scope, registry, |
+ compiler, element, registry, |
defaultValuesError: defaultValuesError, |
createRealParameters: createRealParameters); |
List<Element> parameters = const <Element>[]; |
@@ -441,7 +411,6 @@ class SignatureResolver extends MappingVisitor<FormalElementX> { |
namedParameters, |
namedParameterTypes); |
return new FunctionSignatureX( |
- typeVariables: typeVariableTypes, |
requiredParameters: parameters, |
optionalParameters: visitor.optionalParameters, |
requiredParameterCount: requiredParameterCount, |
@@ -468,15 +437,3 @@ class SignatureResolver extends MappingVisitor<FormalElementX> { |
return result; |
} |
} |
- |
-/// Used during `SignatureResolver.analyze` to provide access to the type |
-/// variables of the function signature itself when its signature is analyzed. |
-class FunctionSignatureBuildingScope extends TypeVariablesScope { |
- @override |
- final List<DartType> typeVariables; |
- |
- FunctionSignatureBuildingScope(Scope parent, this.typeVariables) |
- : super(parent); |
- |
- String toString() => 'FunctionSignatureBuildingScope($typeVariables)'; |
-} |