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

Side by Side 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 7 years, 12 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 library html; 1 library html;
2 2
3 import 'dart:collection'; 3 import 'dart:collection';
4 import 'dart:html_common'; 4 import 'dart:html_common';
5 import 'dart:indexed_db'; 5 import 'dart:indexed_db';
6 import 'dart:isolate'; 6 import 'dart:isolate';
7 import 'dart:json'; 7 import 'dart:json';
8 import 'dart:svg' as svg; 8 import 'dart:svg' as svg;
9 import 'dart:web_audio' as web_audio; 9 import 'dart:web_audio' as web_audio;
10 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 10 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
(...skipping 13245 matching lines...) Expand 10 before | Expand all | Expand 10 after
13256 13256
13257 /// @domName MutationObserver 13257 /// @domName MutationObserver
13258 @SupportedBrowser(SupportedBrowser.CHROME) 13258 @SupportedBrowser(SupportedBrowser.CHROME)
13259 @SupportedBrowser(SupportedBrowser.FIREFOX) 13259 @SupportedBrowser(SupportedBrowser.FIREFOX)
13260 @SupportedBrowser(SupportedBrowser.SAFARI) 13260 @SupportedBrowser(SupportedBrowser.SAFARI)
13261 @Experimental() 13261 @Experimental()
13262 class MutationObserver native "*MutationObserver" { 13262 class MutationObserver native "*MutationObserver" {
13263 13263
13264 ///@docsEditable true 13264 ///@docsEditable true
13265 factory MutationObserver(MutationCallback callback) => MutationObserver._creat e(callback); 13265 factory MutationObserver(MutationCallback callback) => MutationObserver._creat e(callback);
13266 @Creates('MutationObserver') 13266 static MutationObserver _create(MutationCallback callback) {
13267 @Creates('MutationRecord') 13267 // Dummy statement to mark types as instantiated.
13268 static MutationObserver _create(MutationCallback callback) native ''' 13268 JS('MutationObserver|MutationRecord', '0');
13269 var constructor = 13269 return JS('MutationObserver',
13270 window.MutationObserver || window.WebKitMutationObserver || 13270 'new(window.MutationObserver||window.WebKitMutationObserver||'
13271 window.MozMutationObserver; 13271 'window.MozMutationObserver)(#)',
13272 return new constructor(callback); 13272 convertDartClosureToJS(callback, 2));
13273 '''; 13273 }
13274
13275 // TODO(sra): Dart2js inserts a conversion when a Dart function (i.e. an
13276 // object with a call method) is passed to a native method. This is so the
13277 // native code sees a JavaScript function.
13278 //
13279 // This does not happen when a function is 'passed' to a JS-form so it is not
13280 // possible to rewrite the above code to, e.g. (simplified):
13281 //
13282 // static createMutationObserver(MutationCallback callback) =>
13283 // JS('var', 'new (window.MutationObserver)(#)', callback);
13284 13274
13285 /// @domName MutationObserver.disconnect; @docsEditable true 13275 /// @domName MutationObserver.disconnect; @docsEditable true
13286 void disconnect() native; 13276 void disconnect() native;
13287 13277
13288 /// @domName MutationObserver._observe; @docsEditable true 13278 /// @domName MutationObserver._observe; @docsEditable true
13289 void _observe(Node target, Map options) { 13279 void _observe(Node target, Map options) {
13290 var options_1 = convertDartToNative_Dictionary(options); 13280 var options_1 = convertDartToNative_Dictionary(options);
13291 __observe_1(target, options_1); 13281 __observe_1(target, options_1);
13292 return; 13282 return;
13293 } 13283 }
(...skipping 12001 matching lines...) Expand 10 before | Expand all | Expand 10 after
25295 T next() { 25285 T next() {
25296 if (!hasNext) { 25286 if (!hasNext) {
25297 throw new StateError("No more elements"); 25287 throw new StateError("No more elements");
25298 } 25288 }
25299 return _array[_pos++]; 25289 return _array[_pos++];
25300 } 25290 }
25301 25291
25302 final List<T> _array; 25292 final List<T> _array;
25303 int _pos; 25293 int _pos;
25304 } 25294 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698