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

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: 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
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;
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() {'
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];
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 low level JavaScript interop API.
792 /// This API is unweildy to use and should generally only be used by internal
793 /// tools. It is easy to write fragile code with this API that accidentally
794 /// depends on Dart2Js implementation details. Passing JsObject instances to
795 /// this API has unspecified behavior. You should use either the old JsObject
796 /// interop APIs or this API in your application not both.
797 class JsNative {
798 /// WARNING: behavior for UNDEFINED is undefined for the following cases:
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);
alexandre.ardhuin 2015/09/03 20:14:11 return a bool
Jacob 2015/10/01 00:47:33 Done.
805
806 // Helpers for significantly more efficient JavaScript object literal
807 // creation that jsify.
808 static newLiteral() => JS('JavaScriptObject', '{}');
809 static newArray() => JS('JsArray', '[]');
810 static hasOwnProperty(object, name) =>
alexandre.ardhuin 2015/09/03 20:14:11 return a bool
Jacob 2015/10/01 00:47:33 Done.
811 JS('', '#.hasOwnProperty(#)', object, name);
alexandre.ardhuin 2015/09/03 20:14:11 JS('bool', .... ) ?
Jacob 2015/10/01 00:47:33 Done.
812 static hasProperty(object, name) => JS('', '# in #', object, name);
alexandre.ardhuin 2015/09/03 20:14:11 return a bool and JS('bool',...) ?
Jacob 2015/10/01 00:47:33 Done.
813 static getProperty(object, name) => JS('', '#[#]', object, name);
814 static setProperty(object, name, value) =>
815 JS('', '#[#] = #', object, name, value);
816
817 // Do not modify these definitions manually. They were generated by a script.
818 static newLiteral1(String n0, v0) => JS('JavaScriptObject', '{#:#}', n0, v0);
819 static newLiteral2(String n0, v0, String n1, v1) =>
820 JS('JavaScriptObject', '{#:#, #:#}', n0, v0, n1, v1);
821 static newLiteral3(String n0, v0, String n1, v1, String n2, v2) =>
822 JS('JavaScriptObject', '{#:#, #:#, #:#}', n0, v0, n1, v1, n2, v2);
823 static newLiteral4(
824 String n0, v0, String n1, v1, String n2, v2, String n3, v3) =>
825 JS('JavaScriptObject', '{#:#, #:#, #:#, #:#}', n0, v0, n1, v1, n2, v2, n3,
826 v3);
827 static newLiteral5(String n0, v0, String n1, v1, String n2, v2, String n3, v3,
828 String n4, v4) =>
829 JS('JavaScriptObject', '{#:#, #:#, #:#, #:#, #:#}', n0, v0, n1, v1, n2,
830 v2, n3, v3, n4, v4);
831 static newLiteral6(String n0, v0, String n1, v1, String n2, v2, String n3, v3,
832 String n4, v4, String n5, v5) =>
833 JS('JavaScriptObject', '{#:#, #:#, #:#, #:#, #:#, #:#}', n0, v0, n1, v1,
834 n2, v2, n3, v3, n4, v4, n5, v5);
835 static newLiteral7(String n0, v0, String n1, v1, String n2, v2, String n3, v3,
836 String n4, v4, String n5, v5, String n6, v6) =>
837 JS('JavaScriptObject', '{#:#, #:#, #:#, #:#, #:#, #:#, #:#}', n0, v0, n1,
838 v1, n2, v2, n3, v3, n4, v4, n5, v5, n6, v6);
839 static newLiteral8(String n0, v0, String n1, v1, String n2, v2, String n3, v3,
840 String n4, v4, String n5, v5, String n6, v6, String n7, v7) =>
841 JS('JavaScriptObject', '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}', n0, v0,
842 n1, v1, n2, v2, n3, v3, n4, v4, n5, v5, n6, v6, n7, v7);
843 static newLiteral9(
844 String n0,
845 v0,
846 String n1,
847 v1,
848 String n2,
849 v2,
850 String n3,
851 v3,
852 String n4,
853 v4,
854 String n5,
855 v5,
856 String n6,
857 v6,
858 String n7,
859 v7,
860 String n8,
861 v8) =>
862 JS(
863 'JavaScriptObject',
864 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
865 n0,
866 v0,
867 n1,
868 v1,
869 n2,
870 v2,
871 n3,
872 v3,
873 n4,
874 v4,
875 n5,
876 v5,
877 n6,
878 v6,
879 n7,
880 v7,
881 n8,
882 v8);
883 static newLiteral10(
884 String n0,
885 v0,
886 String n1,
887 v1,
888 String n2,
889 v2,
890 String n3,
891 v3,
892 String n4,
893 v4,
894 String n5,
895 v5,
896 String n6,
897 v6,
898 String n7,
899 v7,
900 String n8,
901 v8,
902 String n9,
903 v9) =>
904 JS(
905 'JavaScriptObject',
906 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
907 n0,
908 v0,
909 n1,
910 v1,
911 n2,
912 v2,
913 n3,
914 v3,
915 n4,
916 v4,
917 n5,
918 v5,
919 n6,
920 v6,
921 n7,
922 v7,
923 n8,
924 v8,
925 n9,
926 v9);
927 static newLiteral11(
928 String n0,
929 v0,
930 String n1,
931 v1,
932 String n2,
933 v2,
934 String n3,
935 v3,
936 String n4,
937 v4,
938 String n5,
939 v5,
940 String n6,
941 v6,
942 String n7,
943 v7,
944 String n8,
945 v8,
946 String n9,
947 v9,
948 String n10,
949 v10) =>
950 JS(
951 'JavaScriptObject',
952 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
953 n0,
954 v0,
955 n1,
956 v1,
957 n2,
958 v2,
959 n3,
960 v3,
961 n4,
962 v4,
963 n5,
964 v5,
965 n6,
966 v6,
967 n7,
968 v7,
969 n8,
970 v8,
971 n9,
972 v9,
973 n10,
974 v10);
975 static newLiteral12(
976 String n0,
977 v0,
978 String n1,
979 v1,
980 String n2,
981 v2,
982 String n3,
983 v3,
984 String n4,
985 v4,
986 String n5,
987 v5,
988 String n6,
989 v6,
990 String n7,
991 v7,
992 String n8,
993 v8,
994 String n9,
995 v9,
996 String n10,
997 v10,
998 String n11,
999 v11) =>
1000 JS(
1001 'JavaScriptObject',
1002 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
1003 n0,
1004 v0,
1005 n1,
1006 v1,
1007 n2,
1008 v2,
1009 n3,
1010 v3,
1011 n4,
1012 v4,
1013 n5,
1014 v5,
1015 n6,
1016 v6,
1017 n7,
1018 v7,
1019 n8,
1020 v8,
1021 n9,
1022 v9,
1023 n10,
1024 v10,
1025 n11,
1026 v11);
1027 static newLiteral13(
1028 String n0,
1029 v0,
1030 String n1,
1031 v1,
1032 String n2,
1033 v2,
1034 String n3,
1035 v3,
1036 String n4,
1037 v4,
1038 String n5,
1039 v5,
1040 String n6,
1041 v6,
1042 String n7,
1043 v7,
1044 String n8,
1045 v8,
1046 String n9,
1047 v9,
1048 String n10,
1049 v10,
1050 String n11,
1051 v11,
1052 String n12,
1053 v12) =>
1054 JS(
1055 'JavaScriptObject',
1056 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
1057 n0,
1058 v0,
1059 n1,
1060 v1,
1061 n2,
1062 v2,
1063 n3,
1064 v3,
1065 n4,
1066 v4,
1067 n5,
1068 v5,
1069 n6,
1070 v6,
1071 n7,
1072 v7,
1073 n8,
1074 v8,
1075 n9,
1076 v9,
1077 n10,
1078 v10,
1079 n11,
1080 v11,
1081 n12,
1082 v12);
1083 static newLiteral14(
1084 String n0,
1085 v0,
1086 String n1,
1087 v1,
1088 String n2,
1089 v2,
1090 String n3,
1091 v3,
1092 String n4,
1093 v4,
1094 String n5,
1095 v5,
1096 String n6,
1097 v6,
1098 String n7,
1099 v7,
1100 String n8,
1101 v8,
1102 String n9,
1103 v9,
1104 String n10,
1105 v10,
1106 String n11,
1107 v11,
1108 String n12,
1109 v12,
1110 String n13,
1111 v13) =>
1112 JS(
1113 'JavaScriptObject',
1114 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# }',
1115 n0,
1116 v0,
1117 n1,
1118 v1,
1119 n2,
1120 v2,
1121 n3,
1122 v3,
1123 n4,
1124 v4,
1125 n5,
1126 v5,
1127 n6,
1128 v6,
1129 n7,
1130 v7,
1131 n8,
1132 v8,
1133 n9,
1134 v9,
1135 n10,
1136 v10,
1137 n11,
1138 v11,
1139 n12,
1140 v12,
1141 n13,
1142 v13);
1143 static newLiteral15(
1144 String n0,
1145 v0,
1146 String n1,
1147 v1,
1148 String n2,
1149 v2,
1150 String n3,
1151 v3,
1152 String n4,
1153 v4,
1154 String n5,
1155 v5,
1156 String n6,
1157 v6,
1158 String n7,
1159 v7,
1160 String n8,
1161 v8,
1162 String n9,
1163 v9,
1164 String n10,
1165 v10,
1166 String n11,
1167 v11,
1168 String n12,
1169 v12,
1170 String n13,
1171 v13,
1172 String n14,
1173 v14) =>
1174 JS(
1175 'JavaScriptObject',
1176 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#}',
1177 n0,
1178 v0,
1179 n1,
1180 v1,
1181 n2,
1182 v2,
1183 n3,
1184 v3,
1185 n4,
1186 v4,
1187 n5,
1188 v5,
1189 n6,
1190 v6,
1191 n7,
1192 v7,
1193 n8,
1194 v8,
1195 n9,
1196 v9,
1197 n10,
1198 v10,
1199 n11,
1200 v11,
1201 n12,
1202 v12,
1203 n13,
1204 v13,
1205 n14,
1206 v14);
1207 static newLiteral16(
1208 String n0,
1209 v0,
1210 String n1,
1211 v1,
1212 String n2,
1213 v2,
1214 String n3,
1215 v3,
1216 String n4,
1217 v4,
1218 String n5,
1219 v5,
1220 String n6,
1221 v6,
1222 String n7,
1223 v7,
1224 String n8,
1225 v8,
1226 String n9,
1227 v9,
1228 String n10,
1229 v10,
1230 String n11,
1231 v11,
1232 String n12,
1233 v12,
1234 String n13,
1235 v13,
1236 String n14,
1237 v14,
1238 String n15,
1239 v15) =>
1240 JS(
1241 'JavaScriptObject',
1242 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#}',
1243 n0,
1244 v0,
1245 n1,
1246 v1,
1247 n2,
1248 v2,
1249 n3,
1250 v3,
1251 n4,
1252 v4,
1253 n5,
1254 v5,
1255 n6,
1256 v6,
1257 n7,
1258 v7,
1259 n8,
1260 v8,
1261 n9,
1262 v9,
1263 n10,
1264 v10,
1265 n11,
1266 v11,
1267 n12,
1268 v12,
1269 n13,
1270 v13,
1271 n14,
1272 v14,
1273 n15,
1274 v15);
1275 static newLiteral17(
1276 String n0,
1277 v0,
1278 String n1,
1279 v1,
1280 String n2,
1281 v2,
1282 String n3,
1283 v3,
1284 String n4,
1285 v4,
1286 String n5,
1287 v5,
1288 String n6,
1289 v6,
1290 String n7,
1291 v7,
1292 String n8,
1293 v8,
1294 String n9,
1295 v9,
1296 String n10,
1297 v10,
1298 String n11,
1299 v11,
1300 String n12,
1301 v12,
1302 String n13,
1303 v13,
1304 String n14,
1305 v14,
1306 String n15,
1307 v15,
1308 String n16,
1309 v16) =>
1310 JS(
1311 'JavaScriptObject',
1312 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#}',
1313 n0,
1314 v0,
1315 n1,
1316 v1,
1317 n2,
1318 v2,
1319 n3,
1320 v3,
1321 n4,
1322 v4,
1323 n5,
1324 v5,
1325 n6,
1326 v6,
1327 n7,
1328 v7,
1329 n8,
1330 v8,
1331 n9,
1332 v9,
1333 n10,
1334 v10,
1335 n11,
1336 v11,
1337 n12,
1338 v12,
1339 n13,
1340 v13,
1341 n14,
1342 v14,
1343 n15,
1344 v15,
1345 n16,
1346 v16);
1347 static newLiteral18(
1348 String n0,
1349 v0,
1350 String n1,
1351 v1,
1352 String n2,
1353 v2,
1354 String n3,
1355 v3,
1356 String n4,
1357 v4,
1358 String n5,
1359 v5,
1360 String n6,
1361 v6,
1362 String n7,
1363 v7,
1364 String n8,
1365 v8,
1366 String n9,
1367 v9,
1368 String n10,
1369 v10,
1370 String n11,
1371 v11,
1372 String n12,
1373 v12,
1374 String n13,
1375 v13,
1376 String n14,
1377 v14,
1378 String n15,
1379 v15,
1380 String n16,
1381 v16,
1382 String n17,
1383 v17) =>
1384 JS(
1385 'JavaScriptObject',
1386 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#}',
1387 n0,
1388 v0,
1389 n1,
1390 v1,
1391 n2,
1392 v2,
1393 n3,
1394 v3,
1395 n4,
1396 v4,
1397 n5,
1398 v5,
1399 n6,
1400 v6,
1401 n7,
1402 v7,
1403 n8,
1404 v8,
1405 n9,
1406 v9,
1407 n10,
1408 v10,
1409 n11,
1410 v11,
1411 n12,
1412 v12,
1413 n13,
1414 v13,
1415 n14,
1416 v14,
1417 n15,
1418 v15,
1419 n16,
1420 v16,
1421 n17,
1422 v17);
1423 static newLiteral19(
1424 String n0,
1425 v0,
1426 String n1,
1427 v1,
1428 String n2,
1429 v2,
1430 String n3,
1431 v3,
1432 String n4,
1433 v4,
1434 String n5,
1435 v5,
1436 String n6,
1437 v6,
1438 String n7,
1439 v7,
1440 String n8,
1441 v8,
1442 String n9,
1443 v9,
1444 String n10,
1445 v10,
1446 String n11,
1447 v11,
1448 String n12,
1449 v12,
1450 String n13,
1451 v13,
1452 String n14,
1453 v14,
1454 String n15,
1455 v15,
1456 String n16,
1457 v16,
1458 String n17,
1459 v17,
1460 String n18,
1461 v18) =>
1462 JS(
1463 'JavaScriptObject',
1464 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#}',
1465 n0,
1466 v0,
1467 n1,
1468 v1,
1469 n2,
1470 v2,
1471 n3,
1472 v3,
1473 n4,
1474 v4,
1475 n5,
1476 v5,
1477 n6,
1478 v6,
1479 n7,
1480 v7,
1481 n8,
1482 v8,
1483 n9,
1484 v9,
1485 n10,
1486 v10,
1487 n11,
1488 v11,
1489 n12,
1490 v12,
1491 n13,
1492 v13,
1493 n14,
1494 v14,
1495 n15,
1496 v15,
1497 n16,
1498 v16,
1499 n17,
1500 v17,
1501 n18,
1502 v18);
1503 static newLiteral20(
1504 String n0,
1505 v0,
1506 String n1,
1507 v1,
1508 String n2,
1509 v2,
1510 String n3,
1511 v3,
1512 String n4,
1513 v4,
1514 String n5,
1515 v5,
1516 String n6,
1517 v6,
1518 String n7,
1519 v7,
1520 String n8,
1521 v8,
1522 String n9,
1523 v9,
1524 String n10,
1525 v10,
1526 String n11,
1527 v11,
1528 String n12,
1529 v12,
1530 String n13,
1531 v13,
1532 String n14,
1533 v14,
1534 String n15,
1535 v15,
1536 String n16,
1537 v16,
1538 String n17,
1539 v17,
1540 String n18,
1541 v18,
1542 String n19,
1543 v19) =>
1544 JS(
1545 'JavaScriptObject',
1546 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#}',
1547 n0,
1548 v0,
1549 n1,
1550 v1,
1551 n2,
1552 v2,
1553 n3,
1554 v3,
1555 n4,
1556 v4,
1557 n5,
1558 v5,
1559 n6,
1560 v6,
1561 n7,
1562 v7,
1563 n8,
1564 v8,
1565 n9,
1566 v9,
1567 n10,
1568 v10,
1569 n11,
1570 v11,
1571 n12,
1572 v12,
1573 n13,
1574 v13,
1575 n14,
1576 v14,
1577 n15,
1578 v15,
1579 n16,
1580 v16,
1581 n17,
1582 v17,
1583 n18,
1584 v18,
1585 n19,
1586 v19);
1587 static newLiteral21(
1588 String n0,
1589 v0,
1590 String n1,
1591 v1,
1592 String n2,
1593 v2,
1594 String n3,
1595 v3,
1596 String n4,
1597 v4,
1598 String n5,
1599 v5,
1600 String n6,
1601 v6,
1602 String n7,
1603 v7,
1604 String n8,
1605 v8,
1606 String n9,
1607 v9,
1608 String n10,
1609 v10,
1610 String n11,
1611 v11,
1612 String n12,
1613 v12,
1614 String n13,
1615 v13,
1616 String n14,
1617 v14,
1618 String n15,
1619 v15,
1620 String n16,
1621 v16,
1622 String n17,
1623 v17,
1624 String n18,
1625 v18,
1626 String n19,
1627 v19,
1628 String n20,
1629 v20) =>
1630 JS(
1631 'JavaScriptObject',
1632 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
1633 n0,
1634 v0,
1635 n1,
1636 v1,
1637 n2,
1638 v2,
1639 n3,
1640 v3,
1641 n4,
1642 v4,
1643 n5,
1644 v5,
1645 n6,
1646 v6,
1647 n7,
1648 v7,
1649 n8,
1650 v8,
1651 n9,
1652 v9,
1653 n10,
1654 v10,
1655 n11,
1656 v11,
1657 n12,
1658 v12,
1659 n13,
1660 v13,
1661 n14,
1662 v14,
1663 n15,
1664 v15,
1665 n16,
1666 v16,
1667 n17,
1668 v17,
1669 n18,
1670 v18,
1671 n19,
1672 v19,
1673 n20,
1674 v20);
1675 static newLiteral22(
1676 String n0,
1677 v0,
1678 String n1,
1679 v1,
1680 String n2,
1681 v2,
1682 String n3,
1683 v3,
1684 String n4,
1685 v4,
1686 String n5,
1687 v5,
1688 String n6,
1689 v6,
1690 String n7,
1691 v7,
1692 String n8,
1693 v8,
1694 String n9,
1695 v9,
1696 String n10,
1697 v10,
1698 String n11,
1699 v11,
1700 String n12,
1701 v12,
1702 String n13,
1703 v13,
1704 String n14,
1705 v14,
1706 String n15,
1707 v15,
1708 String n16,
1709 v16,
1710 String n17,
1711 v17,
1712 String n18,
1713 v18,
1714 String n19,
1715 v19,
1716 String n20,
1717 v20,
1718 String n21,
1719 v21) =>
1720 JS(
1721 'JavaScriptObject',
1722 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
1723 n0,
1724 v0,
1725 n1,
1726 v1,
1727 n2,
1728 v2,
1729 n3,
1730 v3,
1731 n4,
1732 v4,
1733 n5,
1734 v5,
1735 n6,
1736 v6,
1737 n7,
1738 v7,
1739 n8,
1740 v8,
1741 n9,
1742 v9,
1743 n10,
1744 v10,
1745 n11,
1746 v11,
1747 n12,
1748 v12,
1749 n13,
1750 v13,
1751 n14,
1752 v14,
1753 n15,
1754 v15,
1755 n16,
1756 v16,
1757 n17,
1758 v17,
1759 n18,
1760 v18,
1761 n19,
1762 v19,
1763 n20,
1764 v20,
1765 n21,
1766 v21);
1767 static newLiteral23(
1768 String n0,
1769 v0,
1770 String n1,
1771 v1,
1772 String n2,
1773 v2,
1774 String n3,
1775 v3,
1776 String n4,
1777 v4,
1778 String n5,
1779 v5,
1780 String n6,
1781 v6,
1782 String n7,
1783 v7,
1784 String n8,
1785 v8,
1786 String n9,
1787 v9,
1788 String n10,
1789 v10,
1790 String n11,
1791 v11,
1792 String n12,
1793 v12,
1794 String n13,
1795 v13,
1796 String n14,
1797 v14,
1798 String n15,
1799 v15,
1800 String n16,
1801 v16,
1802 String n17,
1803 v17,
1804 String n18,
1805 v18,
1806 String n19,
1807 v19,
1808 String n20,
1809 v20,
1810 String n21,
1811 v21,
1812 String n22,
1813 v22) =>
1814 JS(
1815 'JavaScriptObject',
1816 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
1817 n0,
1818 v0,
1819 n1,
1820 v1,
1821 n2,
1822 v2,
1823 n3,
1824 v3,
1825 n4,
1826 v4,
1827 n5,
1828 v5,
1829 n6,
1830 v6,
1831 n7,
1832 v7,
1833 n8,
1834 v8,
1835 n9,
1836 v9,
1837 n10,
1838 v10,
1839 n11,
1840 v11,
1841 n12,
1842 v12,
1843 n13,
1844 v13,
1845 n14,
1846 v14,
1847 n15,
1848 v15,
1849 n16,
1850 v16,
1851 n17,
1852 v17,
1853 n18,
1854 v18,
1855 n19,
1856 v19,
1857 n20,
1858 v20,
1859 n21,
1860 v21,
1861 n22,
1862 v22);
1863 static newLiteral24(
1864 String n0,
1865 v0,
1866 String n1,
1867 v1,
1868 String n2,
1869 v2,
1870 String n3,
1871 v3,
1872 String n4,
1873 v4,
1874 String n5,
1875 v5,
1876 String n6,
1877 v6,
1878 String n7,
1879 v7,
1880 String n8,
1881 v8,
1882 String n9,
1883 v9,
1884 String n10,
1885 v10,
1886 String n11,
1887 v11,
1888 String n12,
1889 v12,
1890 String n13,
1891 v13,
1892 String n14,
1893 v14,
1894 String n15,
1895 v15,
1896 String n16,
1897 v16,
1898 String n17,
1899 v17,
1900 String n18,
1901 v18,
1902 String n19,
1903 v19,
1904 String n20,
1905 v20,
1906 String n21,
1907 v21,
1908 String n22,
1909 v22,
1910 String n23,
1911 v23) =>
1912 JS(
1913 'JavaScriptObject',
1914 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
1915 n0,
1916 v0,
1917 n1,
1918 v1,
1919 n2,
1920 v2,
1921 n3,
1922 v3,
1923 n4,
1924 v4,
1925 n5,
1926 v5,
1927 n6,
1928 v6,
1929 n7,
1930 v7,
1931 n8,
1932 v8,
1933 n9,
1934 v9,
1935 n10,
1936 v10,
1937 n11,
1938 v11,
1939 n12,
1940 v12,
1941 n13,
1942 v13,
1943 n14,
1944 v14,
1945 n15,
1946 v15,
1947 n16,
1948 v16,
1949 n17,
1950 v17,
1951 n18,
1952 v18,
1953 n19,
1954 v19,
1955 n20,
1956 v20,
1957 n21,
1958 v21,
1959 n22,
1960 v22,
1961 n23,
1962 v23);
1963 static newLiteral25(
1964 String n0,
1965 v0,
1966 String n1,
1967 v1,
1968 String n2,
1969 v2,
1970 String n3,
1971 v3,
1972 String n4,
1973 v4,
1974 String n5,
1975 v5,
1976 String n6,
1977 v6,
1978 String n7,
1979 v7,
1980 String n8,
1981 v8,
1982 String n9,
1983 v9,
1984 String n10,
1985 v10,
1986 String n11,
1987 v11,
1988 String n12,
1989 v12,
1990 String n13,
1991 v13,
1992 String n14,
1993 v14,
1994 String n15,
1995 v15,
1996 String n16,
1997 v16,
1998 String n17,
1999 v17,
2000 String n18,
2001 v18,
2002 String n19,
2003 v19,
2004 String n20,
2005 v20,
2006 String n21,
2007 v21,
2008 String n22,
2009 v22,
2010 String n23,
2011 v23,
2012 String n24,
2013 v24) =>
2014 JS(
2015 'JavaScriptObject',
2016 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
2017 n0,
2018 v0,
2019 n1,
2020 v1,
2021 n2,
2022 v2,
2023 n3,
2024 v3,
2025 n4,
2026 v4,
2027 n5,
2028 v5,
2029 n6,
2030 v6,
2031 n7,
2032 v7,
2033 n8,
2034 v8,
2035 n9,
2036 v9,
2037 n10,
2038 v10,
2039 n11,
2040 v11,
2041 n12,
2042 v12,
2043 n13,
2044 v13,
2045 n14,
2046 v14,
2047 n15,
2048 v15,
2049 n16,
2050 v16,
2051 n17,
2052 v17,
2053 n18,
2054 v18,
2055 n19,
2056 v19,
2057 n20,
2058 v20,
2059 n21,
2060 v21,
2061 n22,
2062 v22,
2063 n23,
2064 v23,
2065 n24,
2066 v24);
2067 static newLiteral26(
2068 String n0,
2069 v0,
2070 String n1,
2071 v1,
2072 String n2,
2073 v2,
2074 String n3,
2075 v3,
2076 String n4,
2077 v4,
2078 String n5,
2079 v5,
2080 String n6,
2081 v6,
2082 String n7,
2083 v7,
2084 String n8,
2085 v8,
2086 String n9,
2087 v9,
2088 String n10,
2089 v10,
2090 String n11,
2091 v11,
2092 String n12,
2093 v12,
2094 String n13,
2095 v13,
2096 String n14,
2097 v14,
2098 String n15,
2099 v15,
2100 String n16,
2101 v16,
2102 String n17,
2103 v17,
2104 String n18,
2105 v18,
2106 String n19,
2107 v19,
2108 String n20,
2109 v20,
2110 String n21,
2111 v21,
2112 String n22,
2113 v22,
2114 String n23,
2115 v23,
2116 String n24,
2117 v24,
2118 String n25,
2119 v25) =>
2120 JS(
2121 'JavaScriptObject',
2122 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
2123 n0,
2124 v0,
2125 n1,
2126 v1,
2127 n2,
2128 v2,
2129 n3,
2130 v3,
2131 n4,
2132 v4,
2133 n5,
2134 v5,
2135 n6,
2136 v6,
2137 n7,
2138 v7,
2139 n8,
2140 v8,
2141 n9,
2142 v9,
2143 n10,
2144 v10,
2145 n11,
2146 v11,
2147 n12,
2148 v12,
2149 n13,
2150 v13,
2151 n14,
2152 v14,
2153 n15,
2154 v15,
2155 n16,
2156 v16,
2157 n17,
2158 v17,
2159 n18,
2160 v18,
2161 n19,
2162 v19,
2163 n20,
2164 v20,
2165 n21,
2166 v21,
2167 n22,
2168 v22,
2169 n23,
2170 v23,
2171 n24,
2172 v24,
2173 n25,
2174 v25);
2175 static newLiteral27(
2176 String n0,
2177 v0,
2178 String n1,
2179 v1,
2180 String n2,
2181 v2,
2182 String n3,
2183 v3,
2184 String n4,
2185 v4,
2186 String n5,
2187 v5,
2188 String n6,
2189 v6,
2190 String n7,
2191 v7,
2192 String n8,
2193 v8,
2194 String n9,
2195 v9,
2196 String n10,
2197 v10,
2198 String n11,
2199 v11,
2200 String n12,
2201 v12,
2202 String n13,
2203 v13,
2204 String n14,
2205 v14,
2206 String n15,
2207 v15,
2208 String n16,
2209 v16,
2210 String n17,
2211 v17,
2212 String n18,
2213 v18,
2214 String n19,
2215 v19,
2216 String n20,
2217 v20,
2218 String n21,
2219 v21,
2220 String n22,
2221 v22,
2222 String n23,
2223 v23,
2224 String n24,
2225 v24,
2226 String n25,
2227 v25,
2228 String n26,
2229 v26) =>
2230 JS(
2231 'JavaScriptObject',
2232 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
2233 n0,
2234 v0,
2235 n1,
2236 v1,
2237 n2,
2238 v2,
2239 n3,
2240 v3,
2241 n4,
2242 v4,
2243 n5,
2244 v5,
2245 n6,
2246 v6,
2247 n7,
2248 v7,
2249 n8,
2250 v8,
2251 n9,
2252 v9,
2253 n10,
2254 v10,
2255 n11,
2256 v11,
2257 n12,
2258 v12,
2259 n13,
2260 v13,
2261 n14,
2262 v14,
2263 n15,
2264 v15,
2265 n16,
2266 v16,
2267 n17,
2268 v17,
2269 n18,
2270 v18,
2271 n19,
2272 v19,
2273 n20,
2274 v20,
2275 n21,
2276 v21,
2277 n22,
2278 v22,
2279 n23,
2280 v23,
2281 n24,
2282 v24,
2283 n25,
2284 v25,
2285 n26,
2286 v26);
2287 static newLiteral28(
2288 String n0,
2289 v0,
2290 String n1,
2291 v1,
2292 String n2,
2293 v2,
2294 String n3,
2295 v3,
2296 String n4,
2297 v4,
2298 String n5,
2299 v5,
2300 String n6,
2301 v6,
2302 String n7,
2303 v7,
2304 String n8,
2305 v8,
2306 String n9,
2307 v9,
2308 String n10,
2309 v10,
2310 String n11,
2311 v11,
2312 String n12,
2313 v12,
2314 String n13,
2315 v13,
2316 String n14,
2317 v14,
2318 String n15,
2319 v15,
2320 String n16,
2321 v16,
2322 String n17,
2323 v17,
2324 String n18,
2325 v18,
2326 String n19,
2327 v19,
2328 String n20,
2329 v20,
2330 String n21,
2331 v21,
2332 String n22,
2333 v22,
2334 String n23,
2335 v23,
2336 String n24,
2337 v24,
2338 String n25,
2339 v25,
2340 String n26,
2341 v26,
2342 String n27,
2343 v27) =>
2344 JS(
2345 'JavaScriptObject',
2346 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
2347 n0,
2348 v0,
2349 n1,
2350 v1,
2351 n2,
2352 v2,
2353 n3,
2354 v3,
2355 n4,
2356 v4,
2357 n5,
2358 v5,
2359 n6,
2360 v6,
2361 n7,
2362 v7,
2363 n8,
2364 v8,
2365 n9,
2366 v9,
2367 n10,
2368 v10,
2369 n11,
2370 v11,
2371 n12,
2372 v12,
2373 n13,
2374 v13,
2375 n14,
2376 v14,
2377 n15,
2378 v15,
2379 n16,
2380 v16,
2381 n17,
2382 v17,
2383 n18,
2384 v18,
2385 n19,
2386 v19,
2387 n20,
2388 v20,
2389 n21,
2390 v21,
2391 n22,
2392 v22,
2393 n23,
2394 v23,
2395 n24,
2396 v24,
2397 n25,
2398 v25,
2399 n26,
2400 v26,
2401 n27,
2402 v27);
2403 static newLiteral29(
2404 String n0,
2405 v0,
2406 String n1,
2407 v1,
2408 String n2,
2409 v2,
2410 String n3,
2411 v3,
2412 String n4,
2413 v4,
2414 String n5,
2415 v5,
2416 String n6,
2417 v6,
2418 String n7,
2419 v7,
2420 String n8,
2421 v8,
2422 String n9,
2423 v9,
2424 String n10,
2425 v10,
2426 String n11,
2427 v11,
2428 String n12,
2429 v12,
2430 String n13,
2431 v13,
2432 String n14,
2433 v14,
2434 String n15,
2435 v15,
2436 String n16,
2437 v16,
2438 String n17,
2439 v17,
2440 String n18,
2441 v18,
2442 String n19,
2443 v19,
2444 String n20,
2445 v20,
2446 String n21,
2447 v21,
2448 String n22,
2449 v22,
2450 String n23,
2451 v23,
2452 String n24,
2453 v24,
2454 String n25,
2455 v25,
2456 String n26,
2457 v26,
2458 String n27,
2459 v27,
2460 String n28,
2461 v28) =>
2462 JS(
2463 'JavaScriptObject',
2464 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#}',
2465 n0,
2466 v0,
2467 n1,
2468 v1,
2469 n2,
2470 v2,
2471 n3,
2472 v3,
2473 n4,
2474 v4,
2475 n5,
2476 v5,
2477 n6,
2478 v6,
2479 n7,
2480 v7,
2481 n8,
2482 v8,
2483 n9,
2484 v9,
2485 n10,
2486 v10,
2487 n11,
2488 v11,
2489 n12,
2490 v12,
2491 n13,
2492 v13,
2493 n14,
2494 v14,
2495 n15,
2496 v15,
2497 n16,
2498 v16,
2499 n17,
2500 v17,
2501 n18,
2502 v18,
2503 n19,
2504 v19,
2505 n20,
2506 v20,
2507 n21,
2508 v21,
2509 n22,
2510 v22,
2511 n23,
2512 v23,
2513 n24,
2514 v24,
2515 n25,
2516 v25,
2517 n26,
2518 v26,
2519 n27,
2520 v27,
2521 n28,
2522 v28);
2523 static newLiteral30(
2524 String n0,
2525 v0,
2526 String n1,
2527 v1,
2528 String n2,
2529 v2,
2530 String n3,
2531 v3,
2532 String n4,
2533 v4,
2534 String n5,
2535 v5,
2536 String n6,
2537 v6,
2538 String n7,
2539 v7,
2540 String n8,
2541 v8,
2542 String n9,
2543 v9,
2544 String n10,
2545 v10,
2546 String n11,
2547 v11,
2548 String n12,
2549 v12,
2550 String n13,
2551 v13,
2552 String n14,
2553 v14,
2554 String n15,
2555 v15,
2556 String n16,
2557 v16,
2558 String n17,
2559 v17,
2560 String n18,
2561 v18,
2562 String n19,
2563 v19,
2564 String n20,
2565 v20,
2566 String n21,
2567 v21,
2568 String n22,
2569 v22,
2570 String n23,
2571 v23,
2572 String n24,
2573 v24,
2574 String n25,
2575 v25,
2576 String n26,
2577 v26,
2578 String n27,
2579 v27,
2580 String n28,
2581 v28,
2582 String n29,
2583 v29) =>
2584 JS(
2585 'JavaScriptObject',
2586 '{#:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# , #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:#, #:# }',
2587 n0,
2588 v0,
2589 n1,
2590 v1,
2591 n2,
2592 v2,
2593 n3,
2594 v3,
2595 n4,
2596 v4,
2597 n5,
2598 v5,
2599 n6,
2600 v6,
2601 n7,
2602 v7,
2603 n8,
2604 v8,
2605 n9,
2606 v9,
2607 n10,
2608 v10,
2609 n11,
2610 v11,
2611 n12,
2612 v12,
2613 n13,
2614 v13,
2615 n14,
2616 v14,
2617 n15,
2618 v15,
2619 n16,
2620 v16,
2621 n17,
2622 v17,
2623 n18,
2624 v18,
2625 n19,
2626 v19,
2627 n20,
2628 v20,
2629 n21,
2630 v21,
2631 n22,
2632 v22,
2633 n23,
2634 v23,
2635 n24,
2636 v24,
2637 n25,
2638 v25,
2639 n26,
2640 v26,
2641 n27,
2642 v27,
2643 n28,
2644 v28,
2645 n29,
2646 v29);
2647
2648 static callFunction0(fn) => JS('', '#()', fn);
2649 static callFunction1(fn, a) => JS('', '#(#)', fn, a);
2650 static callFunction2(fn, a, b) => JS('', '#(#, #)', fn, a, b);
2651 static callFunction3(fn, a, b, c) => JS('', '#(#, #, #)', fn, a, b, c);
2652 static callFunction4(fn, a, b, c, d) =>
2653 JS('', '#(#, #, #, #)', fn, a, b, c, d);
2654 static callFunction5(fn, a, b, c, d, e) =>
2655 JS('', '#(#, #, #, #, #)', fn, a, b, c, d, e);
2656 static callFunction6(fn, a, b, c, d, e, f) =>
2657 JS('', '#(#, #, #, #, #, #)', fn, a, b, c, d, e, f);
2658 static callFunction7(fn, a, b, c, d, e, f, g) =>
2659 JS('', '#(#, #, #, #, #, #, #)', fn, a, b, c, d, e, f, g);
2660 static callFunction8(fn, a, b, c, d, e, f, g, h) =>
2661 JS('', '#(#, #, #, #, #, #, #, #)', fn, a, b, c, d, e, f, g, h);
2662 static callFunction9(fn, a, b, c, d, e, f, g, h, i) =>
2663 JS('', '#(#, #, #, #, #, #, #, #, #)', fn, a, b, c, d, e, f, g, h, i);
2664
2665 static callConstructor0(fn) => JS('', 'new #()', fn);
2666 static callConstructor1(fn, a) => JS('', 'new #(#)', fn, a);
2667 static callConstructor2(fn, a, b) => JS('', 'new #(#, #)', fn, a, b);
2668 static callConstructor3(fn, a, b, c) => JS('', 'new #(#, #, #)', fn, a, b, c);
2669 static callConstructor4(fn, a, b, c, d) =>
2670 JS('', 'new #(#, #, #, #)', fn, a, b, c, d);
2671 static callConstructor5(fn, a, b, c, d, e) =>
2672 JS('', 'new #(#, #, #, #, #)', fn, a, b, c, d, e);
2673 static callConstructor6(fn, a, b, c, d, e, f) =>
2674 JS('', 'new #(#, #, #, #, #, #)', fn, a, b, c, d, e, f);
2675 static callConstructor7(fn, a, b, c, d, e, f, g) =>
2676 JS('', 'new #(#, #, #, #, #, #, #)', fn, a, b, c, d, e, f, g);
2677 static callConstructor8(fn, a, b, c, d, e, f, g, h) =>
2678 JS('', 'new #(#, #, #, #, #, #, #, #)', fn, a, b, c, d, e, f, g, h);
2679 static callConstructor9(fn, a, b, c, d, e, f, g, h, i) =>
2680 JS('', 'new #(#, #, #, #, #, #, #, #, #)', fn, a, b, c, d, e, f, g, h, i);
2681
2682 static callMethod0(o, method) => JS('', '#.#()', o, method);
2683 static callMethod1(o, method, a) => JS('', '#.#(#)', o, method, a);
2684 static callMethod2(o, method, a, b) => JS('', '#.#(#, #)', o, method, a, b);
2685 static callMethod3(o, method, a, b, c) =>
2686 JS('', '#.#(#, #, #)', o, method, a, b, c);
2687 static callMethod4(o, method, a, b, c, d) =>
2688 JS('', '#.#(#, #, #, #)', o, method, a, b, c, d);
2689 static callMethod5(o, method, a, b, c, d, e) =>
2690 JS('', '#.#(#, #, #, #, #)', o, method, a, b, c, d, e);
2691 static callMethod6(o, method, a, b, c, d, e, f) =>
2692 JS('', '#.#(#, #, #, #, #, #)', o, method, a, b, c, d, e, f);
2693 static callMethod7(o, method, a, b, c, d, e, f, g) =>
2694 JS('', '#.#(#, #, #, #, #, #, #)', o, method, a, b, c, d, e, f, g);
2695 static callMethod8(o, method, a, b, c, d, e, f, g, h) =>
2696 JS('', '#.#(#, #, #, #, #, #, #, #)', o, method, a, b, c, d, e, f, g, h);
2697 static callMethod9(o, method, a, b, c, d, e, f, g, h, i) => JS('',
2698 '#.#(#, #, #, #, #, #, #, #, #)', o, method, a, b, c, d, e, f, g, h, i);
2699
2700 // TODO(jacobr): should these helpers be moved somewhere else?
2701 // Unless we add a compiler feature, they could really be in user code.
2702 // These helpers all assume that optional arguments are specified by
2703 // JsNative.UNDEFINED.
2704
2705 static callFunction1Opt1(fn, a) {
2706 if (identical(a, UNDEFINED)) return callFunction0(fn);
2707 return callFunction1(fn, a);
2708 }
2709
2710 static callFunction2Opt1(fn, a, b) {
2711 if (identical(b, UNDEFINED)) return callFunction1(fn, a);
2712 return callFunction2(fn, a, b);
2713 }
2714
2715 static callFunction2Opt2(fn, a, b) {
2716 if (identical(a, UNDEFINED)) return callFunction0(fn);
2717 return callFunction2Opt1(fn, a, b);
2718 }
2719
2720 static callFunction3Opt1(fn, a, b, c) {
2721 if (identical(c, UNDEFINED)) return callFunction2(fn, a, b);
2722 return callFunction3(fn, a, b, c);
2723 }
2724
2725 static callFunction3Opt2(fn, a, b, c) {
2726 if (identical(b, UNDEFINED)) return callFunction1(fn, a);
2727 return callFunction3Opt1(fn, a, b, c);
2728 }
2729
2730 static callFunction3Opt3(fn, a, b, c) {
2731 if (identical(a, UNDEFINED)) return callFunction0(fn);
2732 return callFunction3Opt2(fn, a, b, c);
2733 }
2734
2735 static callFunction4Opt1(fn, a, b, c, d) {
2736 if (identical(d, UNDEFINED)) return callFunction3(fn, a, b, c);
2737 return callFunction4(fn, a, b, c, d);
2738 }
2739
2740 static callFunction4Opt2(fn, a, b, c, d) {
2741 if (identical(c, UNDEFINED)) return callFunction2(fn, a, b);
2742 return callFunction4Opt1(fn, a, b, c, d);
2743 }
2744
2745 static callFunction4Opt3(fn, a, b, c, d) {
2746 if (identical(b, UNDEFINED)) return callFunction1(fn, a);
2747 return callFunction4Opt2(fn, a, b, c, d);
2748 }
2749
2750 static callFunction4Opt4(fn, a, b, c, d) {
2751 if (identical(a, UNDEFINED)) return callFunction0(fn);
2752 return callFunction4Opt3(fn, a, b, c, d);
2753 }
2754
2755 static callFunction5Opt1(fn, a, b, c, d, e) {
2756 if (identical(e, UNDEFINED)) return callFunction4(fn, a, b, c, d);
2757 return callFunction5(fn, a, b, c, d, e);
2758 }
2759
2760 static callFunction5Opt2(fn, a, b, c, d, e) {
2761 if (identical(d, UNDEFINED)) return callFunction3(fn, a, b, c);
2762 return callFunction5Opt1(fn, a, b, c, d, e);
2763 }
2764
2765 static callFunction5Opt3(fn, a, b, c, d, e) {
2766 if (identical(c, UNDEFINED)) return callFunction2(fn, a, b);
2767 return callFunction5Opt2(fn, a, b, c, d, e);
2768 }
2769
2770 static callFunction5Opt4(fn, a, b, c, d, e) {
2771 if (identical(b, UNDEFINED)) return callFunction1(fn, a);
2772 return callFunction5Opt3(fn, a, b, c, d, e);
2773 }
2774
2775 static callFunction5Opt5(fn, a, b, c, d, e) {
2776 if (identical(a, UNDEFINED)) return callFunction0(fn);
2777 return callFunction5Opt4(fn, a, b, c, d, e);
2778 }
2779
2780 static callFunction6Opt1(fn, a, b, c, d, e, f) {
2781 if (identical(f, UNDEFINED)) return callFunction5(fn, a, b, c, d, e);
2782 return callFunction6(fn, a, b, c, d, e, f);
2783 }
2784
2785 static callFunction6Opt2(fn, a, b, c, d, e, f) {
2786 if (identical(e, UNDEFINED)) return callFunction4(fn, a, b, c, d);
2787 return callFunction6Opt1(fn, a, b, c, d, e, f);
2788 }
2789
2790 static callFunction6Opt3(fn, a, b, c, d, e, f) {
2791 if (identical(d, UNDEFINED)) return callFunction3(fn, a, b, c);
2792 return callFunction6Opt2(fn, a, b, c, d, e, f);
2793 }
2794
2795 static callFunction6Opt4(fn, a, b, c, d, e, f) {
2796 if (identical(c, UNDEFINED)) return callFunction2(fn, a, b);
2797 return callFunction6Opt3(fn, a, b, c, d, e, f);
2798 }
2799
2800 static callFunction6Opt5(fn, a, b, c, d, e, f) {
2801 if (identical(b, UNDEFINED)) return callFunction1(fn, a);
2802 return callFunction6Opt4(fn, a, b, c, d, e, f);
2803 }
2804
2805 static callFunction6Opt6(fn, a, b, c, d, e, f) {
2806 if (identical(a, UNDEFINED)) return callFunction0(fn);
2807 return callFunction6Opt5(fn, a, b, c, d, e, f);
2808 }
2809
2810 static callFunction7Opt1(fn, a, b, c, d, e, f, g) {
2811 if (identical(g, UNDEFINED)) return callFunction6(fn, a, b, c, d, e, f);
2812 return callFunction7(fn, a, b, c, d, e, f, g);
2813 }
2814
2815 static callFunction7Opt2(fn, a, b, c, d, e, f, g) {
2816 if (identical(f, UNDEFINED)) return callFunction5(fn, a, b, c, d, e);
2817 return callFunction7Opt1(fn, a, b, c, d, e, f, g);
2818 }
2819
2820 static callFunction7Opt3(fn, a, b, c, d, e, f, g) {
2821 if (identical(e, UNDEFINED)) return callFunction4(fn, a, b, c, d);
2822 return callFunction7Opt2(fn, a, b, c, d, e, f, g);
2823 }
2824
2825 static callFunction7Opt4(fn, a, b, c, d, e, f, g) {
2826 if (identical(d, UNDEFINED)) return callFunction3(fn, a, b, c);
2827 return callFunction7Opt3(fn, a, b, c, d, e, f, g);
2828 }
2829
2830 static callFunction7Opt5(fn, a, b, c, d, e, f, g) {
2831 if (identical(c, UNDEFINED)) return callFunction2(fn, a, b);
2832 return callFunction7Opt4(fn, a, b, c, d, e, f, g);
2833 }
2834
2835 static callFunction7Opt6(fn, a, b, c, d, e, f, g) {
2836 if (identical(b, UNDEFINED)) return callFunction1(fn, a);
2837 return callFunction7Opt5(fn, a, b, c, d, e, f, g);
2838 }
2839
2840 static callFunction7Opt7(fn, a, b, c, d, e, f, g) {
2841 if (identical(a, UNDEFINED)) return callFunction0(fn);
2842 return callFunction7Opt6(fn, a, b, c, d, e, f, g);
2843 }
2844
2845 static callFunction8Opt1(fn, a, b, c, d, e, f, g, h) {
2846 if (identical(h, UNDEFINED)) return callFunction7(fn, a, b, c, d, e, f, g);
2847 return callFunction8(fn, a, b, c, d, e, f, g, h);
2848 }
2849
2850 static callFunction8Opt2(fn, a, b, c, d, e, f, g, h) {
2851 if (identical(g, UNDEFINED)) return callFunction6(fn, a, b, c, d, e, f);
2852 return callFunction8Opt1(fn, a, b, c, d, e, f, g, h);
2853 }
2854
2855 static callFunction8Opt3(fn, a, b, c, d, e, f, g, h) {
2856 if (identical(f, UNDEFINED)) return callFunction5(fn, a, b, c, d, e);
2857 return callFunction8Opt2(fn, a, b, c, d, e, f, g, h);
2858 }
2859
2860 static callFunction8Opt4(fn, a, b, c, d, e, f, g, h) {
2861 if (identical(e, UNDEFINED)) return callFunction4(fn, a, b, c, d);
2862 return callFunction8Opt3(fn, a, b, c, d, e, f, g, h);
2863 }
2864
2865 static callFunction8Opt5(fn, a, b, c, d, e, f, g, h) {
2866 if (identical(d, UNDEFINED)) return callFunction3(fn, a, b, c);
2867 return callFunction8Opt4(fn, a, b, c, d, e, f, g, h);
2868 }
2869
2870 static callFunction8Opt6(fn, a, b, c, d, e, f, g, h) {
2871 if (identical(c, UNDEFINED)) return callFunction2(fn, a, b);
2872 return callFunction8Opt5(fn, a, b, c, d, e, f, g, h);
2873 }
2874
2875 static callFunction8Opt7(fn, a, b, c, d, e, f, g, h) {
2876 if (identical(b, UNDEFINED)) return callFunction1(fn, a);
2877 return callFunction8Opt6(fn, a, b, c, d, e, f, g, h);
2878 }
2879
2880 static callFunction8Opt8(fn, a, b, c, d, e, f, g, h) {
2881 if (identical(a, UNDEFINED)) return callFunction0(fn);
2882 return callFunction8Opt7(fn, a, b, c, d, e, f, g, h);
2883 }
2884
2885 static callFunction9Opt1(fn, a, b, c, d, e, f, g, h, i) {
2886 if (identical(i, UNDEFINED)) return callFunction8(
2887 fn, a, b, c, d, e, f, g, h);
2888 return callFunction9(fn, a, b, c, d, e, f, g, h, i);
2889 }
2890
2891 static callFunction9Opt2(fn, a, b, c, d, e, f, g, h, i) {
2892 if (identical(h, UNDEFINED)) return callFunction7(fn, a, b, c, d, e, f, g);
2893 return callFunction9Opt1(fn, a, b, c, d, e, f, g, h, i);
2894 }
2895
2896 static callFunction9Opt3(fn, a, b, c, d, e, f, g, h, i) {
2897 if (identical(g, UNDEFINED)) return callFunction6(fn, a, b, c, d, e, f);
2898 return callFunction9Opt2(fn, a, b, c, d, e, f, g, h, i);
2899 }
2900
2901 static callFunction9Opt4(fn, a, b, c, d, e, f, g, h, i) {
2902 if (identical(f, UNDEFINED)) return callFunction5(fn, a, b, c, d, e);
2903 return callFunction9Opt3(fn, a, b, c, d, e, f, g, h, i);
2904 }
2905
2906 static callFunction9Opt5(fn, a, b, c, d, e, f, g, h, i) {
2907 if (identical(e, UNDEFINED)) return callFunction4(fn, a, b, c, d);
2908 return callFunction9Opt4(fn, a, b, c, d, e, f, g, h, i);
2909 }
2910
2911 static callFunction9Opt6(fn, a, b, c, d, e, f, g, h, i) {
2912 if (identical(d, UNDEFINED)) return callFunction3(fn, a, b, c);
2913 return callFunction9Opt5(fn, a, b, c, d, e, f, g, h, i);
2914 }
2915
2916 static callFunction9Opt7(fn, a, b, c, d, e, f, g, h, i) {
2917 if (identical(c, UNDEFINED)) return callFunction2(fn, a, b);
2918 return callFunction9Opt6(fn, a, b, c, d, e, f, g, h, i);
2919 }
2920
2921 static callFunction9Opt8(fn, a, b, c, d, e, f, g, h, i) {
2922 if (identical(b, UNDEFINED)) return callFunction1(fn, a);
2923 return callFunction9Opt7(fn, a, b, c, d, e, f, g, h, i);
2924 }
2925
2926 static callFunction9Opt9(fn, a, b, c, d, e, f, g, h, i) {
2927 if (identical(a, UNDEFINED)) return callFunction0(fn);
2928 return callFunction9Opt8(fn, a, b, c, d, e, f, g, h, i);
2929 }
2930
2931 static callConstructor1Opt1(fn, a) {
2932 if (identical(a, UNDEFINED)) return callConstructor0(fn);
2933 return callConstructor1(fn, a);
2934 }
2935
2936 static callConstructor2Opt1(fn, a, b) {
2937 if (identical(b, UNDEFINED)) return callConstructor1(fn, a);
2938 return callConstructor2(fn, a, b);
2939 }
2940
2941 static callConstructor2Opt2(fn, a, b) {
2942 if (identical(a, UNDEFINED)) return callConstructor0(fn);
2943 return callConstructor2Opt1(fn, a, b);
2944 }
2945
2946 static callConstructor3Opt1(fn, a, b, c) {
2947 if (identical(c, UNDEFINED)) return callConstructor2(fn, a, b);
2948 return callConstructor3(fn, a, b, c);
2949 }
2950
2951 static callConstructor3Opt2(fn, a, b, c) {
2952 if (identical(b, UNDEFINED)) return callConstructor1(fn, a);
2953 return callConstructor3Opt1(fn, a, b, c);
2954 }
2955
2956 static callConstructor3Opt3(fn, a, b, c) {
2957 if (identical(a, UNDEFINED)) return callConstructor0(fn);
2958 return callConstructor3Opt2(fn, a, b, c);
2959 }
2960
2961 static callConstructor4Opt1(fn, a, b, c, d) {
2962 if (identical(d, UNDEFINED)) return callConstructor3(fn, a, b, c);
2963 return callConstructor4(fn, a, b, c, d);
2964 }
2965
2966 static callConstructor4Opt2(fn, a, b, c, d) {
2967 if (identical(c, UNDEFINED)) return callConstructor2(fn, a, b);
2968 return callConstructor4Opt1(fn, a, b, c, d);
2969 }
2970
2971 static callConstructor4Opt3(fn, a, b, c, d) {
2972 if (identical(b, UNDEFINED)) return callConstructor1(fn, a);
2973 return callConstructor4Opt2(fn, a, b, c, d);
2974 }
2975
2976 static callConstructor4Opt4(fn, a, b, c, d) {
2977 if (identical(a, UNDEFINED)) return callConstructor0(fn);
2978 return callConstructor4Opt3(fn, a, b, c, d);
2979 }
2980
2981 static callConstructor5Opt1(fn, a, b, c, d, e) {
2982 if (identical(e, UNDEFINED)) return callConstructor4(fn, a, b, c, d);
2983 return callConstructor5(fn, a, b, c, d, e);
2984 }
2985
2986 static callConstructor5Opt2(fn, a, b, c, d, e) {
2987 if (identical(d, UNDEFINED)) return callConstructor3(fn, a, b, c);
2988 return callConstructor5Opt1(fn, a, b, c, d, e);
2989 }
2990
2991 static callConstructor5Opt3(fn, a, b, c, d, e) {
2992 if (identical(c, UNDEFINED)) return callConstructor2(fn, a, b);
2993 return callConstructor5Opt2(fn, a, b, c, d, e);
2994 }
2995
2996 static callConstructor5Opt4(fn, a, b, c, d, e) {
2997 if (identical(b, UNDEFINED)) return callConstructor1(fn, a);
2998 return callConstructor5Opt3(fn, a, b, c, d, e);
2999 }
3000
3001 static callConstructor5Opt5(fn, a, b, c, d, e) {
3002 if (identical(a, UNDEFINED)) return callConstructor0(fn);
3003 return callConstructor5Opt4(fn, a, b, c, d, e);
3004 }
3005
3006 static callConstructor6Opt1(fn, a, b, c, d, e, f) {
3007 if (identical(f, UNDEFINED)) return callConstructor5(fn, a, b, c, d, e);
3008 return callConstructor6(fn, a, b, c, d, e, f);
3009 }
3010
3011 static callConstructor6Opt2(fn, a, b, c, d, e, f) {
3012 if (identical(e, UNDEFINED)) return callConstructor4(fn, a, b, c, d);
3013 return callConstructor6Opt1(fn, a, b, c, d, e, f);
3014 }
3015
3016 static callConstructor6Opt3(fn, a, b, c, d, e, f) {
3017 if (identical(d, UNDEFINED)) return callConstructor3(fn, a, b, c);
3018 return callConstructor6Opt2(fn, a, b, c, d, e, f);
3019 }
3020
3021 static callConstructor6Opt4(fn, a, b, c, d, e, f) {
3022 if (identical(c, UNDEFINED)) return callConstructor2(fn, a, b);
3023 return callConstructor6Opt3(fn, a, b, c, d, e, f);
3024 }
3025
3026 static callConstructor6Opt5(fn, a, b, c, d, e, f) {
3027 if (identical(b, UNDEFINED)) return callConstructor1(fn, a);
3028 return callConstructor6Opt4(fn, a, b, c, d, e, f);
3029 }
3030
3031 static callConstructor6Opt6(fn, a, b, c, d, e, f) {
3032 if (identical(a, UNDEFINED)) return callConstructor0(fn);
3033 return callConstructor6Opt5(fn, a, b, c, d, e, f);
3034 }
3035
3036 static callConstructor7Opt1(fn, a, b, c, d, e, f, g) {
3037 if (identical(g, UNDEFINED)) return callConstructor6(fn, a, b, c, d, e, f);
3038 return callConstructor7(fn, a, b, c, d, e, f, g);
3039 }
3040
3041 static callConstructor7Opt2(fn, a, b, c, d, e, f, g) {
3042 if (identical(f, UNDEFINED)) return callConstructor5(fn, a, b, c, d, e);
3043 return callConstructor7Opt1(fn, a, b, c, d, e, f, g);
3044 }
3045
3046 static callConstructor7Opt3(fn, a, b, c, d, e, f, g) {
3047 if (identical(e, UNDEFINED)) return callConstructor4(fn, a, b, c, d);
3048 return callConstructor7Opt2(fn, a, b, c, d, e, f, g);
3049 }
3050
3051 static callConstructor7Opt4(fn, a, b, c, d, e, f, g) {
3052 if (identical(d, UNDEFINED)) return callConstructor3(fn, a, b, c);
3053 return callConstructor7Opt3(fn, a, b, c, d, e, f, g);
3054 }
3055
3056 static callConstructor7Opt5(fn, a, b, c, d, e, f, g) {
3057 if (identical(c, UNDEFINED)) return callConstructor2(fn, a, b);
3058 return callConstructor7Opt4(fn, a, b, c, d, e, f, g);
3059 }
3060
3061 static callConstructor7Opt6(fn, a, b, c, d, e, f, g) {
3062 if (identical(b, UNDEFINED)) return callConstructor1(fn, a);
3063 return callConstructor7Opt5(fn, a, b, c, d, e, f, g);
3064 }
3065
3066 static callConstructor7Opt7(fn, a, b, c, d, e, f, g) {
3067 if (identical(a, UNDEFINED)) return callConstructor0(fn);
3068 return callConstructor7Opt6(fn, a, b, c, d, e, f, g);
3069 }
3070
3071 static callConstructor8Opt1(fn, a, b, c, d, e, f, g, h) {
3072 if (identical(h, UNDEFINED)) return callConstructor7(
3073 fn, a, b, c, d, e, f, g);
3074 return callConstructor8(fn, a, b, c, d, e, f, g, h);
3075 }
3076
3077 static callConstructor8Opt2(fn, a, b, c, d, e, f, g, h) {
3078 if (identical(g, UNDEFINED)) return callConstructor6(fn, a, b, c, d, e, f);
3079 return callConstructor8Opt1(fn, a, b, c, d, e, f, g, h);
3080 }
3081
3082 static callConstructor8Opt3(fn, a, b, c, d, e, f, g, h) {
3083 if (identical(f, UNDEFINED)) return callConstructor5(fn, a, b, c, d, e);
3084 return callConstructor8Opt2(fn, a, b, c, d, e, f, g, h);
3085 }
3086
3087 static callConstructor8Opt4(fn, a, b, c, d, e, f, g, h) {
3088 if (identical(e, UNDEFINED)) return callConstructor4(fn, a, b, c, d);
3089 return callConstructor8Opt3(fn, a, b, c, d, e, f, g, h);
3090 }
3091
3092 static callConstructor8Opt5(fn, a, b, c, d, e, f, g, h) {
3093 if (identical(d, UNDEFINED)) return callConstructor3(fn, a, b, c);
3094 return callConstructor8Opt4(fn, a, b, c, d, e, f, g, h);
3095 }
3096
3097 static callConstructor8Opt6(fn, a, b, c, d, e, f, g, h) {
3098 if (identical(c, UNDEFINED)) return callConstructor2(fn, a, b);
3099 return callConstructor8Opt5(fn, a, b, c, d, e, f, g, h);
3100 }
3101
3102 static callConstructor8Opt7(fn, a, b, c, d, e, f, g, h) {
3103 if (identical(b, UNDEFINED)) return callConstructor1(fn, a);
3104 return callConstructor8Opt6(fn, a, b, c, d, e, f, g, h);
3105 }
3106
3107 static callConstructor8Opt8(fn, a, b, c, d, e, f, g, h) {
3108 if (identical(a, UNDEFINED)) return callConstructor0(fn);
3109 return callConstructor8Opt7(fn, a, b, c, d, e, f, g, h);
3110 }
3111
3112 static callConstructor9Opt1(fn, a, b, c, d, e, f, g, h, i) {
3113 if (identical(i, UNDEFINED)) return callConstructor8(
3114 fn, a, b, c, d, e, f, g, h);
3115 return callConstructor9(fn, a, b, c, d, e, f, g, h, i);
3116 }
3117
3118 static callConstructor9Opt2(fn, a, b, c, d, e, f, g, h, i) {
3119 if (identical(h, UNDEFINED)) return callConstructor7(
3120 fn, a, b, c, d, e, f, g);
3121 return callConstructor9Opt1(fn, a, b, c, d, e, f, g, h, i);
3122 }
3123
3124 static callConstructor9Opt3(fn, a, b, c, d, e, f, g, h, i) {
3125 if (identical(g, UNDEFINED)) return callConstructor6(fn, a, b, c, d, e, f);
3126 return callConstructor9Opt2(fn, a, b, c, d, e, f, g, h, i);
3127 }
3128
3129 static callConstructor9Opt4(fn, a, b, c, d, e, f, g, h, i) {
3130 if (identical(f, UNDEFINED)) return callConstructor5(fn, a, b, c, d, e);
3131 return callConstructor9Opt3(fn, a, b, c, d, e, f, g, h, i);
3132 }
3133
3134 static callConstructor9Opt5(fn, a, b, c, d, e, f, g, h, i) {
3135 if (identical(e, UNDEFINED)) return callConstructor4(fn, a, b, c, d);
3136 return callConstructor9Opt4(fn, a, b, c, d, e, f, g, h, i);
3137 }
3138
3139 static callConstructor9Opt6(fn, a, b, c, d, e, f, g, h, i) {
3140 if (identical(d, UNDEFINED)) return callConstructor3(fn, a, b, c);
3141 return callConstructor9Opt5(fn, a, b, c, d, e, f, g, h, i);
3142 }
3143
3144 static callConstructor9Opt7(fn, a, b, c, d, e, f, g, h, i) {
3145 if (identical(c, UNDEFINED)) return callConstructor2(fn, a, b);
3146 return callConstructor9Opt6(fn, a, b, c, d, e, f, g, h, i);
3147 }
3148
3149 static callConstructor9Opt8(fn, a, b, c, d, e, f, g, h, i) {
3150 if (identical(b, UNDEFINED)) return callConstructor1(fn, a);
3151 return callConstructor9Opt7(fn, a, b, c, d, e, f, g, h, i);
3152 }
3153
3154 static callConstructor9Opt9(fn, a, b, c, d, e, f, g, h, i) {
3155 if (identical(a, UNDEFINED)) return callConstructor0(fn);
3156 return callConstructor9Opt8(fn, a, b, c, d, e, f, g, h, i);
3157 }
3158
3159 static callMethod1Opt1(o, method, a) {
3160 if (identical(a, UNDEFINED)) return callMethod0(o, method);
3161 return callMethod1(o, method, a);
3162 }
3163
3164 static callMethod2Opt1(o, method, a, b) {
3165 if (identical(b, UNDEFINED)) return callMethod1(o, method, a);
3166 return callMethod2(o, method, a, b);
3167 }
3168
3169 static callMethod2Opt2(o, method, a, b) {
3170 if (identical(a, UNDEFINED)) return callMethod0(o, method);
3171 return callMethod2Opt1(o, method, a, b);
3172 }
3173
3174 static callMethod3Opt1(o, method, a, b, c) {
3175 if (identical(c, UNDEFINED)) return callMethod2(o, method, a, b);
3176 return callMethod3(o, method, a, b, c);
3177 }
3178
3179 static callMethod3Opt2(o, method, a, b, c) {
3180 if (identical(b, UNDEFINED)) return callMethod1(o, method, a);
3181 return callMethod3Opt1(o, method, a, b, c);
3182 }
3183
3184 static callMethod3Opt3(o, method, a, b, c) {
3185 if (identical(a, UNDEFINED)) return callMethod0(o, method);
3186 return callMethod3Opt2(o, method, a, b, c);
3187 }
3188
3189 static callMethod4Opt1(o, method, a, b, c, d) {
3190 if (identical(d, UNDEFINED)) return callMethod3(o, method, a, b, c);
3191 return callMethod4(o, method, a, b, c, d);
3192 }
3193
3194 static callMethod4Opt2(o, method, a, b, c, d) {
3195 if (identical(c, UNDEFINED)) return callMethod2(o, method, a, b);
3196 return callMethod4Opt1(o, method, a, b, c, d);
3197 }
3198
3199 static callMethod4Opt3(o, method, a, b, c, d) {
3200 if (identical(b, UNDEFINED)) return callMethod1(o, method, a);
3201 return callMethod4Opt2(o, method, a, b, c, d);
3202 }
3203
3204 static callMethod4Opt4(o, method, a, b, c, d) {
3205 if (identical(a, UNDEFINED)) return callMethod0(o, method);
3206 return callMethod4Opt3(o, method, a, b, c, d);
3207 }
3208
3209 static callMethod5Opt1(o, method, a, b, c, d, e) {
3210 if (identical(e, UNDEFINED)) return callMethod4(o, method, a, b, c, d);
3211 return callMethod5(o, method, a, b, c, d, e);
3212 }
3213
3214 static callMethod5Opt2(o, method, a, b, c, d, e) {
3215 if (identical(d, UNDEFINED)) return callMethod3(o, method, a, b, c);
3216 return callMethod5Opt1(o, method, a, b, c, d, e);
3217 }
3218
3219 static callMethod5Opt3(o, method, a, b, c, d, e) {
3220 if (identical(c, UNDEFINED)) return callMethod2(o, method, a, b);
3221 return callMethod5Opt2(o, method, a, b, c, d, e);
3222 }
3223
3224 static callMethod5Opt4(o, method, a, b, c, d, e) {
3225 if (identical(b, UNDEFINED)) return callMethod1(o, method, a);
3226 return callMethod5Opt3(o, method, a, b, c, d, e);
3227 }
3228
3229 static callMethod5Opt5(o, method, a, b, c, d, e) {
3230 if (identical(a, UNDEFINED)) return callMethod0(o, method);
3231 return callMethod5Opt4(o, method, a, b, c, d, e);
3232 }
3233
3234 static callMethod6Opt1(o, method, a, b, c, d, e, f) {
3235 if (identical(f, UNDEFINED)) return callMethod5(o, method, a, b, c, d, e);
3236 return callMethod6(o, method, a, b, c, d, e, f);
3237 }
3238
3239 static callMethod6Opt2(o, method, a, b, c, d, e, f) {
3240 if (identical(e, UNDEFINED)) return callMethod4(o, method, a, b, c, d);
3241 return callMethod6Opt1(o, method, a, b, c, d, e, f);
3242 }
3243
3244 static callMethod6Opt3(o, method, a, b, c, d, e, f) {
3245 if (identical(d, UNDEFINED)) return callMethod3(o, method, a, b, c);
3246 return callMethod6Opt2(o, method, a, b, c, d, e, f);
3247 }
3248
3249 static callMethod6Opt4(o, method, a, b, c, d, e, f) {
3250 if (identical(c, UNDEFINED)) return callMethod2(o, method, a, b);
3251 return callMethod6Opt3(o, method, a, b, c, d, e, f);
3252 }
3253
3254 static callMethod6Opt5(o, method, a, b, c, d, e, f) {
3255 if (identical(b, UNDEFINED)) return callMethod1(o, method, a);
3256 return callMethod6Opt4(o, method, a, b, c, d, e, f);
3257 }
3258
3259 static callMethod6Opt6(o, method, a, b, c, d, e, f) {
3260 if (identical(a, UNDEFINED)) return callMethod0(o, method);
3261 return callMethod6Opt5(o, method, a, b, c, d, e, f);
3262 }
3263
3264 static callMethod7Opt1(o, method, a, b, c, d, e, f, g) {
3265 if (identical(g, UNDEFINED)) return callMethod6(
3266 o, method, a, b, c, d, e, f);
3267 return callMethod7(o, method, a, b, c, d, e, f, g);
3268 }
3269
3270 static callMethod7Opt2(o, method, a, b, c, d, e, f, g) {
3271 if (identical(f, UNDEFINED)) return callMethod5(o, method, a, b, c, d, e);
3272 return callMethod7Opt1(o, method, a, b, c, d, e, f, g);
3273 }
3274
3275 static callMethod7Opt3(o, method, a, b, c, d, e, f, g) {
3276 if (identical(e, UNDEFINED)) return callMethod4(o, method, a, b, c, d);
3277 return callMethod7Opt2(o, method, a, b, c, d, e, f, g);
3278 }
3279
3280 static callMethod7Opt4(o, method, a, b, c, d, e, f, g) {
3281 if (identical(d, UNDEFINED)) return callMethod3(o, method, a, b, c);
3282 return callMethod7Opt3(o, method, a, b, c, d, e, f, g);
3283 }
3284
3285 static callMethod7Opt5(o, method, a, b, c, d, e, f, g) {
3286 if (identical(c, UNDEFINED)) return callMethod2(o, method, a, b);
3287 return callMethod7Opt4(o, method, a, b, c, d, e, f, g);
3288 }
3289
3290 static callMethod7Opt6(o, method, a, b, c, d, e, f, g) {
3291 if (identical(b, UNDEFINED)) return callMethod1(o, method, a);
3292 return callMethod7Opt5(o, method, a, b, c, d, e, f, g);
3293 }
3294
3295 static callMethod7Opt7(o, method, a, b, c, d, e, f, g) {
3296 if (identical(a, UNDEFINED)) return callMethod0(o, method);
3297 return callMethod7Opt6(o, method, a, b, c, d, e, f, g);
3298 }
3299
3300 static callMethod8Opt1(o, method, a, b, c, d, e, f, g, h) {
3301 if (identical(h, UNDEFINED)) return callMethod7(
3302 o, method, a, b, c, d, e, f, g);
3303 return callMethod8(o, method, a, b, c, d, e, f, g, h);
3304 }
3305
3306 static callMethod8Opt2(o, method, a, b, c, d, e, f, g, h) {
3307 if (identical(g, UNDEFINED)) return callMethod6(
3308 o, method, a, b, c, d, e, f);
3309 return callMethod8Opt1(o, method, a, b, c, d, e, f, g, h);
3310 }
3311
3312 static callMethod8Opt3(o, method, a, b, c, d, e, f, g, h) {
3313 if (identical(f, UNDEFINED)) return callMethod5(o, method, a, b, c, d, e);
3314 return callMethod8Opt2(o, method, a, b, c, d, e, f, g, h);
3315 }
3316
3317 static callMethod8Opt4(o, method, a, b, c, d, e, f, g, h) {
3318 if (identical(e, UNDEFINED)) return callMethod4(o, method, a, b, c, d);
3319 return callMethod8Opt3(o, method, a, b, c, d, e, f, g, h);
3320 }
3321
3322 static callMethod8Opt5(o, method, a, b, c, d, e, f, g, h) {
3323 if (identical(d, UNDEFINED)) return callMethod3(o, method, a, b, c);
3324 return callMethod8Opt4(o, method, a, b, c, d, e, f, g, h);
3325 }
3326
3327 static callMethod8Opt6(o, method, a, b, c, d, e, f, g, h) {
3328 if (identical(c, UNDEFINED)) return callMethod2(o, method, a, b);
3329 return callMethod8Opt5(o, method, a, b, c, d, e, f, g, h);
3330 }
3331
3332 static callMethod8Opt7(o, method, a, b, c, d, e, f, g, h) {
3333 if (identical(b, UNDEFINED)) return callMethod1(o, method, a);
3334 return callMethod8Opt6(o, method, a, b, c, d, e, f, g, h);
3335 }
3336
3337 static callMethod8Opt8(o, method, a, b, c, d, e, f, g, h) {
3338 if (identical(a, UNDEFINED)) return callMethod0(o, method);
3339 return callMethod8Opt7(o, method, a, b, c, d, e, f, g, h);
3340 }
3341
3342 static callMethod9Opt1(o, method, a, b, c, d, e, f, g, h, i) {
3343 if (identical(i, UNDEFINED)) return callMethod8(
3344 o, method, a, b, c, d, e, f, g, h);
3345 return callMethod9(o, method, a, b, c, d, e, f, g, h, i);
3346 }
3347
3348 static callMethod9Opt2(o, method, a, b, c, d, e, f, g, h, i) {
3349 if (identical(h, UNDEFINED)) return callMethod7(
3350 o, method, a, b, c, d, e, f, g);
3351 return callMethod9Opt1(o, method, a, b, c, d, e, f, g, h, i);
3352 }
3353
3354 static callMethod9Opt3(o, method, a, b, c, d, e, f, g, h, i) {
3355 if (identical(g, UNDEFINED)) return callMethod6(
3356 o, method, a, b, c, d, e, f);
3357 return callMethod9Opt2(o, method, a, b, c, d, e, f, g, h, i);
3358 }
3359
3360 static callMethod9Opt4(o, method, a, b, c, d, e, f, g, h, i) {
3361 if (identical(f, UNDEFINED)) return callMethod5(o, method, a, b, c, d, e);
3362 return callMethod9Opt3(o, method, a, b, c, d, e, f, g, h, i);
3363 }
3364
3365 static callMethod9Opt5(o, method, a, b, c, d, e, f, g, h, i) {
3366 if (identical(e, UNDEFINED)) return callMethod4(o, method, a, b, c, d);
3367 return callMethod9Opt4(o, method, a, b, c, d, e, f, g, h, i);
3368 }
3369
3370 static callMethod9Opt6(o, method, a, b, c, d, e, f, g, h, i) {
3371 if (identical(d, UNDEFINED)) return callMethod3(o, method, a, b, c);
3372 return callMethod9Opt5(o, method, a, b, c, d, e, f, g, h, i);
3373 }
3374
3375 static callMethod9Opt7(o, method, a, b, c, d, e, f, g, h, i) {
3376 if (identical(c, UNDEFINED)) return callMethod2(o, method, a, b);
3377 return callMethod9Opt6(o, method, a, b, c, d, e, f, g, h, i);
3378 }
3379
3380 static callMethod9Opt8(o, method, a, b, c, d, e, f, g, h, i) {
3381 if (identical(b, UNDEFINED)) return callMethod1(o, method, a);
3382 return callMethod9Opt7(o, method, a, b, c, d, e, f, g, h, i);
3383 }
3384
3385 static callMethod9Opt9(o, method, a, b, c, d, e, f, g, h, i) {
3386 if (identical(a, UNDEFINED)) return callMethod0(o, method);
3387 return callMethod9Opt8(o, method, a, b, c, d, e, f, g, h, i);
3388 }
3389 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698