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

Unified Diff: sdk/lib/html/templates/html/dart2js/factoryprovider_MutationObserver.darttemplate

Issue 11611009: Forbid arguments to functions with 'native' bodies. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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: sdk/lib/html/templates/html/dart2js/factoryprovider_MutationObserver.darttemplate
diff --git a/sdk/lib/html/templates/html/dart2js/factoryprovider_MutationObserver.darttemplate b/sdk/lib/html/templates/html/dart2js/factoryprovider_MutationObserver.darttemplate
index 0ded40d4dd897f18ae72211ef053c9627e68b95f..88615a950637151d0b2e6b08d3785ea59e0f4eed 100644
--- a/sdk/lib/html/templates/html/dart2js/factoryprovider_MutationObserver.darttemplate
+++ b/sdk/lib/html/templates/html/dart2js/factoryprovider_MutationObserver.darttemplate
@@ -1,18 +1,9 @@
- @Creates('MutationObserver')
- @Creates('MutationRecord')
- static MutationObserver _create(MutationCallback callback) native '''
- var constructor =
- window.MutationObserver || window.WebKitMutationObserver ||
- window.MozMutationObserver;
- return new constructor(callback);
- ''';
+ static MutationObserver _create(MutationCallback callback) {
+ // Dummy statement to mark types as instantiated.
+ JS('MutationObserver|MutationRecord', '0');
- // TODO(sra): Dart2js inserts a conversion when a Dart function (i.e. an
- // object with a call method) is passed to a native method. This is so the
- // native code sees a JavaScript function.
- //
- // This does not happen when a function is 'passed' to a JS-form so it is not
- // possible to rewrite the above code to, e.g. (simplified):
- //
- // static createMutationObserver(MutationCallback callback) =>
- // JS('var', 'new (window.MutationObserver)(#)', callback);
+ return JS('MutationObserver',
+ 'new(window.MutationObserver||window.WebKitMutationObserver||'
+ 'window.MozMutationObserver)(#)',
+ convertDartClosureToJS(callback, 2));
+ }
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tests/compiler/dart2js_native/native_named_constructors2_frog_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698