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

Unified Diff: lib/src/codegen/js_codegen.dart

Issue 1010893004: Allow S->T <: dynamic->T (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Add comment Created 5 years, 9 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: lib/src/codegen/js_codegen.dart
diff --git a/lib/src/codegen/js_codegen.dart b/lib/src/codegen/js_codegen.dart
index c705287d6caa5c606de964b28dfa5bf4cd5f1b24..1c63fef439a6fadd7d1a6a3a45f3c5a03b0baa2e 100644
--- a/lib/src/codegen/js_codegen.dart
+++ b/lib/src/codegen/js_codegen.dart
@@ -179,6 +179,16 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
return _emitCast(node.expression, to);
}
+ // TODO(vsm): This should go away in the future. I'm passing in the type
+ // as a String for now to avoid breaking any existing code. In most cases,
+ // we currently throw for function types.
+ @override
+ visitClosureWrapBase(ClosureWrapBase node) {
+ var expression = _visit(node.expression);
+ var typeString = js.escapedString(node.convertedType.toString());
+ return js.call('dart.closureWrap(#, #)', [expression, typeString]);
+ }
+
@override
visitAsExpression(AsExpression node) =>
_emitCast(node.expression, node.type.type);

Powered by Google App Engine
This is Rietveld 408576698