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

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

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/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index cf7cea00349c5569d2789b1746cca2ee577d894f..748d93fe59c2d3fcedfe328cc8e59819243a2d4d 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -13263,24 +13263,14 @@ class MutationObserver native "*MutationObserver" {
///@docsEditable true
factory MutationObserver(MutationCallback callback) => MutationObserver._create(callback);
- @Creates('MutationObserver')
- @Creates('MutationRecord')
- static MutationObserver _create(MutationCallback callback) native '''
- var constructor =
- window.MutationObserver || window.WebKitMutationObserver ||
- window.MozMutationObserver;
- return new constructor(callback);
- ''';
-
- // 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);
+ static MutationObserver _create(MutationCallback callback) {
+ // Dummy statement to mark types as instantiated.
+ JS('MutationObserver|MutationRecord', '0');
+ return JS('MutationObserver',
+ 'new(window.MutationObserver||window.WebKitMutationObserver||'
+ 'window.MozMutationObserver)(#)',
+ convertDartClosureToJS(callback, 2));
+ }
/// @domName MutationObserver.disconnect; @docsEditable true
void disconnect() native;

Powered by Google App Engine
This is Rietveld 408576698