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

Unified Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 2388843002: Relaxes treatment of method type parameter in `as` expressions. (Closed)
Patch Set: Simplifies `o as T` check for `T` method type parameter. Created 4 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/ssa/builder.dart
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
index 1b3e19403be62a4e51ea57adb3180420d377d313..205660e6ccfa62eeea33be60d489f92404d507fe 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -1558,6 +1558,11 @@ class SsaBuilder extends ast.Visitor
assert(type != null);
type = localsHandler.substInContext(type);
HInstruction other = buildTypeConversion(original, type, kind);
+ // TODO(johnniwinther): This operation on `registry` may be inconsistent.
+ // If it is needed then it seems likely that similar invocations of
+ // `buildTypeConversion` in `SsaBuilder.visitAs` should also be followed by
+ // a similar operation on `registry`; otherwise, this one might not be
+ // needed.
registry?.registerTypeUse(new TypeUse.isCheck(type));
return other;
}
@@ -2462,15 +2467,13 @@ class SsaBuilder extends ast.Visitor
void visitAs(ast.Send node, ast.Node expression, DartType type, _) {
HInstruction expressionInstruction = visitAndPop(expression);
if (type.isMalformed) {
- String message;
if (type is MalformedType) {
ErroneousElement element = type.element;
- message = element.message;
+ generateTypeError(node, element.message);
} else {
assert(type is MethodTypeVariableType);
- message = "Method type variables are not reified.";
+ stack.add(expressionInstruction);
}
- generateTypeError(node, message);
} else {
HInstruction converted = buildTypeConversion(expressionInstruction,
localsHandler.substInContext(type), HTypeConversion.CAST_TYPE_CHECK);
« no previous file with comments | « pkg/compiler/lib/src/resolution/members.dart ('k') | tests/language/generic_methods_type_expression_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698