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

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: Updated cf. comments. 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
« no previous file with comments | « pkg/compiler/lib/src/resolution/constructors.dart ('k') | pkg/compiler/lib/src/resolution/registry.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..188d35432db94eb5e49ac445c29798bc1b735a2b 100644
--- a/pkg/compiler/lib/src/resolution/members.dart
+++ b/pkg/compiler/lib/src/resolution/members.dart
@@ -228,14 +228,6 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
return element;
}
- doInCheckContext(action()) {
- bool wasInCheckContext = inCheckContext;
- inCheckContext = true;
- var result = action();
- inCheckContext = wasInCheckContext;
- return result;
- }
-
doInPromotionScope(Node node, action()) {
promotionScope = promotionScope.prepend(node);
var result = action();
@@ -639,7 +631,6 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
enclosingElement = previousEnclosingElement;
registry.registerClosure(function);
- registry.registerInstantiatedClass(compiler.functionClass);
return const NoneResult();
}
@@ -3532,8 +3523,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 +3639,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 +3672,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 +3987,6 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
deferredIsMalformed: deferredIsMalformed);
if (inCheckContext) {
registry.registerCheckedModeCheck(type);
- registry.registerRequiredType(type, enclosingElement);
}
return type;
}
@@ -4039,7 +4030,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 +4353,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 +4648,29 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
}
Scope blockScope = new BlockScope(scope);
- doInCheckContext(() => visitIn(node.type, blockScope));
+ 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();
}
« no previous file with comments | « pkg/compiler/lib/src/resolution/constructors.dart ('k') | pkg/compiler/lib/src/resolution/registry.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698