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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart

Issue 1180973003: dart2js cps: Support function types in 'is' and 'as' operators. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update doc comment for TypeCast Created 5 years, 6 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/compiler.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
index 78b709b97a91f1efe842d2eaa4c1a1ac9d1760fb..c92471617d0b4cb2bf3e551e5baa3f1d08a71e5e 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
@@ -2333,9 +2333,10 @@ class JsIrBuilder extends IrBuilder {
}
ir.Primitive buildTypeExpression(DartType type) {
+ type = program.unaliasType(type);
if (type is TypeVariableType) {
return buildTypeVariableAccess(type);
- } else if (type is InterfaceType) {
+ } else if (type is InterfaceType || type is FunctionType) {
List<ir.Primitive> arguments = <ir.Primitive>[];
type.forEachTypeVariable((TypeVariableType variable) {
ir.Primitive value = buildTypeVariableAccess(variable);
@@ -2397,6 +2398,8 @@ class JsIrBuilder extends IrBuilder {
assert(isOpen);
assert(isTypeTest != null);
+ type = program.unaliasType(type);
+
if (type.isMalformed) {
FunctionElement helper = program.throwTypeErrorHelper;
ErroneousElement element = type.element;
@@ -2412,6 +2415,8 @@ class JsIrBuilder extends IrBuilder {
typeArguments = type.typeArguments.map(buildTypeExpression).toList();
} else if (type is TypeVariableType) {
typeArguments = <ir.Primitive>[buildTypeVariableAccess(type)];
+ } else if (type is FunctionType) {
+ typeArguments = <ir.Primitive>[buildTypeExpression(type)];
}
if (isTypeTest) {
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698