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

Unified Diff: pkg/compiler/lib/src/js_backend/codegen/codegen.dart

Issue 1110813005: cps-ir: Implement type tests for interface types without type arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 5 years, 8 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/js_backend/backend.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/glue.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/codegen/codegen.dart
diff --git a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
index dc9428fc7ba19c3e0e2a521a2e0e5e3b9013c589..95b1dee349aec14ff8733a8a83103ff0c9ad36e0 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
@@ -13,6 +13,9 @@ import '../../io/source_information.dart' show SourceInformation;
import '../../util/maplet.dart';
import '../../constants/values.dart';
import '../../dart2jslib.dart';
+import '../../dart_types.dart';
+
+part 'type_test_emitter.dart';
class CodegenBailout {
final tree_ir.Node node;
@@ -24,7 +27,8 @@ class CodegenBailout {
}
class CodeGenerator extends tree_ir.StatementVisitor
- with tree_ir.ExpressionVisitor<js.Expression> {
+ with tree_ir.ExpressionVisitor<js.Expression>,
+ TypeTestEmitter {
final CodegenRegistry registry;
final Glue glue;
@@ -381,8 +385,16 @@ class CodeGenerator extends tree_ir.StatementVisitor
@override
js.Expression visitTypeOperator(tree_ir.TypeOperator node) {
- return giveup(node);
- // TODO: implement visitTypeOperator
+ if (!node.isTypeTest) {
+ giveup(node, 'type casts not implemented.');
+ }
+ DartType type = node.type;
+ if (type is InterfaceType && type.typeArguments.isEmpty) {
+ glue.registerIsCheck(type, registry);
+ js.Expression value = visitExpression(node.receiver);
+ return emitSubtypeTest(node, value, type);
+ }
+ return giveup(node, 'type check unimplemented for $type.');
}
@override
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/glue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698