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

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

Issue 1109403002: cps-ir: Support compilation of methods that use interceptor calling convention. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment. 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/cps_ir/cps_ir_nodes.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..a00a2aeabc4598584e41b0717994f4a9c3b601d0 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,18 @@ 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 glue.isNativePrimitiveType(type)
+ ? emitNativeSubtypeTest(node, value, type.element)
+ : emitGeneralSubtypeTest(node, value, type);
+ }
+ return giveup(node, 'type check unimplemented for $type.');
}
@override
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.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