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

Unified Diff: pkg/compiler/lib/src/resolution/members.dart

Issue 1416253002: Remove requiredTypes (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/resolution/members.dart
diff --git a/pkg/compiler/lib/src/resolution/members.dart b/pkg/compiler/lib/src/resolution/members.dart
index 90f536553150628ae9a9f676416195b3666297a0..0832c434f3dd631013bfe75050185c8bb41a0b29 100644
--- a/pkg/compiler/lib/src/resolution/members.dart
+++ b/pkg/compiler/lib/src/resolution/members.dart
@@ -639,7 +639,6 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
enclosingElement = previousEnclosingElement;
registry.registerClosure(function);
- registry.registerInstantiatedClass(compiler.functionClass);
return const NoneResult();
}
@@ -3532,8 +3531,6 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
}
ConstantResult visitLiteralSymbol(LiteralSymbol node) {
- registry.registerInstantiatedClass(compiler.symbolClass);
- registry.registerStaticUse(compiler.symbolConstructor.declaration);
String name = node.slowNameString;
registry.registerConstSymbol(name);
if (!validateSymbol(node, name, reportError: false)) {
@@ -3650,15 +3647,17 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
// redirecting constructor.
ClassElement targetClass = redirectionTarget.enclosingClass;
InterfaceType type = registry.getType(node);
- FunctionType targetType = redirectionTarget.computeType(resolution)
- .subst(type.typeArguments, targetClass.typeVariables);
+ FunctionType targetConstructorType =
+ redirectionTarget.computeType(resolution)
+ .subst(type.typeArguments, targetClass.typeVariables);
FunctionType constructorType = constructor.computeType(resolution);
- bool isSubtype = compiler.types.isSubtype(targetType, constructorType);
+ bool isSubtype = compiler.types.isSubtype(
+ targetConstructorType, constructorType);
if (!isSubtype) {
reporter.reportWarningMessage(
node,
MessageKind.NOT_ASSIGNABLE,
- {'fromType': targetType, 'toType': constructorType});
+ {'fromType': targetConstructorType, 'toType': constructorType});
// TODO(johnniwinther): Handle this (potentially) erroneous case.
isValidAsConstant = false;
}
@@ -3681,8 +3680,9 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
registry.registerStaticUse(redirectionTarget);
// TODO(johnniwinther): Register the effective target type instead.
- registry.registerInstantiatedClass(
- redirectionTarget.enclosingClass.declaration);
+ registry.registerInstantiatedType(
+ redirectionTarget.enclosingClass.thisType
+ .subst(type.typeArguments, targetClass.typeVariables));
if (isSymbolConstructor) {
registry.registerSymbolConstructor();
}
@@ -3995,7 +3995,6 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
deferredIsMalformed: deferredIsMalformed);
if (inCheckContext) {
registry.registerCheckedModeCheck(type);
- registry.registerRequiredType(type, enclosingElement);
}
return type;
}
@@ -4039,7 +4038,6 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
listType,
isConstant: node.isConst,
isEmpty: node.elements.isEmpty);
- registry.registerRequiredType(listType, enclosingElement);
if (node.isConst) {
List<ConstantExpression> constantExpressions = <ConstantExpression>[];
inConstantContext(() {
@@ -4363,9 +4361,8 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
mapType,
isConstant: node.isConst,
isEmpty: node.entries.isEmpty);
- registry.registerRequiredType(mapType, enclosingElement);
- if (node.isConst) {
+ if (node.isConst) {
List<ConstantExpression> keyExpressions = <ConstantExpression>[];
List<ConstantExpression> valueExpressions = <ConstantExpression>[];
inConstantContext(() {
@@ -4659,26 +4656,29 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
}
Scope blockScope = new BlockScope(scope);
- doInCheckContext(() => visitIn(node.type, blockScope));
sigurdm 2015/10/22 09:18:03 doInCheckContext seems to be unused now.
Johnni Winther 2015/10/22 10:31:55 Good catch! Removed.
+ TypeResult exceptionTypeResult = visitIn(node.type, blockScope);
visitIn(node.formals, blockScope);
var oldInCatchBlock = inCatchBlock;
inCatchBlock = true;
visitIn(node.block, blockScope);
inCatchBlock = oldInCatchBlock;
- if (node.type != null && exceptionDefinition != null) {
- DartType exceptionType = registry.getType(node.type);
- Node exceptionVariable = exceptionDefinition.definitions.nodes.head;
- VariableElementX exceptionElement =
- registry.getDefinition(exceptionVariable);
- exceptionElement.variables.type = exceptionType;
+ if (exceptionTypeResult != null) {
+ DartType exceptionType = exceptionTypeResult.type;
+ if (exceptionDefinition != null) {
+ Node exceptionVariable = exceptionDefinition.definitions.nodes.head;
+ VariableElementX exceptionElement =
+ registry.getDefinition(exceptionVariable);
+ exceptionElement.variables.type = exceptionType;
+ }
+ registry.registerOnCatchType(exceptionType);
}
if (stackTraceDefinition != null) {
Node stackTraceVariable = stackTraceDefinition.definitions.nodes.head;
VariableElementX stackTraceElement =
registry.getDefinition(stackTraceVariable);
- registry.registerInstantiatedClass(compiler.stackTraceClass);
- stackTraceElement.variables.type = compiler.stackTraceClass.rawType;
+ InterfaceType stackTraceType = coreTypes.stackTraceType;
+ stackTraceElement.variables.type = stackTraceType;
}
return const NoneResult();
}

Powered by Google App Engine
This is Rietveld 408576698