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

Side by Side Diff: sdk/lib/js/dart2js/js_dart2js.dart

Issue 1318043005: Support user generated custom native JS classes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: ready for review Created 5 years, 3 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
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/interceptors.dart ('k') | tests/html/html.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Support for interoperating with JavaScript. 6 * Support for interoperating with JavaScript.
7 * 7 *
8 * This library provides access to JavaScript objects from Dart, allowing 8 * This library provides access to JavaScript objects from Dart, allowing
9 * Dart code to get and set properties, and call methods of JavaScript objects 9 * Dart code to get and set properties, and call methods of JavaScript objects
10 * and invoke JavaScript functions. The library takes care of converting 10 * and invoke JavaScript functions. The library takes care of converting
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 * 85 *
86 * var jsArray = new JsObject.jsify([1, 2, 3]); 86 * var jsArray = new JsObject.jsify([1, 2, 3]);
87 */ 87 */
88 library dart.js; 88 library dart.js;
89 89
90 import 'dart:html' show Blob, Event, ImageData, Node, Window; 90 import 'dart:html' show Blob, Event, ImageData, Node, Window;
91 import 'dart:collection' show HashMap, ListMixin; 91 import 'dart:collection' show HashMap, ListMixin;
92 import 'dart:indexed_db' show KeyRange; 92 import 'dart:indexed_db' show KeyRange;
93 import 'dart:typed_data' show TypedData; 93 import 'dart:typed_data' show TypedData;
94 94
95 import 'dart:_foreign_helper' show JS, DART_CLOSURE_TO_JS; 95 import 'dart:_foreign_helper' show JS, JS_CONST, DART_CLOSURE_TO_JS;
96 import 'dart:_interceptors' show JavaScriptObject, UnknownJavaScriptObject; 96 import 'dart:_interceptors'
97 import 'dart:_js_helper' show Primitives, convertDartClosureToJS, 97 show JavaScriptObject, UnknownJavaScriptObject, DART_CLOSURE_PROPERTY_NAME;
98 getIsolateAffinityTag; 98 import 'dart:_js_helper'
99 show Primitives, convertDartClosureToJS, getIsolateAffinityTag;
100
101 export 'dart:_interceptors' show Interceptor, JavaScriptObject, JSArray;
Jennifer Messerly 2015/09/02 22:29:12 now that these are public, how are they intended t
Jacob 2015/09/02 22:49:55 Having both Interceptor and JavaScriptObject be ex
99 102
100 final JsObject context = _wrapToDart(JS('', 'self')); 103 final JsObject context = _wrapToDart(JS('', 'self'));
101 104
102 _convertDartFunction(Function f, {bool captureThis: false}) { 105 _convertDartFunction(Function f, {bool captureThis: false}) {
103 return JS('', 106 return JS(
104 'function(_call, f, captureThis) {' 107 '',
108 'function(_call, f, captureThis) {'
105 'return function() {' 109 'return function() {'
Jennifer Messerly 2015/09/02 22:29:12 style suggestion: add spaces inside the string lit
Jacob 2015/09/02 22:49:55 what about just using """ so that you can have bot
Jennifer Messerly 2015/09/02 22:54:56 ''' would work for me too
106 'return _call(f, captureThis, this, ' 110 'return _call(f, captureThis, this, '
107 'Array.prototype.slice.apply(arguments));' 111 'Array.prototype.slice.apply(arguments));'
108 '}' 112 '}'
109 '}(#, #, #)', DART_CLOSURE_TO_JS(_callDartFunction), f, captureThis); 113 '}(#, #, #)',
114 DART_CLOSURE_TO_JS(_callDartFunction),
115 f,
116 captureThis);
110 } 117 }
111 118
112 _callDartFunction(callback, bool captureThis, self, List arguments) { 119 _callDartFunction(callback, bool captureThis, self, List arguments) {
113 if (captureThis) { 120 if (captureThis) {
114 arguments = [self]..addAll(arguments); 121 arguments = [self]..addAll(arguments);
115 } 122 }
116 var dartArgs = new List.from(arguments.map(_convertToDart)); 123 var dartArgs = new List.from(arguments.map(_convertToDart));
117 return _convertToJS(Function.apply(callback, dartArgs)); 124 return _convertToJS(Function.apply(callback, dartArgs));
118 } 125 }
119 126
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 * 212 *
206 * Use this constructor only if you wish to get access to JavaScript 213 * Use this constructor only if you wish to get access to JavaScript
207 * properties attached to a browser host object, such as a Node or Blob, that 214 * properties attached to a browser host object, such as a Node or Blob, that
208 * is normally automatically converted into a native Dart object. 215 * is normally automatically converted into a native Dart object.
209 * 216 *
210 * An exception will be thrown if [object] either is `null` or has the type 217 * An exception will be thrown if [object] either is `null` or has the type
211 * `bool`, `num`, or `String`. 218 * `bool`, `num`, or `String`.
212 */ 219 */
213 factory JsObject.fromBrowserObject(object) { 220 factory JsObject.fromBrowserObject(object) {
214 if (object is num || object is String || object is bool || object == null) { 221 if (object is num || object is String || object is bool || object == null) {
215 throw new ArgumentError( 222 throw new ArgumentError("object cannot be a num, string, bool, or null");
216 "object cannot be a num, string, bool, or null");
217 } 223 }
218 return _wrapToDart(_convertToJS(object)); 224 return _wrapToDart(_convertToJS(object));
219 } 225 }
220 226
221 /** 227 /**
222 * Recursively converts a JSON-like collection of Dart objects to a 228 * Recursively converts a JSON-like collection of Dart objects to a
223 * collection of JavaScript objects and returns a [JsObject] proxy to it. 229 * collection of JavaScript objects and returns a [JsObject] proxy to it.
224 * 230 *
225 * [object] must be a [Map] or [Iterable], the contents of which are also 231 * [object] must be a [Map] or [Iterable], the contents of which are also
226 * converted. Maps and Iterables are copied to a new JavaScript object. 232 * converted. Maps and Iterables are copied to a new JavaScript object.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 266
261 return _convert(data); 267 return _convert(data);
262 } 268 }
263 269
264 /** 270 /**
265 * Returns the value associated with [property] from the proxied JavaScript 271 * Returns the value associated with [property] from the proxied JavaScript
266 * object. 272 * object.
267 * 273 *
268 * The type of [property] must be either [String] or [num]. 274 * The type of [property] must be either [String] or [num].
269 */ 275 */
270 dynamic operator[](property) { 276 dynamic operator [](property) {
271 if (property is! String && property is! num) { 277 if (property is! String && property is! num) {
272 throw new ArgumentError("property is not a String or num"); 278 throw new ArgumentError("property is not a String or num");
273 } 279 }
274 return _convertToDart(JS('', '#[#]', _jsObject, property)); 280 return _convertToDart(JS('', '#[#]', _jsObject, property));
275 } 281 }
276 282
277 /** 283 /**
278 * Sets the value associated with [property] on the proxied JavaScript 284 * Sets the value associated with [property] on the proxied JavaScript
279 * object. 285 * object.
280 * 286 *
281 * The type of [property] must be either [String] or [num]. 287 * The type of [property] must be either [String] or [num].
282 */ 288 */
283 operator[]=(property, value) { 289 operator []=(property, value) {
284 if (property is! String && property is! num) { 290 if (property is! String && property is! num) {
285 throw new ArgumentError("property is not a String or num"); 291 throw new ArgumentError("property is not a String or num");
286 } 292 }
287 JS('', '#[#]=#', _jsObject, property, _convertToJS(value)); 293 JS('', '#[#]=#', _jsObject, property, _convertToJS(value));
288 } 294 }
289 295
290 int get hashCode => 0; 296 int get hashCode => 0;
291 297
292 bool operator==(other) => other is JsObject && 298 bool operator ==(other) =>
293 JS('bool', '# === #', _jsObject, other._jsObject); 299 other is JsObject && JS('bool', '# === #', _jsObject, other._jsObject);
294 300
295 /** 301 /**
296 * Returns `true` if the JavaScript object contains the specified property 302 * Returns `true` if the JavaScript object contains the specified property
297 * either directly or though its prototype chain. 303 * either directly or though its prototype chain.
298 * 304 *
299 * This is the equivalent of the `in` operator in JavaScript. 305 * This is the equivalent of the `in` operator in JavaScript.
300 */ 306 */
301 bool hasProperty(property) { 307 bool hasProperty(property) {
302 if (property is! String && property is! num) { 308 if (property is! String && property is! num) {
303 throw new ArgumentError("property is not a String or num"); 309 throw new ArgumentError("property is not a String or num");
(...skipping 21 matching lines...) Expand all
325 bool instanceof(JsFunction type) { 331 bool instanceof(JsFunction type) {
326 return JS('bool', '# instanceof #', _jsObject, _convertToJS(type)); 332 return JS('bool', '# instanceof #', _jsObject, _convertToJS(type));
327 } 333 }
328 334
329 /** 335 /**
330 * Returns the result of the JavaScript objects `toString` method. 336 * Returns the result of the JavaScript objects `toString` method.
331 */ 337 */
332 String toString() { 338 String toString() {
333 try { 339 try {
334 return JS('String', 'String(#)', _jsObject); 340 return JS('String', 'String(#)', _jsObject);
335 } catch(e) { 341 } catch (e) {
336 return super.toString(); 342 return super.toString();
337 } 343 }
338 } 344 }
339 345
340 /** 346 /**
341 * Calls [method] on the JavaScript object with the arguments [args] and 347 * Calls [method] on the JavaScript object with the arguments [args] and
342 * returns the result. 348 * returns the result.
343 * 349 *
344 * The type of [method] must be either [String] or [num]. 350 * The type of [method] must be either [String] or [num].
345 */ 351 */
346 dynamic callMethod(method, [List args]) { 352 dynamic callMethod(method, [List args]) {
347 if (method is! String && method is! num) { 353 if (method is! String && method is! num) {
348 throw new ArgumentError("method is not a String or num"); 354 throw new ArgumentError("method is not a String or num");
349 } 355 }
350 return _convertToDart(JS('', '#[#].apply(#, #)', _jsObject, method, 356 return _convertToDart(JS(
357 '',
358 '#[#].apply(#, #)',
359 _jsObject,
360 method,
351 _jsObject, 361 _jsObject,
352 args == null ? null : new List.from(args.map(_convertToJS)))); 362 args == null ? null : new List.from(args.map(_convertToJS))));
353 } 363 }
354 } 364 }
355 365
356 /** 366 /**
357 * Proxies a JavaScript Function object. 367 * Proxies a JavaScript Function object.
358 */ 368 */
359 class JsFunction extends JsObject { 369 class JsFunction extends JsObject {
360
361 /** 370 /**
362 * Returns a [JsFunction] that captures its 'this' binding and calls [f] 371 * Returns a [JsFunction] that captures its 'this' binding and calls [f]
363 * with the value of this passed as the first argument. 372 * with the value of this passed as the first argument.
364 */ 373 */
365 factory JsFunction.withThis(Function f) { 374 factory JsFunction.withThis(Function f) {
366 var jsFunc = _convertDartFunction(f, captureThis: true); 375 var jsFunc = _convertDartFunction(f, captureThis: true);
367 return new JsFunction._fromJs(jsFunc); 376 return new JsFunction._fromJs(jsFunc);
368 } 377 }
369 378
370 JsFunction._fromJs(jsObject) : super._fromJs(jsObject); 379 JsFunction._fromJs(jsObject) : super._fromJs(jsObject);
371 380
372 /** 381 /**
373 * Invokes the JavaScript function with arguments [args]. If [thisArg] is 382 * Invokes the JavaScript function with arguments [args]. If [thisArg] is
374 * supplied it is the value of `this` for the invocation. 383 * supplied it is the value of `this` for the invocation.
375 */ 384 */
376 dynamic apply(List args, { thisArg }) => 385 dynamic apply(List args, {thisArg}) => _convertToDart(JS(
377 _convertToDart(JS('', '#.apply(#, #)', _jsObject, 386 '',
378 _convertToJS(thisArg), 387 '#.apply(#, #)',
379 args == null ? null : new List.from(args.map(_convertToJS)))); 388 _jsObject,
389 _convertToJS(thisArg),
390 args == null ? null : new List.from(args.map(_convertToJS))));
380 } 391 }
381 392
382 /** 393 /**
383 * A [List] that proxies a JavaScript array. 394 * A [List] that proxies a JavaScript array.
384 */ 395 */
385 class JsArray<E> extends JsObject with ListMixin<E> { 396 class JsArray<E> extends JsObject with ListMixin<E> {
386
387 /** 397 /**
388 * Creates a new JavaScript array. 398 * Creates a new JavaScript array.
389 */ 399 */
390 JsArray() : super._fromJs([]); 400 JsArray() : super._fromJs([]);
391 401
392 /** 402 /**
393 * Creates a new JavaScript array and initializes it to the contents of 403 * Creates a new JavaScript array and initializes it to the contents of
394 * [other]. 404 * [other].
395 */ 405 */
396 JsArray.from(Iterable<E> other) 406 JsArray.from(Iterable<E> other)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 int get length { 452 int get length {
443 // Check the length honours the List contract. 453 // Check the length honours the List contract.
444 var len = JS('', '#.length', _jsObject); 454 var len = JS('', '#.length', _jsObject);
445 // JavaScript arrays have lengths which are unsigned 32-bit integers. 455 // JavaScript arrays have lengths which are unsigned 32-bit integers.
446 if (JS('bool', 'typeof # === "number" && (# >>> 0) === #', len, len, len)) { 456 if (JS('bool', 'typeof # === "number" && (# >>> 0) === #', len, len, len)) {
447 return JS('int', '#', len); 457 return JS('int', '#', len);
448 } 458 }
449 throw new StateError('Bad JsArray length'); 459 throw new StateError('Bad JsArray length');
450 } 460 }
451 461
452 void set length(int length) { super['length'] = length; } 462 void set length(int length) {
453 463 super['length'] = length;
464 }
454 465
455 // Methods overriden for better performance 466 // Methods overriden for better performance
456 467
457 void add(E value) { 468 void add(E value) {
458 callMethod('push', [value]); 469 callMethod('push', [value]);
459 } 470 }
460 471
461 void addAll(Iterable<E> iterable) { 472 void addAll(Iterable<E> iterable) {
462 var list = (JS('bool', '# instanceof Array', iterable)) 473 var list = (JS('bool', '# instanceof Array', iterable))
463 ? iterable 474 ? iterable
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 507
497 void sort([int compare(E a, E b)]) { 508 void sort([int compare(E a, E b)]) {
498 // Note: arr.sort(null) is a type error in FF 509 // Note: arr.sort(null) is a type error in FF
499 callMethod('sort', compare == null ? [] : [compare]); 510 callMethod('sort', compare == null ? [] : [compare]);
500 } 511 }
501 } 512 }
502 513
503 // property added to a Dart object referencing its JS-side DartObject proxy 514 // property added to a Dart object referencing its JS-side DartObject proxy
504 final String _DART_OBJECT_PROPERTY_NAME = 515 final String _DART_OBJECT_PROPERTY_NAME =
505 getIsolateAffinityTag(r'_$dart_dartObject'); 516 getIsolateAffinityTag(r'_$dart_dartObject');
506 final String _DART_CLOSURE_PROPERTY_NAME =
507 getIsolateAffinityTag(r'_$dart_dartClosure');
508 517
509 // property added to a JS object referencing its Dart-side JsObject proxy 518 // property added to a JS object referencing its Dart-side JsObject proxy
510 const _JS_OBJECT_PROPERTY_NAME = r'_$dart_jsObject'; 519 const _JS_OBJECT_PROPERTY_NAME = r'_$dart_jsObject';
511 const _JS_FUNCTION_PROPERTY_NAME = r'$dart_jsFunction'; 520 const _JS_FUNCTION_PROPERTY_NAME = r'$dart_jsFunction';
521 const _JS_FUNCTION_PROPERTY_NAME_CAPTURE_THIS = r'_$dart_jsFunctionCaptureThis';
512 522
513 bool _defineProperty(o, String name, value) { 523 bool _defineProperty(o, String name, value) {
514 if (_isExtensible(o) && 524 if (_isExtensible(o) &&
515 // TODO(ahe): Calling _hasOwnProperty to work around 525 // TODO(ahe): Calling _hasOwnProperty to work around
516 // https://code.google.com/p/dart/issues/detail?id=21331. 526 // https://code.google.com/p/dart/issues/detail?id=21331.
517 !_hasOwnProperty(o, name)) { 527 !_hasOwnProperty(o, name)) {
518 try { 528 try {
519 JS('void', 'Object.defineProperty(#, #, { value: #})', o, name, value); 529 JS('void', 'Object.defineProperty(#, #, { value: #})', o, name, value);
520 return true; 530 return true;
521 } catch (e) { 531 } catch (e) {
(...skipping 25 matching lines...) Expand all
547 dynamic _convertToJS(dynamic o) { 557 dynamic _convertToJS(dynamic o) {
548 // Note: we don't write `if (o == null) return null;` to make sure dart2js 558 // Note: we don't write `if (o == null) return null;` to make sure dart2js
549 // doesn't convert `return null;` into `return;` (which would make `null` be 559 // doesn't convert `return null;` into `return;` (which would make `null` be
550 // `undefined` in Javascprit). See dartbug.com/20305 for details. 560 // `undefined` in Javascprit). See dartbug.com/20305 for details.
551 if (o == null || o is String || o is num || o is bool) { 561 if (o == null || o is String || o is num || o is bool) {
552 return o; 562 return o;
553 } 563 }
554 if (o is JsObject) { 564 if (o is JsObject) {
555 return o._jsObject; 565 return o._jsObject;
556 } 566 }
557 if (o is Blob || o is Event || o is KeyRange || o is ImageData || o is Node || 567 if (o is Blob ||
558 o is TypedData || o is Window) { 568 o is Event ||
569 o is KeyRange ||
570 o is ImageData ||
571 o is Node ||
572 o is TypedData ||
573 o is Window) {
559 return o; 574 return o;
560 } 575 }
561 if (o is DateTime) { 576 if (o is DateTime) {
562 return Primitives.lazyAsJsDate(o); 577 return Primitives.lazyAsJsDate(o);
563 } 578 }
564 if (o is Function) { 579 if (o is Function) {
565 return _getJsProxy(o, _JS_FUNCTION_PROPERTY_NAME, (o) { 580 return _getJsProxy(o, _JS_FUNCTION_PROPERTY_NAME, (o) {
566 var jsFunction = _convertDartFunction(o); 581 var jsFunction = _convertDartFunction(o);
567 // set a property on the JS closure referencing the Dart closure 582 // set a property on the JS closure referencing the Dart closure
568 _defineProperty(jsFunction, _DART_CLOSURE_PROPERTY_NAME, o); 583 _defineProperty(jsFunction, DART_CLOSURE_PROPERTY_NAME, o);
569 return jsFunction; 584 return jsFunction;
570 }); 585 });
571 } 586 }
572 var ctor = _dartProxyCtor; 587 var ctor = _dartProxyCtor;
573 return _getJsProxy(o, _JS_OBJECT_PROPERTY_NAME, 588 return _getJsProxy(
574 (o) => JS('', 'new #(#)', ctor, o)); 589 o, _JS_OBJECT_PROPERTY_NAME, (o) => JS('', 'new #(#)', ctor, o));
575 } 590 }
576 591
577 Object _getJsProxy(o, String propertyName, createProxy(o)) { 592 Object _getJsProxy(o, String propertyName, createProxy(o)) {
578 var jsProxy = _getOwnProperty(o, propertyName); 593 var jsProxy = _getOwnProperty(o, propertyName);
579 if (jsProxy == null) { 594 if (jsProxy == null) {
580 jsProxy = createProxy(o); 595 jsProxy = createProxy(o);
581 _defineProperty(o, propertyName, jsProxy); 596 _defineProperty(o, propertyName, jsProxy);
582 } 597 }
583 return jsProxy; 598 return jsProxy;
584 } 599 }
585 600
586 // converts a Dart object to a reference to a native JS object 601 // converts a Dart object to a reference to a native JS object
587 // which might be a DartObject JS->Dart proxy 602 // which might be a DartObject JS->Dart proxy
588 Object _convertToDart(o) { 603 Object _convertToDart(o) {
589 if (JS('bool', '# == null', o) || 604 if (JS('bool', '# == null', o) ||
590 JS('bool', 'typeof # == "string"', o) || 605 JS('bool', 'typeof # == "string"', o) ||
591 JS('bool', 'typeof # == "number"', o) || 606 JS('bool', 'typeof # == "number"', o) ||
592 JS('bool', 'typeof # == "boolean"', o)) { 607 JS('bool', 'typeof # == "boolean"', o)) {
593 return o; 608 return o;
594 } else if (_isLocalObject(o) 609 } else if (_isLocalObject(o) &&
595 && (o is Blob || o is Event || o is KeyRange || o is ImageData 610 (o is Blob ||
596 || o is Node || o is TypedData || o is Window)) { 611 o is Event ||
612 o is KeyRange ||
613 o is ImageData ||
614 o is Node ||
615 o is TypedData ||
616 o is Window)) {
597 // long line: dart2js doesn't allow string concatenation in the JS() form 617 // long line: dart2js doesn't allow string concatenation in the JS() form
598 return JS('Blob|Event|KeyRange|ImageData|Node|TypedData|Window', '#', o); 618 return JS('Blob|Event|KeyRange|ImageData|Node|TypedData|Window', '#', o);
599 } else if (JS('bool', '# instanceof Date', o)) { 619 } else if (JS('bool', '# instanceof Date', o)) {
600 var ms = JS('num', '#.getTime()', o); 620 var ms = JS('num', '#.getTime()', o);
601 return new DateTime.fromMillisecondsSinceEpoch(ms); 621 return new DateTime.fromMillisecondsSinceEpoch(ms);
602 } else if (JS('bool', '#.constructor === #', o, _dartProxyCtor)) { 622 } else if (JS('bool', '#.constructor === #', o, _dartProxyCtor)) {
603 return JS('', '#.o', o); 623 return JS('', '#.o', o);
604 } else { 624 } else {
605 return _wrapToDart(o); 625 return _wrapToDart(o);
606 } 626 }
607 } 627 }
608 628
609 JsObject _wrapToDart(o) { 629 JsObject _wrapToDart(o) {
610 if (JS('bool', 'typeof # == "function"', o)) { 630 if (JS('bool', 'typeof # == "function"', o)) {
611 return _getDartProxy(o, _DART_CLOSURE_PROPERTY_NAME, 631 return _getDartProxy(
612 (o) => new JsFunction._fromJs(o)); 632 o, DART_CLOSURE_PROPERTY_NAME, (o) => new JsFunction._fromJs(o));
613 } 633 }
614 if (JS('bool', '# instanceof Array', o)) { 634 if (JS('bool', '# instanceof Array', o)) {
615 return _getDartProxy(o, _DART_OBJECT_PROPERTY_NAME, 635 return _getDartProxy(
616 (o) => new JsArray._fromJs(o)); 636 o, _DART_OBJECT_PROPERTY_NAME, (o) => new JsArray._fromJs(o));
617 } 637 }
618 return _getDartProxy(o, _DART_OBJECT_PROPERTY_NAME, 638 return _getDartProxy(
619 (o) => new JsObject._fromJs(o)); 639 o, _DART_OBJECT_PROPERTY_NAME, (o) => new JsObject._fromJs(o));
620 } 640 }
621 641
622 Object _getDartProxy(o, String propertyName, createProxy(o)) { 642 Object _getDartProxy(o, String propertyName, createProxy(o)) {
623 var dartProxy = _getOwnProperty(o, propertyName); 643 var dartProxy = _getOwnProperty(o, propertyName);
624 // Temporary fix for dartbug.com/15193 644 // Temporary fix for dartbug.com/15193
625 // In some cases it's possible to see a JavaScript object that 645 // In some cases it's possible to see a JavaScript object that
626 // came from a different context and was previously proxied to 646 // came from a different context and was previously proxied to
627 // Dart in that context. The JS object will have a cached proxy 647 // Dart in that context. The JS object will have a cached proxy
628 // but it won't be a valid Dart object in this context. 648 // but it won't be a valid Dart object in this context.
629 // For now we throw away the cached proxy, but we should be able 649 // For now we throw away the cached proxy, but we should be able
630 // to cache proxies from multiple JS contexts and Dart isolates. 650 // to cache proxies from multiple JS contexts and Dart isolates.
631 if (dartProxy == null || !_isLocalObject(o)) { 651 if (dartProxy == null || !_isLocalObject(o)) {
632 dartProxy = createProxy(o); 652 dartProxy = createProxy(o);
633 _defineProperty(o, propertyName, dartProxy); 653 _defineProperty(o, propertyName, dartProxy);
634 } 654 }
635 return dartProxy; 655 return dartProxy;
636 } 656 }
657
658 // Start of methods for new style Dart-JS interop.
659
660 class _JavaScriptFunctionHack implements Function {
661 call(
662 [a = JsNative.UNDEFINED,
663 b = JsNative.UNDEFINED,
664 c = JsNative.UNDEFINED,
665 d = JsNative.UNDEFINED,
666 e = JsNative.UNDEFINED,
667 f = JsNative.UNDEFINED,
668 g = JsNative.UNDEFINED,
669 h = JsNative.UNDEFINED,
670 i = JsNative.UNDEFINED,
671 j = JsNative.UNDEFINED]) {
672 // Exceedingly slow default implementation.
673 return JS('', '#.apply(null, #)', this,
674 _stripUndefinedArgs([a, b, c, d, e, f, g, h, i, j]));
675 }
676 }
677
678 void _copyOwnProperties(src, dest) {
679 JS(
680 '',
681 r"""(function(src, dest) {
682 var properties = Object.getOwnPropertyNames(src);
683 for (var i = 0, len = properties.length; i < len; i++) {
684 var name = properties[i];
685 dest[name] = src[name];
Jennifer Messerly 2015/09/02 22:29:12 fyi, this won't work with all props. you'd want Ob
Jacob 2015/09/02 22:49:55 yep. I only care about value properties. Got an id
686 }
687 })(#, #)""",
688 src,
689 dest);
690 }
691
692 // TODO(jacobr): remove this method. So far it appears that specifying the list
693 // of registered types in Dart2Js has significant negative code size
694 // implications so it is better to specify usage purely based on which
695 // libraries are imported. Remove after Dartium is modified to function without
696 // requiring this method.
697 void registerJsInterfaces([List<Type> types]) {
698 // No need to actually register in Dart2JS.
699 var fnHackProto = JS('', '#.__proto__', new _JavaScriptFunctionHack());
700 var fnProto = JS('', 'Function.prototype');
701 _copyOwnProperties(fnHackProto, fnProto);
702 // Add optimized call methods for small numbers of arguments.
703 if (JS('bool', r'#.hasOwnProperty("call$0") ', fnHackProto)) {
704 JS('', r'#.call$0 = function() { return this(); }', fnProto);
705 JS('', r'#.call$1 = function(a) { return this(a); }', fnProto);
706 JS('', r'#.call$2 = function(a, b) { return this(a, b); }', fnProto);
707 JS('', r'#.call$3 = function(a, b, c) { return this(a, b, c); }', fnProto);
708 JS('', r'#.call$4 = function(a, b, c, d) { return this(a, b, c, d); }',
709 fnProto);
710 } else {
711 if (!JS('bool', r'#.hasOwnProperty("$0") ', fnHackProto)) {
712 throw 'Internal error. Unexpected minified output';
713 }
714 JS('', r'#.$0 = function() { return this(); }', fnProto);
715 JS('', r'#.$1 = function(a) { return this(a); }', fnProto);
716 JS('', r'#.$2 = function(a, b) { return this(a, b); }', fnProto);
717 JS('', r'#.$3 = function(a, b, c) { return this(a, b, c); }', fnProto);
718 JS('', r'#.$4 = function(a, b, c, d) { return this(a, b, c, d); }',
719 fnProto);
720 }
721 }
722
723 _convertDartFunctionFast(Function f, {bool captureThis: false}) {
724 var existing = JsNative.getProperty(f, _JS_FUNCTION_PROPERTY_NAME);
725 if (existing != null) return existing;
726 var ret = JS(
727 '',
728 'function(_call, f) {'
729 'return function() {'
730 'return _call(f, Array.prototype.slice.apply(arguments));'
731 '}'
732 '}(#, #)',
733 DART_CLOSURE_TO_JS(_callDartFunctionFast),
734 f);
735 JsNative.setProperty(ret, DART_CLOSURE_PROPERTY_NAME, f);
736 JsNative.setProperty(f, _JS_FUNCTION_PROPERTY_NAME, ret);
737 return ret;
738 }
739
740 _convertDartFunctionFastCaptureThis(Function f) {
741 var existing =
742 JsNative.getProperty(f, _JS_FUNCTION_PROPERTY_NAME_CAPTURE_THIS);
743 if (existing != null) return existing;
744 var ret = JS(
745 '',
746 'function(_call, f) {'
747 'return function() {'
748 'return _call(f, this, '
749 'Array.prototype.slice.apply(arguments));'
750 '}'
751 '}(#, #)',
752 DART_CLOSURE_TO_JS(_callDartFunctionFastCaptureThis),
753 f);
754 JsNative.setProperty(ret, DART_CLOSURE_PROPERTY_NAME, f);
755 JsNative.setProperty(f, _JS_FUNCTION_PROPERTY_NAME_CAPTURE_THIS, ret);
756 return ret;
757 }
758
759 _callDartFunctionFast(callback, List arguments) {
760 return Function.apply(callback, arguments);
761 }
762
763 _callDartFunctionFastCaptureThis(callback, self, List arguments) {
764 return _convertToJS(Function.apply(callback, [self]..addAll(arguments)));
765 }
766
767 Function allowInterop(Function f) {
768 if (JS('bool', 'typeof(#) == "function"', f)) {
769 // Already supports interop, just use the existing function.
770 return f;
771 } else {
772 return _convertDartFunctionFast(f);
773 }
774 }
775
776 Function allowInteropCaptureThis(Function f) {
777 if (JS('bool', 'typeof(#) == "function"', f)) {
778 // Behavior when the function is already a JS function is unspecified.
779 throw new ArgumentError(
780 "Function is already a JS function so cannot capture this.");
781 return f;
782 } else {
783 return _convertDartFunctionFastCaptureThis(f);
784 }
785 }
786
787 /// Use this context object.
788 /// In a web browser it will be identical to dart:html window.
789 final nativeContext = JS('JavaScriptObject', 'self');
790
791 /// Zero overhead, unchecked, and verbose low level JavaScript interop API.
Jennifer Messerly 2015/09/02 22:29:12 should this say "not verbose" ?
Jacob 2015/09/02 22:49:55 this API is extremely verbose for the person using
792 /// This API should generally only be used by internal tools. It is easy to
793 /// write fragile code with this API that accidentally depends on Dart2Js
794 /// implementation details. Passing JsObject instances to this API has
795 /// unspecified behavior. You should use either the old JsObject interop APIs
796 /// or this API in your application not both.
797 class JsNative {
Siggi Cherem (dart-lang) 2015/09/18 20:34:10 I couldn't find this class in the latest patchset,
Jacob 2015/10/01 00:47:33 It is gone. JsNative isn't needed now that extern
798 // WARNING: behavior for UNDEFINED is undefined for the following cases:
Jennifer Messerly 2015/09/02 22:29:12 did you mean for this to be a doc comment?
Jacob 2015/09/02 22:49:55 Done.
799 // Only use this when immediately passing the value to JavaScript. Otherwise
800 // you will hit plenty of cases where behavior differs in Dart2Js and Dartium
801 // as it is impossible to fully model a second value that behaves like null
802 // in a pure Dart VM.
803 static const UNDEFINED = const JS_CONST('void 0');
804 static identical(a, b) => JS('bool', '#===#', a, b);
805
806 // Helpers for significantly more efficient JavaScript object literal creation that jsify.
Jennifer Messerly 2015/09/02 22:29:12 long line
Jacob 2015/09/02 22:49:55 Done.
807 static newLiteral() => JS('JavaScriptObject', '{}');
808 static newArray() => JS('JsArray', '[]');
809 static hasOwnProperty(object, name) =>
810 JS('', '#.hasOwnProperty(#)', object, name);
811 static hasProperty(object, name) => JS('', '# in #', object, name);
812 static getProperty(object, name) => JS('', '#[#]', object, name);
813 static setProperty(object, name, value) =>
814 JS('', '#[#] = #', object, name, value);
815
816 // Do not modify these definitions manually. They were generated by a script.
817 static newLiteral1(String n0, v0) => JS('JavaScriptObject', '{#:#}', n0, v0);
Jennifer Messerly 2015/09/02 22:29:12 are these intended for end users? how many do we n
Jacob 2015/09/02 22:49:55 These are for code generators. In dart2js they are
818 static newLiteral2(String n0, v0, String n1, v1) =>
819 JS('JavaScriptObject', '{#:#, #:#}', n0, v0, n1, v1);
820 static newLiteral3(String n0, v0, String n1, v1, String n2, v2) =>
821 JS('JavaScriptObject', '{#:#, #:#, #:#}', n0, v0, n1, v1, n2, v2);
822 static newLiteral4(
823 String n0, v0, String n1, v1, String n2, v2, String n3, v3) =>
824 JS('JavaScriptObject', '{#:#, #:#, #:#, #:#}', n0, v0, n1, v1, n2, v2, n3,
825 v3);
826 static newLiteral5(String n0, v0, String n1, v1, String n2, v2, String n3, v3,
827 String n4, v4) =>
828 JS('JavaScriptObject', '{#:#, #:#, #:#, #:#, #:#}', n0, v0, n1, v1, n2,
829 v2, n3, v3, n4, v4);
830 static newLiteral6(String n0, v0, String n1, v1, String n2, v2, String n3, v3,
831 String n4, v4, String n5, v5) =>
832 JS('JavaScriptObject', '{#:#, #:#, #:#, #:#, #:#, #:#}', n0, v0, n1, v1,
833 n2, v2, n3, v3, n4, v4, n5, v5);
834 static newLiteral7(String n0, v0, String n1, v1, String n2, v2, String n3, v3,
835 String n4, v4, String n5, v5, String n6, v6) =>
836 JS('JavaScriptObject', '{#:#, #:#, #:#, #:#, #:#, #:#, #:#}', n0, v0, n1,
837 v1, n2, v2, n3, v3, n4, v4, n5, v5, n6, v6);
838 static newLiteral8(String n0, v0, String n1, v1, String n2, v2, String n3, v3,
839 String n4, v4, String n5, v5, String n6, v6, String n7, v7) =>
840 JS('JavaScriptObject', '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}', n0, v0,
841 n1, v1, n2, v2, n3, v3, n4, v4, n5, v5, n6, v6, n7, v7);
842 static newLiteral9(
843 String n0,
844 v0,
845 String n1,
846 v1,
847 String n2,
848 v2,
849 String n3,
850 v3,
851 String n4,
852 v4,
853 String n5,
854 v5,
855 String n6,
856 v6,
857 String n7,
858 v7,
859 String n8,
860 v8) =>
861 JS(
862 'JavaScriptObject',
863 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
864 n0,
865 v0,
866 n1,
867 v1,
868 n2,
869 v2,
870 n3,
871 v3,
872 n4,
873 v4,
874 n5,
875 v5,
876 n6,
877 v6,
878 n7,
879 v7,
880 n8,
881 v8);
882 static newLiteral10(
883 String n0,
884 v0,
885 String n1,
886 v1,
887 String n2,
888 v2,
889 String n3,
890 v3,
891 String n4,
892 v4,
893 String n5,
894 v5,
895 String n6,
896 v6,
897 String n7,
898 v7,
899 String n8,
900 v8,
901 String n9,
902 v9) =>
903 JS(
904 'JavaScriptObject',
905 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
906 n0,
907 v0,
908 n1,
909 v1,
910 n2,
911 v2,
912 n3,
913 v3,
914 n4,
915 v4,
916 n5,
917 v5,
918 n6,
919 v6,
920 n7,
921 v7,
922 n8,
923 v8,
924 n9,
925 v9);
926 static newLiteral11(
927 String n0,
928 v0,
929 String n1,
930 v1,
931 String n2,
932 v2,
933 String n3,
934 v3,
935 String n4,
936 v4,
937 String n5,
938 v5,
939 String n6,
940 v6,
941 String n7,
942 v7,
943 String n8,
944 v8,
945 String n9,
946 v9,
947 String n10,
948 v10) =>
949 JS(
950 'JavaScriptObject',
951 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
952 n0,
953 v0,
954 n1,
955 v1,
956 n2,
957 v2,
958 n3,
959 v3,
960 n4,
961 v4,
962 n5,
963 v5,
964 n6,
965 v6,
966 n7,
967 v7,
968 n8,
969 v8,
970 n9,
971 v9,
972 n10,
973 v10);
974 static newLiteral12(
975 String n0,
976 v0,
977 String n1,
978 v1,
979 String n2,
980 v2,
981 String n3,
982 v3,
983 String n4,
984 v4,
985 String n5,
986 v5,
987 String n6,
988 v6,
989 String n7,
990 v7,
991 String n8,
992 v8,
993 String n9,
994 v9,
995 String n10,
996 v10,
997 String n11,
998 v11) =>
999 JS(
1000 'JavaScriptObject',
1001 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
1002 n0,
1003 v0,
1004 n1,
1005 v1,
1006 n2,
1007 v2,
1008 n3,
1009 v3,
1010 n4,
1011 v4,
1012 n5,
1013 v5,
1014 n6,
1015 v6,
1016 n7,
1017 v7,
1018 n8,
1019 v8,
1020 n9,
1021 v9,
1022 n10,
1023 v10,
1024 n11,
1025 v11);
1026 static newLiteral13(
1027 String n0,
1028 v0,
1029 String n1,
1030 v1,
1031 String n2,
1032 v2,
1033 String n3,
1034 v3,
1035 String n4,
1036 v4,
1037 String n5,
1038 v5,
1039 String n6,
1040 v6,
1041 String n7,
1042 v7,
1043 String n8,
1044 v8,
1045 String n9,
1046 v9,
1047 String n10,
1048 v10,
1049 String n11,
1050 v11,
1051 String n12,
1052 v12) =>
1053 JS(
1054 'JavaScriptObject',
1055 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
1056 n0,
1057 v0,
1058 n1,
1059 v1,
1060 n2,
1061 v2,
1062 n3,
1063 v3,
1064 n4,
1065 v4,
1066 n5,
1067 v5,
1068 n6,
1069 v6,
1070 n7,
1071 v7,
1072 n8,
1073 v8,
1074 n9,
1075 v9,
1076 n10,
1077 v10,
1078 n11,
1079 v11,
1080 n12,
1081 v12);
1082 static newLiteral14(
1083 String n0,
1084 v0,
1085 String n1,
1086 v1,
1087 String n2,
1088 v2,
1089 String n3,
1090 v3,
1091 String n4,
1092 v4,
1093 String n5,
1094 v5,
1095 String n6,
1096 v6,
1097 String n7,
1098 v7,
1099 String n8,
1100 v8,
1101 String n9,
1102 v9,
1103 String n10,
1104 v10,
1105 String n11,
1106 v11,
1107 String n12,
1108 v12,
1109 String n13,
1110 v13) =>
1111 JS(
1112 'JavaScriptObject',
1113 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# }',
Jennifer Messerly 2015/09/02 22:29:12 long line
Jacob 2015/09/02 22:49:55 I see your long line comment and I don't care in t
Jennifer Messerly 2015/09/02 22:54:56 I did, but it was wontfix'd https://github.com/dar
1114 n0,
1115 v0,
1116 n1,
1117 v1,
1118 n2,
1119 v2,
1120 n3,
1121 v3,
1122 n4,
1123 v4,
1124 n5,
1125 v5,
1126 n6,
1127 v6,
1128 n7,
1129 v7,
1130 n8,
1131 v8,
1132 n9,
1133 v9,
1134 n10,
1135 v10,
1136 n11,
1137 v11,
1138 n12,
1139 v12,
1140 n13,
1141 v13);
1142 static newLiteral15(
1143 String n0,
1144 v0,
1145 String n1,
1146 v1,
1147 String n2,
1148 v2,
1149 String n3,
1150 v3,
1151 String n4,
1152 v4,
1153 String n5,
1154 v5,
1155 String n6,
1156 v6,
1157 String n7,
1158 v7,
1159 String n8,
1160 v8,
1161 String n9,
1162 v9,
1163 String n10,
1164 v10,
1165 String n11,
1166 v11,
1167 String n12,
1168 v12,
1169 String n13,
1170 v13,
1171 String n14,
1172 v14) =>
1173 JS(
1174 'JavaScriptObject',
1175 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#}',
1176 n0,
1177 v0,
1178 n1,
1179 v1,
1180 n2,
1181 v2,
1182 n3,
1183 v3,
1184 n4,
1185 v4,
1186 n5,
1187 v5,
1188 n6,
1189 v6,
1190 n7,
1191 v7,
1192 n8,
1193 v8,
1194 n9,
1195 v9,
1196 n10,
1197 v10,
1198 n11,
1199 v11,
1200 n12,
1201 v12,
1202 n13,
1203 v13,
1204 n14,
1205 v14);
1206 static newLiteral16(
1207 String n0,
1208 v0,
1209 String n1,
1210 v1,
1211 String n2,
1212 v2,
1213 String n3,
1214 v3,
1215 String n4,
1216 v4,
1217 String n5,
1218 v5,
1219 String n6,
1220 v6,
1221 String n7,
1222 v7,
1223 String n8,
1224 v8,
1225 String n9,
1226 v9,
1227 String n10,
1228 v10,
1229 String n11,
1230 v11,
1231 String n12,
1232 v12,
1233 String n13,
1234 v13,
1235 String n14,
1236 v14,
1237 String n15,
1238 v15) =>
1239 JS(
1240 'JavaScriptObject',
1241 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#}',
1242 n0,
1243 v0,
1244 n1,
1245 v1,
1246 n2,
1247 v2,
1248 n3,
1249 v3,
1250 n4,
1251 v4,
1252 n5,
1253 v5,
1254 n6,
1255 v6,
1256 n7,
1257 v7,
1258 n8,
1259 v8,
1260 n9,
1261 v9,
1262 n10,
1263 v10,
1264 n11,
1265 v11,
1266 n12,
1267 v12,
1268 n13,
1269 v13,
1270 n14,
1271 v14,
1272 n15,
1273 v15);
1274 static newLiteral17(
1275 String n0,
1276 v0,
1277 String n1,
1278 v1,
1279 String n2,
1280 v2,
1281 String n3,
1282 v3,
1283 String n4,
1284 v4,
1285 String n5,
1286 v5,
1287 String n6,
1288 v6,
1289 String n7,
1290 v7,
1291 String n8,
1292 v8,
1293 String n9,
1294 v9,
1295 String n10,
1296 v10,
1297 String n11,
1298 v11,
1299 String n12,
1300 v12,
1301 String n13,
1302 v13,
1303 String n14,
1304 v14,
1305 String n15,
1306 v15,
1307 String n16,
1308 v16) =>
1309 JS(
1310 'JavaScriptObject',
1311 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#}',
1312 n0,
1313 v0,
1314 n1,
1315 v1,
1316 n2,
1317 v2,
1318 n3,
1319 v3,
1320 n4,
1321 v4,
1322 n5,
1323 v5,
1324 n6,
1325 v6,
1326 n7,
1327 v7,
1328 n8,
1329 v8,
1330 n9,
1331 v9,
1332 n10,
1333 v10,
1334 n11,
1335 v11,
1336 n12,
1337 v12,
1338 n13,
1339 v13,
1340 n14,
1341 v14,
1342 n15,
1343 v15,
1344 n16,
1345 v16);
1346 static newLiteral18(
1347 String n0,
1348 v0,
1349 String n1,
1350 v1,
1351 String n2,
1352 v2,
1353 String n3,
1354 v3,
1355 String n4,
1356 v4,
1357 String n5,
1358 v5,
1359 String n6,
1360 v6,
1361 String n7,
1362 v7,
1363 String n8,
1364 v8,
1365 String n9,
1366 v9,
1367 String n10,
1368 v10,
1369 String n11,
1370 v11,
1371 String n12,
1372 v12,
1373 String n13,
1374 v13,
1375 String n14,
1376 v14,
1377 String n15,
1378 v15,
1379 String n16,
1380 v16,
1381 String n17,
1382 v17) =>
1383 JS(
1384 'JavaScriptObject',
1385 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#}',
1386 n0,
1387 v0,
1388 n1,
1389 v1,
1390 n2,
1391 v2,
1392 n3,
1393 v3,
1394 n4,
1395 v4,
1396 n5,
1397 v5,
1398 n6,
1399 v6,
1400 n7,
1401 v7,
1402 n8,
1403 v8,
1404 n9,
1405 v9,
1406 n10,
1407 v10,
1408 n11,
1409 v11,
1410 n12,
1411 v12,
1412 n13,
1413 v13,
1414 n14,
1415 v14,
1416 n15,
1417 v15,
1418 n16,
1419 v16,
1420 n17,
1421 v17);
1422 static newLiteral19(
1423 String n0,
1424 v0,
1425 String n1,
1426 v1,
1427 String n2,
1428 v2,
1429 String n3,
1430 v3,
1431 String n4,
1432 v4,
1433 String n5,
1434 v5,
1435 String n6,
1436 v6,
1437 String n7,
1438 v7,
1439 String n8,
1440 v8,
1441 String n9,
1442 v9,
1443 String n10,
1444 v10,
1445 String n11,
1446 v11,
1447 String n12,
1448 v12,
1449 String n13,
1450 v13,
1451 String n14,
1452 v14,
1453 String n15,
1454 v15,
1455 String n16,
1456 v16,
1457 String n17,
1458 v17,
1459 String n18,
1460 v18) =>
1461 JS(
1462 'JavaScriptObject',
1463 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#}',
1464 n0,
1465 v0,
1466 n1,
1467 v1,
1468 n2,
1469 v2,
1470 n3,
1471 v3,
1472 n4,
1473 v4,
1474 n5,
1475 v5,
1476 n6,
1477 v6,
1478 n7,
1479 v7,
1480 n8,
1481 v8,
1482 n9,
1483 v9,
1484 n10,
1485 v10,
1486 n11,
1487 v11,
1488 n12,
1489 v12,
1490 n13,
1491 v13,
1492 n14,
1493 v14,
1494 n15,
1495 v15,
1496 n16,
1497 v16,
1498 n17,
1499 v17,
1500 n18,
1501 v18);
1502 static newLiteral20(
1503 String n0,
1504 v0,
1505 String n1,
1506 v1,
1507 String n2,
1508 v2,
1509 String n3,
1510 v3,
1511 String n4,
1512 v4,
1513 String n5,
1514 v5,
1515 String n6,
1516 v6,
1517 String n7,
1518 v7,
1519 String n8,
1520 v8,
1521 String n9,
1522 v9,
1523 String n10,
1524 v10,
1525 String n11,
1526 v11,
1527 String n12,
1528 v12,
1529 String n13,
1530 v13,
1531 String n14,
1532 v14,
1533 String n15,
1534 v15,
1535 String n16,
1536 v16,
1537 String n17,
1538 v17,
1539 String n18,
1540 v18,
1541 String n19,
1542 v19) =>
1543 JS(
1544 'JavaScriptObject',
1545 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#}',
1546 n0,
1547 v0,
1548 n1,
1549 v1,
1550 n2,
1551 v2,
1552 n3,
1553 v3,
1554 n4,
1555 v4,
1556 n5,
1557 v5,
1558 n6,
1559 v6,
1560 n7,
1561 v7,
1562 n8,
1563 v8,
1564 n9,
1565 v9,
1566 n10,
1567 v10,
1568 n11,
1569 v11,
1570 n12,
1571 v12,
1572 n13,
1573 v13,
1574 n14,
1575 v14,
1576 n15,
1577 v15,
1578 n16,
1579 v16,
1580 n17,
1581 v17,
1582 n18,
1583 v18,
1584 n19,
1585 v19);
1586 static newLiteral21(
1587 String n0,
1588 v0,
1589 String n1,
1590 v1,
1591 String n2,
1592 v2,
1593 String n3,
1594 v3,
1595 String n4,
1596 v4,
1597 String n5,
1598 v5,
1599 String n6,
1600 v6,
1601 String n7,
1602 v7,
1603 String n8,
1604 v8,
1605 String n9,
1606 v9,
1607 String n10,
1608 v10,
1609 String n11,
1610 v11,
1611 String n12,
1612 v12,
1613 String n13,
1614 v13,
1615 String n14,
1616 v14,
1617 String n15,
1618 v15,
1619 String n16,
1620 v16,
1621 String n17,
1622 v17,
1623 String n18,
1624 v18,
1625 String n19,
1626 v19,
1627 String n20,
1628 v20) =>
1629 JS(
1630 'JavaScriptObject',
1631 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
1632 n0,
1633 v0,
1634 n1,
1635 v1,
1636 n2,
1637 v2,
1638 n3,
1639 v3,
1640 n4,
1641 v4,
1642 n5,
1643 v5,
1644 n6,
1645 v6,
1646 n7,
1647 v7,
1648 n8,
1649 v8,
1650 n9,
1651 v9,
1652 n10,
1653 v10,
1654 n11,
1655 v11,
1656 n12,
1657 v12,
1658 n13,
1659 v13,
1660 n14,
1661 v14,
1662 n15,
1663 v15,
1664 n16,
1665 v16,
1666 n17,
1667 v17,
1668 n18,
1669 v18,
1670 n19,
1671 v19,
1672 n20,
1673 v20);
1674 static newLiteral22(
1675 String n0,
1676 v0,
1677 String n1,
1678 v1,
1679 String n2,
1680 v2,
1681 String n3,
1682 v3,
1683 String n4,
1684 v4,
1685 String n5,
1686 v5,
1687 String n6,
1688 v6,
1689 String n7,
1690 v7,
1691 String n8,
1692 v8,
1693 String n9,
1694 v9,
1695 String n10,
1696 v10,
1697 String n11,
1698 v11,
1699 String n12,
1700 v12,
1701 String n13,
1702 v13,
1703 String n14,
1704 v14,
1705 String n15,
1706 v15,
1707 String n16,
1708 v16,
1709 String n17,
1710 v17,
1711 String n18,
1712 v18,
1713 String n19,
1714 v19,
1715 String n20,
1716 v20,
1717 String n21,
1718 v21) =>
1719 JS(
1720 'JavaScriptObject',
1721 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
1722 n0,
1723 v0,
1724 n1,
1725 v1,
1726 n2,
1727 v2,
1728 n3,
1729 v3,
1730 n4,
1731 v4,
1732 n5,
1733 v5,
1734 n6,
1735 v6,
1736 n7,
1737 v7,
1738 n8,
1739 v8,
1740 n9,
1741 v9,
1742 n10,
1743 v10,
1744 n11,
1745 v11,
1746 n12,
1747 v12,
1748 n13,
1749 v13,
1750 n14,
1751 v14,
1752 n15,
1753 v15,
1754 n16,
1755 v16,
1756 n17,
1757 v17,
1758 n18,
1759 v18,
1760 n19,
1761 v19,
1762 n20,
1763 v20,
1764 n21,
1765 v21);
1766 static newLiteral23(
1767 String n0,
1768 v0,
1769 String n1,
1770 v1,
1771 String n2,
1772 v2,
1773 String n3,
1774 v3,
1775 String n4,
1776 v4,
1777 String n5,
1778 v5,
1779 String n6,
1780 v6,
1781 String n7,
1782 v7,
1783 String n8,
1784 v8,
1785 String n9,
1786 v9,
1787 String n10,
1788 v10,
1789 String n11,
1790 v11,
1791 String n12,
1792 v12,
1793 String n13,
1794 v13,
1795 String n14,
1796 v14,
1797 String n15,
1798 v15,
1799 String n16,
1800 v16,
1801 String n17,
1802 v17,
1803 String n18,
1804 v18,
1805 String n19,
1806 v19,
1807 String n20,
1808 v20,
1809 String n21,
1810 v21,
1811 String n22,
1812 v22) =>
1813 JS(
1814 'JavaScriptObject',
1815 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
1816 n0,
1817 v0,
1818 n1,
1819 v1,
1820 n2,
1821 v2,
1822 n3,
1823 v3,
1824 n4,
1825 v4,
1826 n5,
1827 v5,
1828 n6,
1829 v6,
1830 n7,
1831 v7,
1832 n8,
1833 v8,
1834 n9,
1835 v9,
1836 n10,
1837 v10,
1838 n11,
1839 v11,
1840 n12,
1841 v12,
1842 n13,
1843 v13,
1844 n14,
1845 v14,
1846 n15,
1847 v15,
1848 n16,
1849 v16,
1850 n17,
1851 v17,
1852 n18,
1853 v18,
1854 n19,
1855 v19,
1856 n20,
1857 v20,
1858 n21,
1859 v21,
1860 n22,
1861 v22);
1862 static newLiteral24(
1863 String n0,
1864 v0,
1865 String n1,
1866 v1,
1867 String n2,
1868 v2,
1869 String n3,
1870 v3,
1871 String n4,
1872 v4,
1873 String n5,
1874 v5,
1875 String n6,
1876 v6,
1877 String n7,
1878 v7,
1879 String n8,
1880 v8,
1881 String n9,
1882 v9,
1883 String n10,
1884 v10,
1885 String n11,
1886 v11,
1887 String n12,
1888 v12,
1889 String n13,
1890 v13,
1891 String n14,
1892 v14,
1893 String n15,
1894 v15,
1895 String n16,
1896 v16,
1897 String n17,
1898 v17,
1899 String n18,
1900 v18,
1901 String n19,
1902 v19,
1903 String n20,
1904 v20,
1905 String n21,
1906 v21,
1907 String n22,
1908 v22,
1909 String n23,
1910 v23) =>
1911 JS(
1912 'JavaScriptObject',
1913 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
1914 n0,
1915 v0,
1916 n1,
1917 v1,
1918 n2,
1919 v2,
1920 n3,
1921 v3,
1922 n4,
1923 v4,
1924 n5,
1925 v5,
1926 n6,
1927 v6,
1928 n7,
1929 v7,
1930 n8,
1931 v8,
1932 n9,
1933 v9,
1934 n10,
1935 v10,
1936 n11,
1937 v11,
1938 n12,
1939 v12,
1940 n13,
1941 v13,
1942 n14,
1943 v14,
1944 n15,
1945 v15,
1946 n16,
1947 v16,
1948 n17,
1949 v17,
1950 n18,
1951 v18,
1952 n19,
1953 v19,
1954 n20,
1955 v20,
1956 n21,
1957 v21,
1958 n22,
1959 v22,
1960 n23,
1961 v23);
1962 static newLiteral25(
1963 String n0,
1964 v0,
1965 String n1,
1966 v1,
1967 String n2,
1968 v2,
1969 String n3,
1970 v3,
1971 String n4,
1972 v4,
1973 String n5,
1974 v5,
1975 String n6,
1976 v6,
1977 String n7,
1978 v7,
1979 String n8,
1980 v8,
1981 String n9,
1982 v9,
1983 String n10,
1984 v10,
1985 String n11,
1986 v11,
1987 String n12,
1988 v12,
1989 String n13,
1990 v13,
1991 String n14,
1992 v14,
1993 String n15,
1994 v15,
1995 String n16,
1996 v16,
1997 String n17,
1998 v17,
1999 String n18,
2000 v18,
2001 String n19,
2002 v19,
2003 String n20,
2004 v20,
2005 String n21,
2006 v21,
2007 String n22,
2008 v22,
2009 String n23,
2010 v23,
2011 String n24,
2012 v24) =>
2013 JS(
2014 'JavaScriptObject',
2015 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
2016 n0,
2017 v0,
2018 n1,
2019 v1,
2020 n2,
2021 v2,
2022 n3,
2023 v3,
2024 n4,
2025 v4,
2026 n5,
2027 v5,
2028 n6,
2029 v6,
2030 n7,
2031 v7,
2032 n8,
2033 v8,
2034 n9,
2035 v9,
2036 n10,
2037 v10,
2038 n11,
2039 v11,
2040 n12,
2041 v12,
2042 n13,
2043 v13,
2044 n14,
2045 v14,
2046 n15,
2047 v15,
2048 n16,
2049 v16,
2050 n17,
2051 v17,
2052 n18,
2053 v18,
2054 n19,
2055 v19,
2056 n20,
2057 v20,
2058 n21,
2059 v21,
2060 n22,
2061 v22,
2062 n23,
2063 v23,
2064 n24,
2065 v24);
2066 static newLiteral26(
2067 String n0,
2068 v0,
2069 String n1,
2070 v1,
2071 String n2,
2072 v2,
2073 String n3,
2074 v3,
2075 String n4,
2076 v4,
2077 String n5,
2078 v5,
2079 String n6,
2080 v6,
2081 String n7,
2082 v7,
2083 String n8,
2084 v8,
2085 String n9,
2086 v9,
2087 String n10,
2088 v10,
2089 String n11,
2090 v11,
2091 String n12,
2092 v12,
2093 String n13,
2094 v13,
2095 String n14,
2096 v14,
2097 String n15,
2098 v15,
2099 String n16,
2100 v16,
2101 String n17,
2102 v17,
2103 String n18,
2104 v18,
2105 String n19,
2106 v19,
2107 String n20,
2108 v20,
2109 String n21,
2110 v21,
2111 String n22,
2112 v22,
2113 String n23,
2114 v23,
2115 String n24,
2116 v24,
2117 String n25,
2118 v25) =>
2119 JS(
2120 'JavaScriptObject',
2121 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
2122 n0,
2123 v0,
2124 n1,
2125 v1,
2126 n2,
2127 v2,
2128 n3,
2129 v3,
2130 n4,
2131 v4,
2132 n5,
2133 v5,
2134 n6,
2135 v6,
2136 n7,
2137 v7,
2138 n8,
2139 v8,
2140 n9,
2141 v9,
2142 n10,
2143 v10,
2144 n11,
2145 v11,
2146 n12,
2147 v12,
2148 n13,
2149 v13,
2150 n14,
2151 v14,
2152 n15,
2153 v15,
2154 n16,
2155 v16,
2156 n17,
2157 v17,
2158 n18,
2159 v18,
2160 n19,
2161 v19,
2162 n20,
2163 v20,
2164 n21,
2165 v21,
2166 n22,
2167 v22,
2168 n23,
2169 v23,
2170 n24,
2171 v24,
2172 n25,
2173 v25);
2174 static newLiteral27(
2175 String n0,
2176 v0,
2177 String n1,
2178 v1,
2179 String n2,
2180 v2,
2181 String n3,
2182 v3,
2183 String n4,
2184 v4,
2185 String n5,
2186 v5,
2187 String n6,
2188 v6,
2189 String n7,
2190 v7,
2191 String n8,
2192 v8,
2193 String n9,
2194 v9,
2195 String n10,
2196 v10,
2197 String n11,
2198 v11,
2199 String n12,
2200 v12,
2201 String n13,
2202 v13,
2203 String n14,
2204 v14,
2205 String n15,
2206 v15,
2207 String n16,
2208 v16,
2209 String n17,
2210 v17,
2211 String n18,
2212 v18,
2213 String n19,
2214 v19,
2215 String n20,
2216 v20,
2217 String n21,
2218 v21,
2219 String n22,
2220 v22,
2221 String n23,
2222 v23,
2223 String n24,
2224 v24,
2225 String n25,
2226 v25,
2227 String n26,
2228 v26) =>
2229 JS(
2230 'JavaScriptObject',
2231 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
2232 n0,
2233 v0,
2234 n1,
2235 v1,
2236 n2,
2237 v2,
2238 n3,
2239 v3,
2240 n4,
2241 v4,
2242 n5,
2243 v5,
2244 n6,
2245 v6,
2246 n7,
2247 v7,
2248 n8,
2249 v8,
2250 n9,
2251 v9,
2252 n10,
2253 v10,
2254 n11,
2255 v11,
2256 n12,
2257 v12,
2258 n13,
2259 v13,
2260 n14,
2261 v14,
2262 n15,
2263 v15,
2264 n16,
2265 v16,
2266 n17,
2267 v17,
2268 n18,
2269 v18,
2270 n19,
2271 v19,
2272 n20,
2273 v20,
2274 n21,
2275 v21,
2276 n22,
2277 v22,
2278 n23,
2279 v23,
2280 n24,
2281 v24,
2282 n25,
2283 v25,
2284 n26,
2285 v26);
2286 static newLiteral28(
2287 String n0,
2288 v0,
2289 String n1,
2290 v1,
2291 String n2,
2292 v2,
2293 String n3,
2294 v3,
2295 String n4,
2296 v4,
2297 String n5,
2298 v5,
2299 String n6,
2300 v6,
2301 String n7,
2302 v7,
2303 String n8,
2304 v8,
2305 String n9,
2306 v9,
2307 String n10,
2308 v10,
2309 String n11,
2310 v11,
2311 String n12,
2312 v12,
2313 String n13,
2314 v13,
2315 String n14,
2316 v14,
2317 String n15,
2318 v15,
2319 String n16,
2320 v16,
2321 String n17,
2322 v17,
2323 String n18,
2324 v18,
2325 String n19,
2326 v19,
2327 String n20,
2328 v20,
2329 String n21,
2330 v21,
2331 String n22,
2332 v22,
2333 String n23,
2334 v23,
2335 String n24,
2336 v24,
2337 String n25,
2338 v25,
2339 String n26,
2340 v26,
2341 String n27,
2342 v27) =>
2343 JS(
2344 'JavaScriptObject',
2345 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
2346 n0,
2347 v0,
2348 n1,
2349 v1,
2350 n2,
2351 v2,
2352 n3,
2353 v3,
2354 n4,
2355 v4,
2356 n5,
2357 v5,
2358 n6,
2359 v6,
2360 n7,
2361 v7,
2362 n8,
2363 v8,
2364 n9,
2365 v9,
2366 n10,
2367 v10,
2368 n11,
2369 v11,
2370 n12,
2371 v12,
2372 n13,
2373 v13,
2374 n14,
2375 v14,
2376 n15,
2377 v15,
2378 n16,
2379 v16,
2380 n17,
2381 v17,
2382 n18,
2383 v18,
2384 n19,
2385 v19,
2386 n20,
2387 v20,
2388 n21,
2389 v21,
2390 n22,
2391 v22,
2392 n23,
2393 v23,
2394 n24,
2395 v24,
2396 n25,
2397 v25,
2398 n26,
2399 v26,
2400 n27,
2401 v27);
2402 static newLiteral29(
2403 String n0,
2404 v0,
2405 String n1,
2406 v1,
2407 String n2,
2408 v2,
2409 String n3,
2410 v3,
2411 String n4,
2412 v4,
2413 String n5,
2414 v5,
2415 String n6,
2416 v6,
2417 String n7,
2418 v7,
2419 String n8,
2420 v8,
2421 String n9,
2422 v9,
2423 String n10,
2424 v10,
2425 String n11,
2426 v11,
2427 String n12,
2428 v12,
2429 String n13,
2430 v13,
2431 String n14,
2432 v14,
2433 String n15,
2434 v15,
2435 String n16,
2436 v16,
2437 String n17,
2438 v17,
2439 String n18,
2440 v18,
2441 String n19,
2442 v19,
2443 String n20,
2444 v20,
2445 String n21,
2446 v21,
2447 String n22,
2448 v22,
2449 String n23,
2450 v23,
2451 String n24,
2452 v24,
2453 String n25,
2454 v25,
2455 String n26,
2456 v26,
2457 String n27,
2458 v27,
2459 String n28,
2460 v28) =>
2461 JS(
2462 'JavaScriptObject',
2463 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
2464 n0,
2465 v0,
2466 n1,
2467 v1,
2468 n2,
2469 v2,
2470 n3,
2471 v3,
2472 n4,
2473 v4,
2474 n5,
2475 v5,
2476 n6,
2477 v6,
2478 n7,
2479 v7,
2480 n8,
2481 v8,
2482 n9,
2483 v9,
2484 n10,
2485 v10,
2486 n11,
2487 v11,
2488 n12,
2489 v12,
2490 n13,
2491 v13,
2492 n14,
2493 v14,
2494 n15,
2495 v15,
2496 n16,
2497 v16,
2498 n17,
2499 v17,
2500 n18,
2501 v18,
2502 n19,
2503 v19,
2504 n20,
2505 v20,
2506 n21,
2507 v21,
2508 n22,
2509 v22,
2510 n23,
2511 v23,
2512 n24,
2513 v24,
2514 n25,
2515 v25,
2516 n26,
2517 v26,
2518 n27,
2519 v27,
2520 n28,
2521 v28);
2522 static newLiteral30(
2523 String n0,
2524 v0,
2525 String n1,
2526 v1,
2527 String n2,
2528 v2,
2529 String n3,
2530 v3,
2531 String n4,
2532 v4,
2533 String n5,
2534 v5,
2535 String n6,
2536 v6,
2537 String n7,
2538 v7,
2539 String n8,
2540 v8,
2541 String n9,
2542 v9,
2543 String n10,
2544 v10,
2545 String n11,
2546 v11,
2547 String n12,
2548 v12,
2549 String n13,
2550 v13,
2551 String n14,
2552 v14,
2553 String n15,
2554 v15,
2555 String n16,
2556 v16,
2557 String n17,
2558 v17,
2559 String n18,
2560 v18,
2561 String n19,
2562 v19,
2563 String n20,
2564 v20,
2565 String n21,
2566 v21,
2567 String n22,
2568 v22,
2569 String n23,
2570 v23,
2571 String n24,
2572 v24,
2573 String n25,
2574 v25,
2575 String n26,
2576 v26,
2577 String n27,
2578 v27,
2579 String n28,
2580 v28,
2581 String n29,
2582 v29) =>
2583 JS(
2584 'JavaScriptObject',
2585 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# }',
2586 n0,
2587 v0,
2588 n1,
2589 v1,
2590 n2,
2591 v2,
2592 n3,
2593 v3,
2594 n4,
2595 v4,
2596 n5,
2597 v5,
2598 n6,
2599 v6,
2600 n7,
2601 v7,
2602 n8,
2603 v8,
2604 n9,
2605 v9,
2606 n10,
2607 v10,
2608 n11,
2609 v11,
2610 n12,
2611 v12,
2612 n13,
2613 v13,
2614 n14,
2615 v14,
2616 n15,
2617 v15,
2618 n16,
2619 v16,
2620 n17,
2621 v17,
2622 n18,
2623 v18,
2624 n19,
2625 v19,
2626 n20,
2627 v20,
2628 n21,
2629 v21,
2630 n22,
2631 v22,
2632 n23,
2633 v23,
2634 n24,
2635 v24,
2636 n25,
2637 v25,
2638 n26,
2639 v26,
2640 n27,
2641 v27,
2642 n28,
2643 v28,
2644 n29,
2645 v29);
2646
2647 static callFunction0(fn) => JS('', '#()', fn);
2648 static callFunction1(fn, a) => JS('', '#(#)', fn, a);
2649 static callFunction2(fn, a, b) => JS('', '#(#, #)', fn, a, b);
2650 static callFunction3(fn, a, b, c) => JS('', '#(#, #, #)', fn, a, b, c);
2651 static callFunction4(fn, a, b, c, d) =>
2652 JS('', '#(#, #, #, #)', fn, a, b, c, d);
2653 static callFunction5(fn, a, b, c, d, e) =>
2654 JS('', '#(#, #, #, #, #)', fn, a, b, c, d, e);
2655 static callFunction6(fn, a, b, c, d, e, f) =>
2656 JS('', '#(#, #, #, #, #, #)', fn, a, b, c, d, e, f);
2657 static callFunction7(fn, a, b, c, d, e, f, g) =>
2658 JS('', '#(#, #, #, #, #, #, #)', fn, a, b, c, d, e, f, g);
2659 static callFunction8(fn, a, b, c, d, e, f, g, h) =>
2660 JS('', '#(#, #, #, #, #, #, #, #)', fn, a, b, c, d, e, f, g, h);
2661 static callFunction9(fn, a, b, c, d, e, f, g, h, i) =>
2662 JS('', '#(#, #, #, #, #, #, #, #, #)', fn, a, b, c, d, e, f, g, h, i);
2663
2664 static callConstructor0(fn) => JS('', 'new #()', fn);
2665 static callConstructor1(fn, a) => JS('', 'new #(#)', fn, a);
2666 static callConstructor2(fn, a, b) => JS('', 'new #(#, #)', fn, a, b);
2667 static callConstructor3(fn, a, b, c) => JS('', 'new #(#, #, #)', fn, a, b, c);
2668 static callConstructor4(fn, a, b, c, d) =>
2669 JS('', 'new #(#, #, #, #)', fn, a, b, c, d);
2670 static callConstructor5(fn, a, b, c, d, e) =>
2671 JS('', 'new #(#, #, #, #, #)', fn, a, b, c, d, e);
2672 static callConstructor6(fn, a, b, c, d, e, f) =>
2673 JS('', 'new #(#, #, #, #, #, #)', fn, a, b, c, d, e, f);
2674 static callConstructor7(fn, a, b, c, d, e, f, g) =>
2675 JS('', 'new #(#, #, #, #, #, #, #)', fn, a, b, c, d, e, f, g);
2676 static callConstructor8(fn, a, b, c, d, e, f, g, h) =>
2677 JS('', 'new #(#, #, #, #, #, #, #, #)', fn, a, b, c, d, e, f, g, h);
2678 static callConstructor9(fn, a, b, c, d, e, f, g, h, i) =>
2679 JS('', 'new #(#, #, #, #, #, #, #, #, #)', fn, a, b, c, d, e, f, g, h, i);
2680
2681 static callMethod0(o, method) => JS('', '#.#()', o, method);
2682 static callMethod1(o, method, a) => JS('', '#.#(#)', o, method, a);
2683 static callMethod2(o, method, a, b) => JS('', '#.#(#, #)', o, method, a, b);
2684 static callMethod3(o, method, a, b, c) =>
2685 JS('', '#.#(#, #, #)', o, method, a, b, c);
2686 static callMethod4(o, method, a, b, c, d) =>
2687 JS('', '#.#(#, #, #, #)', o, method, a, b, c, d);
2688 static callMethod5(o, method, a, b, c, d, e) =>
2689 JS('', '#.#(#, #, #, #, #)', o, method, a, b, c, d, e);
2690 static callMethod6(o, method, a, b, c, d, e, f) =>
2691 JS('', '#.#(#, #, #, #, #, #)', o, method, a, b, c, d, e, f);
2692 static callMethod7(o, method, a, b, c, d, e, f, g) =>
2693 JS('', '#.#(#, #, #, #, #, #, #)', o, method, a, b, c, d, e, f, g);
2694 static callMethod8(o, method, a, b, c, d, e, f, g, h) =>
2695 JS('', '#.#(#, #, #, #, #, #, #, #)', o, method, a, b, c, d, e, f, g, h);
2696 static callMethod9(o, method, a, b, c, d, e, f, g, h, i) => JS('',
2697 '#.#(#, #, #, #, #, #, #, #, #)', o, method, a, b, c, d, e, f, g, h, i);
2698
2699 // TODO(jacobr): should these helpers be moved somewhere else?
2700 // Unless we add a compiler feature, they could really be in user code.
2701 // These helpers all assume that optional arguments are specified by UNDEFINED .
Jennifer Messerly 2015/09/02 22:29:12 long line
Jacob 2015/09/02 22:49:55 Done.
2702
2703 static callFunction1Opt1(fn, a) {
2704 if (identical(a, UNDEFINED)) return callFunction0(fn);
2705 return callFunction1(fn, a);
2706 }
2707
2708 static callFunction2Opt1(fn, a, b) {
2709 if (identical(b, UNDEFINED)) return callFunction1(fn, a);
2710 return callFunction2(fn, a, b);
2711 }
2712
2713 static callFunction2Opt2(fn, a, b) {
2714 if (identical(a, UNDEFINED)) return callFunction0(fn);
2715 return callFunction2Opt1(fn, a, b);
2716 }
2717
2718 static callFunction3Opt1(fn, a, b, c) {
2719 if (identical(c, UNDEFINED)) return callFunction2(fn, a, b);
2720 return callFunction3(fn, a, b, c);
2721 }
2722
2723 static callFunction3Opt2(fn, a, b, c) {
2724 if (identical(b, UNDEFINED)) return callFunction1(fn, a);
2725 return callFunction3Opt1(fn, a, b, c);
2726 }
2727
2728 static callFunction3Opt3(fn, a, b, c) {
2729 if (identical(a, UNDEFINED)) return callFunction0(fn);
2730 return callFunction3Opt2(fn, a, b, c);
2731 }
2732
2733 static callFunction4Opt1(fn, a, b, c, d) {
2734 if (identical(d, UNDEFINED)) return callFunction3(fn, a, b, c);
2735 return callFunction4(fn, a, b, c, d);
2736 }
2737
2738 static callFunction4Opt2(fn, a, b, c, d) {
2739 if (identical(c, UNDEFINED)) return callFunction2(fn, a, b);
2740 return callFunction4Opt1(fn, a, b, c, d);
2741 }
2742
2743 static callFunction4Opt3(fn, a, b, c, d) {
2744 if (identical(b, UNDEFINED)) return callFunction1(fn, a);
2745 return callFunction4Opt2(fn, a, b, c, d);
2746 }
2747
2748 static callFunction4Opt4(fn, a, b, c, d) {
2749 if (identical(a, UNDEFINED)) return callFunction0(fn);
2750 return callFunction4Opt3(fn, a, b, c, d);
2751 }
2752
2753 static callFunction5Opt1(fn, a, b, c, d, e) {
2754 if (identical(e, UNDEFINED)) return callFunction4(fn, a, b, c, d);
2755 return callFunction5(fn, a, b, c, d, e);
2756 }
2757
2758 static callFunction5Opt2(fn, a, b, c, d, e) {
2759 if (identical(d, UNDEFINED)) return callFunction3(fn, a, b, c);
2760 return callFunction5Opt1(fn, a, b, c, d, e);
2761 }
2762
2763 static callFunction5Opt3(fn, a, b, c, d, e) {
2764 if (identical(c, UNDEFINED)) return callFunction2(fn, a, b);
2765 return callFunction5Opt2(fn, a, b, c, d, e);
2766 }
2767
2768 static callFunction5Opt4(fn, a, b, c, d, e) {
2769 if (identical(b, UNDEFINED)) return callFunction1(fn, a);
2770 return callFunction5Opt3(fn, a, b, c, d, e);
2771 }
2772
2773 static callFunction5Opt5(fn, a, b, c, d, e) {
2774 if (identical(a, UNDEFINED)) return callFunction0(fn);
2775 return callFunction5Opt4(fn, a, b, c, d, e);
2776 }
2777
2778 static callFunction6Opt1(fn, a, b, c, d, e, f) {
2779 if (identical(f, UNDEFINED)) return callFunction5(fn, a, b, c, d, e);
2780 return callFunction6(fn, a, b, c, d, e, f);
2781 }
2782
2783 static callFunction6Opt2(fn, a, b, c, d, e, f) {
2784 if (identical(e, UNDEFINED)) return callFunction4(fn, a, b, c, d);
2785 return callFunction6Opt1(fn, a, b, c, d, e, f);
2786 }
2787
2788 static callFunction6Opt3(fn, a, b, c, d, e, f) {
2789 if (identical(d, UNDEFINED)) return callFunction3(fn, a, b, c);
2790 return callFunction6Opt2(fn, a, b, c, d, e, f);
2791 }
2792
2793 static callFunction6Opt4(fn, a, b, c, d, e, f) {
2794 if (identical(c, UNDEFINED)) return callFunction2(fn, a, b);
2795 return callFunction6Opt3(fn, a, b, c, d, e, f);
2796 }
2797
2798 static callFunction6Opt5(fn, a, b, c, d, e, f) {
2799 if (identical(b, UNDEFINED)) return callFunction1(fn, a);
2800 return callFunction6Opt4(fn, a, b, c, d, e, f);
2801 }
2802
2803 static callFunction6Opt6(fn, a, b, c, d, e, f) {
2804 if (identical(a, UNDEFINED)) return callFunction0(fn);
2805 return callFunction6Opt5(fn, a, b, c, d, e, f);
2806 }
2807
2808 static callFunction7Opt1(fn, a, b, c, d, e, f, g) {
2809 if (identical(g, UNDEFINED)) return callFunction6(fn, a, b, c, d, e, f);
2810 return callFunction7(fn, a, b, c, d, e, f, g);
2811 }
2812
2813 static callFunction7Opt2(fn, a, b, c, d, e, f, g) {
2814 if (identical(f, UNDEFINED)) return callFunction5(fn, a, b, c, d, e);
2815 return callFunction7Opt1(fn, a, b, c, d, e, f, g);
2816 }
2817
2818 static callFunction7Opt3(fn, a, b, c, d, e, f, g) {
2819 if (identical(e, UNDEFINED)) return callFunction4(fn, a, b, c, d);
2820 return callFunction7Opt2(fn, a, b, c, d, e, f, g);
2821 }
2822
2823 static callFunction7Opt4(fn, a, b, c, d, e, f, g) {
2824 if (identical(d, UNDEFINED)) return callFunction3(fn, a, b, c);
2825 return callFunction7Opt3(fn, a, b, c, d, e, f, g);
2826 }
2827
2828 static callFunction7Opt5(fn, a, b, c, d, e, f, g) {
2829 if (identical(c, UNDEFINED)) return callFunction2(fn, a, b);
2830 return callFunction7Opt4(fn, a, b, c, d, e, f, g);
2831 }
2832
2833 static callFunction7Opt6(fn, a, b, c, d, e, f, g) {
2834 if (identical(b, UNDEFINED)) return callFunction1(fn, a);
2835 return callFunction7Opt5(fn, a, b, c, d, e, f, g);
2836 }
2837
2838 static callFunction7Opt7(fn, a, b, c, d, e, f, g) {
2839 if (identical(a, UNDEFINED)) return callFunction0(fn);
2840 return callFunction7Opt6(fn, a, b, c, d, e, f, g);
2841 }
2842
2843 static callFunction8Opt1(fn, a, b, c, d, e, f, g, h) {
2844 if (identical(h, UNDEFINED)) return callFunction7(fn, a, b, c, d, e, f, g);
2845 return callFunction8(fn, a, b, c, d, e, f, g, h);
2846 }
2847
2848 static callFunction8Opt2(fn, a, b, c, d, e, f, g, h) {
2849 if (identical(g, UNDEFINED)) return callFunction6(fn, a, b, c, d, e, f);
2850 return callFunction8Opt1(fn, a, b, c, d, e, f, g, h);
2851 }
2852
2853 static callFunction8Opt3(fn, a, b, c, d, e, f, g, h) {
2854 if (identical(f, UNDEFINED)) return callFunction5(fn, a, b, c, d, e);
2855 return callFunction8Opt2(fn, a, b, c, d, e, f, g, h);
2856 }
2857
2858 static callFunction8Opt4(fn, a, b, c, d, e, f, g, h) {
2859 if (identical(e, UNDEFINED)) return callFunction4(fn, a, b, c, d);
2860 return callFunction8Opt3(fn, a, b, c, d, e, f, g, h);
2861 }
2862
2863 static callFunction8Opt5(fn, a, b, c, d, e, f, g, h) {
2864 if (identical(d, UNDEFINED)) return callFunction3(fn, a, b, c);
2865 return callFunction8Opt4(fn, a, b, c, d, e, f, g, h);
2866 }
2867
2868 static callFunction8Opt6(fn, a, b, c, d, e, f, g, h) {
2869 if (identical(c, UNDEFINED)) return callFunction2(fn, a, b);
2870 return callFunction8Opt5(fn, a, b, c, d, e, f, g, h);
2871 }
2872
2873 static callFunction8Opt7(fn, a, b, c, d, e, f, g, h) {
2874 if (identical(b, UNDEFINED)) return callFunction1(fn, a);
2875 return callFunction8Opt6(fn, a, b, c, d, e, f, g, h);
2876 }
2877
2878 static callFunction8Opt8(fn, a, b, c, d, e, f, g, h) {
2879 if (identical(a, UNDEFINED)) return callFunction0(fn);
2880 return callFunction8Opt7(fn, a, b, c, d, e, f, g, h);
2881 }
2882
2883 static callFunction9Opt1(fn, a, b, c, d, e, f, g, h, i) {
2884 if (identical(i, UNDEFINED)) return callFunction8(
2885 fn, a, b, c, d, e, f, g, h);
2886 return callFunction9(fn, a, b, c, d, e, f, g, h, i);
2887 }
2888
2889 static callFunction9Opt2(fn, a, b, c, d, e, f, g, h, i) {
2890 if (identical(h, UNDEFINED)) return callFunction7(fn, a, b, c, d, e, f, g);
2891 return callFunction9Opt1(fn, a, b, c, d, e, f, g, h, i);
2892 }
2893
2894 static callFunction9Opt3(fn, a, b, c, d, e, f, g, h, i) {
2895 if (identical(g, UNDEFINED)) return callFunction6(fn, a, b, c, d, e, f);
2896 return callFunction9Opt2(fn, a, b, c, d, e, f, g, h, i);
2897 }
2898
2899 static callFunction9Opt4(fn, a, b, c, d, e, f, g, h, i) {
2900 if (identical(f, UNDEFINED)) return callFunction5(fn, a, b, c, d, e);
2901 return callFunction9Opt3(fn, a, b, c, d, e, f, g, h, i);
2902 }
2903
2904 static callFunction9Opt5(fn, a, b, c, d, e, f, g, h, i) {
2905 if (identical(e, UNDEFINED)) return callFunction4(fn, a, b, c, d);
2906 return callFunction9Opt4(fn, a, b, c, d, e, f, g, h, i);
2907 }
2908
2909 static callFunction9Opt6(fn, a, b, c, d, e, f, g, h, i) {
2910 if (identical(d, UNDEFINED)) return callFunction3(fn, a, b, c);
2911 return callFunction9Opt5(fn, a, b, c, d, e, f, g, h, i);
2912 }
2913
2914 static callFunction9Opt7(fn, a, b, c, d, e, f, g, h, i) {
2915 if (identical(c, UNDEFINED)) return callFunction2(fn, a, b);
2916 return callFunction9Opt6(fn, a, b, c, d, e, f, g, h, i);
2917 }
2918
2919 static callFunction9Opt8(fn, a, b, c, d, e, f, g, h, i) {
2920 if (identical(b, UNDEFINED)) return callFunction1(fn, a);
2921 return callFunction9Opt7(fn, a, b, c, d, e, f, g, h, i);
2922 }
2923
2924 static callFunction9Opt9(fn, a, b, c, d, e, f, g, h, i) {
2925 if (identical(a, UNDEFINED)) return callFunction0(fn);
2926 return callFunction9Opt8(fn, a, b, c, d, e, f, g, h, i);
2927 }
2928
2929 static callConstructor1Opt1(fn, a) {
2930 if (identical(a, UNDEFINED)) return callConstructor0(fn);
2931 return callConstructor1(fn, a);
2932 }
2933
2934 static callConstructor2Opt1(fn, a, b) {
2935 if (identical(b, UNDEFINED)) return callConstructor1(fn, a);
2936 return callConstructor2(fn, a, b);
2937 }
2938
2939 static callConstructor2Opt2(fn, a, b) {
2940 if (identical(a, UNDEFINED)) return callConstructor0(fn);
2941 return callConstructor2Opt1(fn, a, b);
2942 }
2943
2944 static callConstructor3Opt1(fn, a, b, c) {
2945 if (identical(c, UNDEFINED)) return callConstructor2(fn, a, b);
2946 return callConstructor3(fn, a, b, c);
2947 }
2948
2949 static callConstructor3Opt2(fn, a, b, c) {
2950 if (identical(b, UNDEFINED)) return callConstructor1(fn, a);
2951 return callConstructor3Opt1(fn, a, b, c);
2952 }
2953
2954 static callConstructor3Opt3(fn, a, b, c) {
2955 if (identical(a, UNDEFINED)) return callConstructor0(fn);
2956 return callConstructor3Opt2(fn, a, b, c);
2957 }
2958
2959 static callConstructor4Opt1(fn, a, b, c, d) {
2960 if (identical(d, UNDEFINED)) return callConstructor3(fn, a, b, c);
2961 return callConstructor4(fn, a, b, c, d);
2962 }
2963
2964 static callConstructor4Opt2(fn, a, b, c, d) {
2965 if (identical(c, UNDEFINED)) return callConstructor2(fn, a, b);
2966 return callConstructor4Opt1(fn, a, b, c, d);
2967 }
2968
2969 static callConstructor4Opt3(fn, a, b, c, d) {
2970 if (identical(b, UNDEFINED)) return callConstructor1(fn, a);
2971 return callConstructor4Opt2(fn, a, b, c, d);
2972 }
2973
2974 static callConstructor4Opt4(fn, a, b, c, d) {
2975 if (identical(a, UNDEFINED)) return callConstructor0(fn);
2976 return callConstructor4Opt3(fn, a, b, c, d);
2977 }
2978
2979 static callConstructor5Opt1(fn, a, b, c, d, e) {
2980 if (identical(e, UNDEFINED)) return callConstructor4(fn, a, b, c, d);
2981 return callConstructor5(fn, a, b, c, d, e);
2982 }
2983
2984 static callConstructor5Opt2(fn, a, b, c, d, e) {
2985 if (identical(d, UNDEFINED)) return callConstructor3(fn, a, b, c);
2986 return callConstructor5Opt1(fn, a, b, c, d, e);
2987 }
2988
2989 static callConstructor5Opt3(fn, a, b, c, d, e) {
2990 if (identical(c, UNDEFINED)) return callConstructor2(fn, a, b);
2991 return callConstructor5Opt2(fn, a, b, c, d, e);
2992 }
2993
2994 static callConstructor5Opt4(fn, a, b, c, d, e) {
2995 if (identical(b, UNDEFINED)) return callConstructor1(fn, a);
2996 return callConstructor5Opt3(fn, a, b, c, d, e);
2997 }
2998
2999 static callConstructor5Opt5(fn, a, b, c, d, e) {
3000 if (identical(a, UNDEFINED)) return callConstructor0(fn);
3001 return callConstructor5Opt4(fn, a, b, c, d, e);
3002 }
3003
3004 static callConstructor6Opt1(fn, a, b, c, d, e, f) {
3005 if (identical(f, UNDEFINED)) return callConstructor5(fn, a, b, c, d, e);
3006 return callConstructor6(fn, a, b, c, d, e, f);
3007 }
3008
3009 static callConstructor6Opt2(fn, a, b, c, d, e, f) {
3010 if (identical(e, UNDEFINED)) return callConstructor4(fn, a, b, c, d);
3011 return callConstructor6Opt1(fn, a, b, c, d, e, f);
3012 }
3013
3014 static callConstructor6Opt3(fn, a, b, c, d, e, f) {
3015 if (identical(d, UNDEFINED)) return callConstructor3(fn, a, b, c);
3016 return callConstructor6Opt2(fn, a, b, c, d, e, f);
3017 }
3018
3019 static callConstructor6Opt4(fn, a, b, c, d, e, f) {
3020 if (identical(c, UNDEFINED)) return callConstructor2(fn, a, b);
3021 return callConstructor6Opt3(fn, a, b, c, d, e, f);
3022 }
3023
3024 static callConstructor6Opt5(fn, a, b, c, d, e, f) {
3025 if (identical(b, UNDEFINED)) return callConstructor1(fn, a);
3026 return callConstructor6Opt4(fn, a, b, c, d, e, f);
3027 }
3028
3029 static callConstructor6Opt6(fn, a, b, c, d, e, f) {
3030 if (identical(a, UNDEFINED)) return callConstructor0(fn);
3031 return callConstructor6Opt5(fn, a, b, c, d, e, f);
3032 }
3033
3034 static callConstructor7Opt1(fn, a, b, c, d, e, f, g) {
3035 if (identical(g, UNDEFINED)) return callConstructor6(fn, a, b, c, d, e, f);
3036 return callConstructor7(fn, a, b, c, d, e, f, g);
3037 }
3038
3039 static callConstructor7Opt2(fn, a, b, c, d, e, f, g) {
3040 if (identical(f, UNDEFINED)) return callConstructor5(fn, a, b, c, d, e);
3041 return callConstructor7Opt1(fn, a, b, c, d, e, f, g);
3042 }
3043
3044 static callConstructor7Opt3(fn, a, b, c, d, e, f, g) {
3045 if (identical(e, UNDEFINED)) return callConstructor4(fn, a, b, c, d);
3046 return callConstructor7Opt2(fn, a, b, c, d, e, f, g);
3047 }
3048
3049 static callConstructor7Opt4(fn, a, b, c, d, e, f, g) {
3050 if (identical(d, UNDEFINED)) return callConstructor3(fn, a, b, c);
3051 return callConstructor7Opt3(fn, a, b, c, d, e, f, g);
3052 }
3053
3054 static callConstructor7Opt5(fn, a, b, c, d, e, f, g) {
3055 if (identical(c, UNDEFINED)) return callConstructor2(fn, a, b);
3056 return callConstructor7Opt4(fn, a, b, c, d, e, f, g);
3057 }
3058
3059 static callConstructor7Opt6(fn, a, b, c, d, e, f, g) {
3060 if (identical(b, UNDEFINED)) return callConstructor1(fn, a);
3061 return callConstructor7Opt5(fn, a, b, c, d, e, f, g);
3062 }
3063
3064 static callConstructor7Opt7(fn, a, b, c, d, e, f, g) {
3065 if (identical(a, UNDEFINED)) return callConstructor0(fn);
3066 return callConstructor7Opt6(fn, a, b, c, d, e, f, g);
3067 }
3068
3069 static callConstructor8Opt1(fn, a, b, c, d, e, f, g, h) {
3070 if (identical(h, UNDEFINED)) return callConstructor7(
3071 fn, a, b, c, d, e, f, g);
3072 return callConstructor8(fn, a, b, c, d, e, f, g, h);
3073 }
3074
3075 static callConstructor8Opt2(fn, a, b, c, d, e, f, g, h) {
3076 if (identical(g, UNDEFINED)) return callConstructor6(fn, a, b, c, d, e, f);
3077 return callConstructor8Opt1(fn, a, b, c, d, e, f, g, h);
3078 }
3079
3080 static callConstructor8Opt3(fn, a, b, c, d, e, f, g, h) {
3081 if (identical(f, UNDEFINED)) return callConstructor5(fn, a, b, c, d, e);
3082 return callConstructor8Opt2(fn, a, b, c, d, e, f, g, h);
3083 }
3084
3085 static callConstructor8Opt4(fn, a, b, c, d, e, f, g, h) {
3086 if (identical(e, UNDEFINED)) return callConstructor4(fn, a, b, c, d);
3087 return callConstructor8Opt3(fn, a, b, c, d, e, f, g, h);
3088 }
3089
3090 static callConstructor8Opt5(fn, a, b, c, d, e, f, g, h) {
3091 if (identical(d, UNDEFINED)) return callConstructor3(fn, a, b, c);
3092 return callConstructor8Opt4(fn, a, b, c, d, e, f, g, h);
3093 }
3094
3095 static callConstructor8Opt6(fn, a, b, c, d, e, f, g, h) {
3096 if (identical(c, UNDEFINED)) return callConstructor2(fn, a, b);
3097 return callConstructor8Opt5(fn, a, b, c, d, e, f, g, h);
3098 }
3099
3100 static callConstructor8Opt7(fn, a, b, c, d, e, f, g, h) {
3101 if (identical(b, UNDEFINED)) return callConstructor1(fn, a);
3102 return callConstructor8Opt6(fn, a, b, c, d, e, f, g, h);
3103 }
3104
3105 static callConstructor8Opt8(fn, a, b, c, d, e, f, g, h) {
3106 if (identical(a, UNDEFINED)) return callConstructor0(fn);
3107 return callConstructor8Opt7(fn, a, b, c, d, e, f, g, h);
3108 }
3109
3110 static callConstructor9Opt1(fn, a, b, c, d, e, f, g, h, i) {
3111 if (identical(i, UNDEFINED)) return callConstructor8(
3112 fn, a, b, c, d, e, f, g, h);
3113 return callConstructor9(fn, a, b, c, d, e, f, g, h, i);
3114 }
3115
3116 static callConstructor9Opt2(fn, a, b, c, d, e, f, g, h, i) {
3117 if (identical(h, UNDEFINED)) return callConstructor7(
3118 fn, a, b, c, d, e, f, g);
3119 return callConstructor9Opt1(fn, a, b, c, d, e, f, g, h, i);
3120 }
3121
3122 static callConstructor9Opt3(fn, a, b, c, d, e, f, g, h, i) {
3123 if (identical(g, UNDEFINED)) return callConstructor6(fn, a, b, c, d, e, f);
3124 return callConstructor9Opt2(fn, a, b, c, d, e, f, g, h, i);
3125 }
3126
3127 static callConstructor9Opt4(fn, a, b, c, d, e, f, g, h, i) {
3128 if (identical(f, UNDEFINED)) return callConstructor5(fn, a, b, c, d, e);
3129 return callConstructor9Opt3(fn, a, b, c, d, e, f, g, h, i);
3130 }
3131
3132 static callConstructor9Opt5(fn, a, b, c, d, e, f, g, h, i) {
3133 if (identical(e, UNDEFINED)) return callConstructor4(fn, a, b, c, d);
3134 return callConstructor9Opt4(fn, a, b, c, d, e, f, g, h, i);
3135 }
3136
3137 static callConstructor9Opt6(fn, a, b, c, d, e, f, g, h, i) {
3138 if (identical(d, UNDEFINED)) return callConstructor3(fn, a, b, c);
3139 return callConstructor9Opt5(fn, a, b, c, d, e, f, g, h, i);
3140 }
3141
3142 static callConstructor9Opt7(fn, a, b, c, d, e, f, g, h, i) {
3143 if (identical(c, UNDEFINED)) return callConstructor2(fn, a, b);
3144 return callConstructor9Opt6(fn, a, b, c, d, e, f, g, h, i);
3145 }
3146
3147 static callConstructor9Opt8(fn, a, b, c, d, e, f, g, h, i) {
3148 if (identical(b, UNDEFINED)) return callConstructor1(fn, a);
3149 return callConstructor9Opt7(fn, a, b, c, d, e, f, g, h, i);
3150 }
3151
3152 static callConstructor9Opt9(fn, a, b, c, d, e, f, g, h, i) {
3153 if (identical(a, UNDEFINED)) return callConstructor0(fn);
3154 return callConstructor9Opt8(fn, a, b, c, d, e, f, g, h, i);
3155 }
3156
3157 static callMethod1Opt1(o, method, a) {
3158 if (identical(a, UNDEFINED)) return callMethod0(o, method);
3159 return callMethod1(o, method, a);
3160 }
3161
3162 static callMethod2Opt1(o, method, a, b) {
3163 if (identical(b, UNDEFINED)) return callMethod1(o, method, a);
3164 return callMethod2(o, method, a, b);
3165 }
3166
3167 static callMethod2Opt2(o, method, a, b) {
3168 if (identical(a, UNDEFINED)) return callMethod0(o, method);
3169 return callMethod2Opt1(o, method, a, b);
3170 }
3171
3172 static callMethod3Opt1(o, method, a, b, c) {
3173 if (identical(c, UNDEFINED)) return callMethod2(o, method, a, b);
3174 return callMethod3(o, method, a, b, c);
3175 }
3176
3177 static callMethod3Opt2(o, method, a, b, c) {
3178 if (identical(b, UNDEFINED)) return callMethod1(o, method, a);
3179 return callMethod3Opt1(o, method, a, b, c);
3180 }
3181
3182 static callMethod3Opt3(o, method, a, b, c) {
3183 if (identical(a, UNDEFINED)) return callMethod0(o, method);
3184 return callMethod3Opt2(o, method, a, b, c);
3185 }
3186
3187 static callMethod4Opt1(o, method, a, b, c, d) {
3188 if (identical(d, UNDEFINED)) return callMethod3(o, method, a, b, c);
3189 return callMethod4(o, method, a, b, c, d);
3190 }
3191
3192 static callMethod4Opt2(o, method, a, b, c, d) {
3193 if (identical(c, UNDEFINED)) return callMethod2(o, method, a, b);
3194 return callMethod4Opt1(o, method, a, b, c, d);
3195 }
3196
3197 static callMethod4Opt3(o, method, a, b, c, d) {
3198 if (identical(b, UNDEFINED)) return callMethod1(o, method, a);
3199 return callMethod4Opt2(o, method, a, b, c, d);
3200 }
3201
3202 static callMethod4Opt4(o, method, a, b, c, d) {
3203 if (identical(a, UNDEFINED)) return callMethod0(o, method);
3204 return callMethod4Opt3(o, method, a, b, c, d);
3205 }
3206
3207 static callMethod5Opt1(o, method, a, b, c, d, e) {
3208 if (identical(e, UNDEFINED)) return callMethod4(o, method, a, b, c, d);
3209 return callMethod5(o, method, a, b, c, d, e);
3210 }
3211
3212 static callMethod5Opt2(o, method, a, b, c, d, e) {
3213 if (identical(d, UNDEFINED)) return callMethod3(o, method, a, b, c);
3214 return callMethod5Opt1(o, method, a, b, c, d, e);
3215 }
3216
3217 static callMethod5Opt3(o, method, a, b, c, d, e) {
3218 if (identical(c, UNDEFINED)) return callMethod2(o, method, a, b);
3219 return callMethod5Opt2(o, method, a, b, c, d, e);
3220 }
3221
3222 static callMethod5Opt4(o, method, a, b, c, d, e) {
3223 if (identical(b, UNDEFINED)) return callMethod1(o, method, a);
3224 return callMethod5Opt3(o, method, a, b, c, d, e);
3225 }
3226
3227 static callMethod5Opt5(o, method, a, b, c, d, e) {
3228 if (identical(a, UNDEFINED)) return callMethod0(o, method);
3229 return callMethod5Opt4(o, method, a, b, c, d, e);
3230 }
3231
3232 static callMethod6Opt1(o, method, a, b, c, d, e, f) {
3233 if (identical(f, UNDEFINED)) return callMethod5(o, method, a, b, c, d, e);
3234 return callMethod6(o, method, a, b, c, d, e, f);
3235 }
3236
3237 static callMethod6Opt2(o, method, a, b, c, d, e, f) {
3238 if (identical(e, UNDEFINED)) return callMethod4(o, method, a, b, c, d);
3239 return callMethod6Opt1(o, method, a, b, c, d, e, f);
3240 }
3241
3242 static callMethod6Opt3(o, method, a, b, c, d, e, f) {
3243 if (identical(d, UNDEFINED)) return callMethod3(o, method, a, b, c);
3244 return callMethod6Opt2(o, method, a, b, c, d, e, f);
3245 }
3246
3247 static callMethod6Opt4(o, method, a, b, c, d, e, f) {
3248 if (identical(c, UNDEFINED)) return callMethod2(o, method, a, b);
3249 return callMethod6Opt3(o, method, a, b, c, d, e, f);
3250 }
3251
3252 static callMethod6Opt5(o, method, a, b, c, d, e, f) {
3253 if (identical(b, UNDEFINED)) return callMethod1(o, method, a);
3254 return callMethod6Opt4(o, method, a, b, c, d, e, f);
3255 }
3256
3257 static callMethod6Opt6(o, method, a, b, c, d, e, f) {
3258 if (identical(a, UNDEFINED)) return callMethod0(o, method);
3259 return callMethod6Opt5(o, method, a, b, c, d, e, f);
3260 }
3261
3262 static callMethod7Opt1(o, method, a, b, c, d, e, f, g) {
3263 if (identical(g, UNDEFINED)) return callMethod6(
3264 o, method, a, b, c, d, e, f);
3265 return callMethod7(o, method, a, b, c, d, e, f, g);
3266 }
3267
3268 static callMethod7Opt2(o, method, a, b, c, d, e, f, g) {
3269 if (identical(f, UNDEFINED)) return callMethod5(o, method, a, b, c, d, e);
3270 return callMethod7Opt1(o, method, a, b, c, d, e, f, g);
3271 }
3272
3273 static callMethod7Opt3(o, method, a, b, c, d, e, f, g) {
3274 if (identical(e, UNDEFINED)) return callMethod4(o, method, a, b, c, d);
3275 return callMethod7Opt2(o, method, a, b, c, d, e, f, g);
3276 }
3277
3278 static callMethod7Opt4(o, method, a, b, c, d, e, f, g) {
3279 if (identical(d, UNDEFINED)) return callMethod3(o, method, a, b, c);
3280 return callMethod7Opt3(o, method, a, b, c, d, e, f, g);
3281 }
3282
3283 static callMethod7Opt5(o, method, a, b, c, d, e, f, g) {
3284 if (identical(c, UNDEFINED)) return callMethod2(o, method, a, b);
3285 return callMethod7Opt4(o, method, a, b, c, d, e, f, g);
3286 }
3287
3288 static callMethod7Opt6(o, method, a, b, c, d, e, f, g) {
3289 if (identical(b, UNDEFINED)) return callMethod1(o, method, a);
3290 return callMethod7Opt5(o, method, a, b, c, d, e, f, g);
3291 }
3292
3293 static callMethod7Opt7(o, method, a, b, c, d, e, f, g) {
3294 if (identical(a, UNDEFINED)) return callMethod0(o, method);
3295 return callMethod7Opt6(o, method, a, b, c, d, e, f, g);
3296 }
3297
3298 static callMethod8Opt1(o, method, a, b, c, d, e, f, g, h) {
3299 if (identical(h, UNDEFINED)) return callMethod7(
3300 o, method, a, b, c, d, e, f, g);
3301 return callMethod8(o, method, a, b, c, d, e, f, g, h);
3302 }
3303
3304 static callMethod8Opt2(o, method, a, b, c, d, e, f, g, h) {
3305 if (identical(g, UNDEFINED)) return callMethod6(
3306 o, method, a, b, c, d, e, f);
3307 return callMethod8Opt1(o, method, a, b, c, d, e, f, g, h);
3308 }
3309
3310 static callMethod8Opt3(o, method, a, b, c, d, e, f, g, h) {
3311 if (identical(f, UNDEFINED)) return callMethod5(o, method, a, b, c, d, e);
3312 return callMethod8Opt2(o, method, a, b, c, d, e, f, g, h);
3313 }
3314
3315 static callMethod8Opt4(o, method, a, b, c, d, e, f, g, h) {
3316 if (identical(e, UNDEFINED)) return callMethod4(o, method, a, b, c, d);
3317 return callMethod8Opt3(o, method, a, b, c, d, e, f, g, h);
3318 }
3319
3320 static callMethod8Opt5(o, method, a, b, c, d, e, f, g, h) {
3321 if (identical(d, UNDEFINED)) return callMethod3(o, method, a, b, c);
3322 return callMethod8Opt4(o, method, a, b, c, d, e, f, g, h);
3323 }
3324
3325 static callMethod8Opt6(o, method, a, b, c, d, e, f, g, h) {
3326 if (identical(c, UNDEFINED)) return callMethod2(o, method, a, b);
3327 return callMethod8Opt5(o, method, a, b, c, d, e, f, g, h);
3328 }
3329
3330 static callMethod8Opt7(o, method, a, b, c, d, e, f, g, h) {
3331 if (identical(b, UNDEFINED)) return callMethod1(o, method, a);
3332 return callMethod8Opt6(o, method, a, b, c, d, e, f, g, h);
3333 }
3334
3335 static callMethod8Opt8(o, method, a, b, c, d, e, f, g, h) {
3336 if (identical(a, UNDEFINED)) return callMethod0(o, method);
3337 return callMethod8Opt7(o, method, a, b, c, d, e, f, g, h);
3338 }
3339
3340 static callMethod9Opt1(o, method, a, b, c, d, e, f, g, h, i) {
3341 if (identical(i, UNDEFINED)) return callMethod8(
3342 o, method, a, b, c, d, e, f, g, h);
3343 return callMethod9(o, method, a, b, c, d, e, f, g, h, i);
3344 }
3345
3346 static callMethod9Opt2(o, method, a, b, c, d, e, f, g, h, i) {
3347 if (identical(h, UNDEFINED)) return callMethod7(
3348 o, method, a, b, c, d, e, f, g);
3349 return callMethod9Opt1(o, method, a, b, c, d, e, f, g, h, i);
3350 }
3351
3352 static callMethod9Opt3(o, method, a, b, c, d, e, f, g, h, i) {
3353 if (identical(g, UNDEFINED)) return callMethod6(
3354 o, method, a, b, c, d, e, f);
3355 return callMethod9Opt2(o, method, a, b, c, d, e, f, g, h, i);
3356 }
3357
3358 static callMethod9Opt4(o, method, a, b, c, d, e, f, g, h, i) {
3359 if (identical(f, UNDEFINED)) return callMethod5(o, method, a, b, c, d, e);
3360 return callMethod9Opt3(o, method, a, b, c, d, e, f, g, h, i);
3361 }
3362
3363 static callMethod9Opt5(o, method, a, b, c, d, e, f, g, h, i) {
3364 if (identical(e, UNDEFINED)) return callMethod4(o, method, a, b, c, d);
3365 return callMethod9Opt4(o, method, a, b, c, d, e, f, g, h, i);
3366 }
3367
3368 static callMethod9Opt6(o, method, a, b, c, d, e, f, g, h, i) {
3369 if (identical(d, UNDEFINED)) return callMethod3(o, method, a, b, c);
3370 return callMethod9Opt5(o, method, a, b, c, d, e, f, g, h, i);
3371 }
3372
3373 static callMethod9Opt7(o, method, a, b, c, d, e, f, g, h, i) {
3374 if (identical(c, UNDEFINED)) return callMethod2(o, method, a, b);
3375 return callMethod9Opt6(o, method, a, b, c, d, e, f, g, h, i);
3376 }
3377
3378 static callMethod9Opt8(o, method, a, b, c, d, e, f, g, h, i) {
3379 if (identical(b, UNDEFINED)) return callMethod1(o, method, a);
3380 return callMethod9Opt7(o, method, a, b, c, d, e, f, g, h, i);
3381 }
3382
3383 static callMethod9Opt9(o, method, a, b, c, d, e, f, g, h, i) {
3384 if (identical(a, UNDEFINED)) return callMethod0(o, method);
3385 return callMethod9Opt8(o, method, a, b, c, d, e, f, g, h, i);
3386 }
3387 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/interceptors.dart ('k') | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698