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

Side by Side Diff: lib/runtime/dart/_js_helper.js

Issue 1074923003: rename dart_runtime.js helpers (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 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 | « lib/runtime/dart/_isolate_helper.js ('k') | lib/runtime/dart/_native_typed_data.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var _js_helper; 1 var _js_helper;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 class NoSideEffects extends core.Object { 4 class NoSideEffects extends core.Object {
5 NoSideEffects() { 5 NoSideEffects() {
6 } 6 }
7 } 7 }
8 class NoThrows extends core.Object { 8 class NoThrows extends core.Object {
9 NoThrows() { 9 NoThrows() {
10 } 10 }
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 219 }
220 // Function getPropertyFromPrototype: (dynamic, String) → dynamic 220 // Function getPropertyFromPrototype: (dynamic, String) → dynamic
221 function getPropertyFromPrototype(object, name) { 221 function getPropertyFromPrototype(object, name) {
222 return Object.getPrototypeOf(object)[name]; 222 return Object.getPrototypeOf(object)[name];
223 } 223 }
224 exports.getTagFunction = null; 224 exports.getTagFunction = null;
225 exports.alternateTagFunction = null; 225 exports.alternateTagFunction = null;
226 exports.prototypeForTagFunction = null; 226 exports.prototypeForTagFunction = null;
227 // Function toStringForNativeObject: (dynamic) → String 227 // Function toStringForNativeObject: (dynamic) → String
228 function toStringForNativeObject(obj) { 228 function toStringForNativeObject(obj) {
229 let name = exports.getTagFunction == null ? '<Unknown>' : dart.dinvokef(expo rts.getTagFunction, obj); 229 let name = exports.getTagFunction == null ? '<Unknown>' : dart.dcall(exports .getTagFunction, obj);
230 return `Instance of ${name}`; 230 return `Instance of ${name}`;
231 } 231 }
232 // Function hashCodeForNativeObject: (dynamic) → int 232 // Function hashCodeForNativeObject: (dynamic) → int
233 function hashCodeForNativeObject(object) { 233 function hashCodeForNativeObject(object) {
234 return Primitives.objectHashCode(object); 234 return Primitives.objectHashCode(object);
235 } 235 }
236 // Function defineProperty: (dynamic, String, dynamic) → void 236 // Function defineProperty: (dynamic, String, dynamic) → void
237 function defineProperty(obj, property, value) { 237 function defineProperty(obj, property, value) {
238 Object.defineProperty(obj, property, {value: value, enumerable: false, writa ble: true, configurable: true}); 238 Object.defineProperty(obj, property, {value: value, enumerable: false, writa ble: true, configurable: true});
239 } 239 }
(...skipping 20 matching lines...) Expand all
260 return propertyGet(exports.interceptorsByTag, tag); 260 return propertyGet(exports.interceptorsByTag, tag);
261 } 261 }
262 let UNCACHED_MARK = '~'; 262 let UNCACHED_MARK = '~';
263 let INSTANCE_CACHED_MARK = '!'; 263 let INSTANCE_CACHED_MARK = '!';
264 let LEAF_MARK = '-'; 264 let LEAF_MARK = '-';
265 let INTERIOR_MARK = '+'; 265 let INTERIOR_MARK = '+';
266 let DISCRIMINATED_MARK = '*'; 266 let DISCRIMINATED_MARK = '*';
267 // Function lookupAndCacheInterceptor: (dynamic) → dynamic 267 // Function lookupAndCacheInterceptor: (dynamic) → dynamic
268 function lookupAndCacheInterceptor(obj) { 268 function lookupAndCacheInterceptor(obj) {
269 dart.assert(!dart.notNull(isDartObject(obj))); 269 dart.assert(!dart.notNull(isDartObject(obj)));
270 let tag = dart.as(dart.dinvokef(exports.getTagFunction, obj), core.String); 270 let tag = dart.as(dart.dcall(exports.getTagFunction, obj), core.String);
271 let record = propertyGet(exports.dispatchRecordsForInstanceTags, tag); 271 let record = propertyGet(exports.dispatchRecordsForInstanceTags, tag);
272 if (record != null) 272 if (record != null)
273 return patchInstance(obj, record); 273 return patchInstance(obj, record);
274 let interceptor = propertyGet(exports.interceptorsForUncacheableTags, tag); 274 let interceptor = propertyGet(exports.interceptorsForUncacheableTags, tag);
275 if (interceptor != null) 275 if (interceptor != null)
276 return interceptor; 276 return interceptor;
277 let interceptorClass = lookupInterceptor(tag); 277 let interceptorClass = lookupInterceptor(tag);
278 if (interceptorClass == null) { 278 if (interceptorClass == null) {
279 tag = dart.as(dart.dinvokef(exports.alternateTagFunction, obj, tag), core. String); 279 tag = dart.as(dart.dcall(exports.alternateTagFunction, obj, tag), core.Str ing);
280 if (tag != null) { 280 if (tag != null) {
281 record = propertyGet(exports.dispatchRecordsForInstanceTags, tag); 281 record = propertyGet(exports.dispatchRecordsForInstanceTags, tag);
282 if (record != null) 282 if (record != null)
283 return patchInstance(obj, record); 283 return patchInstance(obj, record);
284 interceptor = propertyGet(exports.interceptorsForUncacheableTags, tag); 284 interceptor = propertyGet(exports.interceptorsForUncacheableTags, tag);
285 if (interceptor != null) 285 if (interceptor != null)
286 return interceptor; 286 return interceptor;
287 interceptorClass = lookupInterceptor(tag); 287 interceptorClass = lookupInterceptor(tag);
288 } 288 }
289 } 289 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 exports.interceptorsForUncacheableTags = Object.create(null); 372 exports.interceptorsForUncacheableTags = Object.create(null);
373 initHooks(); 373 initHooks();
374 let map = exports.interceptorsByTag; 374 let map = exports.interceptorsByTag;
375 let tags = Object.getOwnPropertyNames(map); 375 let tags = Object.getOwnPropertyNames(map);
376 if (typeof window != "undefined") { 376 if (typeof window != "undefined") {
377 let context = window; 377 let context = window;
378 let fun = function() { 378 let fun = function() {
379 }; 379 };
380 for (let i = 0; i['<'](dart.dload(tags, 'length')); i = dart.notNull(i) + 1) { 380 for (let i = 0; i['<'](dart.dload(tags, 'length')); i = dart.notNull(i) + 1) {
381 let tag = dart.dindex(tags, i); 381 let tag = dart.dindex(tags, i);
382 let proto = dart.dinvokef(exports.prototypeForTagFunction, tag); 382 let proto = dart.dcall(exports.prototypeForTagFunction, tag);
383 if (proto != null) { 383 if (proto != null) {
384 let interceptorClass = map[tag]; 384 let interceptorClass = map[tag];
385 let record = makeDefaultDispatchRecord(tag, interceptorClass, proto); 385 let record = makeDefaultDispatchRecord(tag, interceptorClass, proto);
386 if (record != null) { 386 if (record != null) {
387 _interceptors.setDispatchProperty(proto, record); 387 _interceptors.setDispatchProperty(proto, record);
388 fun.prototype = proto; 388 fun.prototype = proto;
389 } 389 }
390 } 390 }
391 } 391 }
392 } 392 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 function regExpGetGlobalNative(regexp) { 458 function regExpGetGlobalNative(regexp) {
459 let nativeRegexp = regexp[_nativeGlobalVersion]; 459 let nativeRegexp = regexp[_nativeGlobalVersion];
460 nativeRegexp.lastIndex = 0; 460 nativeRegexp.lastIndex = 0;
461 return nativeRegexp; 461 return nativeRegexp;
462 } 462 }
463 let _nativeAnchoredVersion = Symbol('_nativeAnchoredVersion'); 463 let _nativeAnchoredVersion = Symbol('_nativeAnchoredVersion');
464 // Function regExpCaptureCount: (JSSyntaxRegExp) → int 464 // Function regExpCaptureCount: (JSSyntaxRegExp) → int
465 function regExpCaptureCount(regexp) { 465 function regExpCaptureCount(regexp) {
466 let nativeAnchoredRegExp = regexp[_nativeAnchoredVersion]; 466 let nativeAnchoredRegExp = regexp[_nativeAnchoredVersion];
467 let match = nativeAnchoredRegExp.exec(''); 467 let match = nativeAnchoredRegExp.exec('');
468 return dart.as(dart.dbinary(dart.dload(match, 'length'), '-', 2), core.int); 468 return dart.as(dart.dsend(dart.dload(match, 'length'), '-', 2), core.int);
469 } 469 }
470 let _nativeGlobalRegExp = Symbol('_nativeGlobalRegExp'); 470 let _nativeGlobalRegExp = Symbol('_nativeGlobalRegExp');
471 let _nativeAnchoredRegExp = Symbol('_nativeAnchoredRegExp'); 471 let _nativeAnchoredRegExp = Symbol('_nativeAnchoredRegExp');
472 let _isMultiLine = Symbol('_isMultiLine'); 472 let _isMultiLine = Symbol('_isMultiLine');
473 let _isCaseSensitive = Symbol('_isCaseSensitive'); 473 let _isCaseSensitive = Symbol('_isCaseSensitive');
474 let _execGlobal = Symbol('_execGlobal'); 474 let _execGlobal = Symbol('_execGlobal');
475 let _execAnchored = Symbol('_execAnchored'); 475 let _execAnchored = Symbol('_execAnchored');
476 class JSSyntaxRegExp extends core.Object { 476 class JSSyntaxRegExp extends core.Object {
477 toString() { 477 toString() {
478 return `RegExp/${this.pattern}/`; 478 return `RegExp/${this.pattern}/`;
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 startIndex = dart.notNull(startIndex) + 1; 714 startIndex = dart.notNull(startIndex) + 1;
715 } else { 715 } else {
716 startIndex = endIndex; 716 startIndex = endIndex;
717 } 717 }
718 } 718 }
719 return result; 719 return result;
720 } 720 }
721 // Function stringContainsUnchecked: (dynamic, dynamic, dynamic) → dynamic 721 // Function stringContainsUnchecked: (dynamic, dynamic, dynamic) → dynamic
722 function stringContainsUnchecked(receiver, other, startIndex) { 722 function stringContainsUnchecked(receiver, other, startIndex) {
723 if (typeof other == 'string') { 723 if (typeof other == 'string') {
724 return !dart.equals(dart.dinvoke(receiver, 'indexOf', other, startIndex), -1); 724 return !dart.equals(dart.dsend(receiver, 'indexOf', other, startIndex), -1 );
725 } else if (dart.is(other, JSSyntaxRegExp)) { 725 } else if (dart.is(other, JSSyntaxRegExp)) {
726 return dart.dinvoke(other, 'hasMatch', dart.dinvoke(receiver, 'substring', startIndex)); 726 return dart.dsend(other, 'hasMatch', dart.dsend(receiver, 'substring', sta rtIndex));
727 } else { 727 } else {
728 let substr = dart.dinvoke(receiver, 'substring', startIndex); 728 let substr = dart.dsend(receiver, 'substring', startIndex);
729 return dart.dload(dart.dinvoke(other, 'allMatches', substr), 'isNotEmpty') ; 729 return dart.dload(dart.dsend(other, 'allMatches', substr), 'isNotEmpty');
730 } 730 }
731 } 731 }
732 // Function stringReplaceJS: (dynamic, dynamic, dynamic) → dynamic 732 // Function stringReplaceJS: (dynamic, dynamic, dynamic) → dynamic
733 function stringReplaceJS(receiver, replacer, to) { 733 function stringReplaceJS(receiver, replacer, to) {
734 to = to.replace(/\$/g, "$$$$"); 734 to = to.replace(/\$/g, "$$$$");
735 return receiver.replace(replacer, to); 735 return receiver.replace(replacer, to);
736 } 736 }
737 // Function stringReplaceFirstRE: (dynamic, dynamic, dynamic, dynamic) → dynam ic 737 // Function stringReplaceFirstRE: (dynamic, dynamic, dynamic, dynamic) → dynam ic
738 function stringReplaceFirstRE(receiver, regexp, to, startIndex) { 738 function stringReplaceFirstRE(receiver, regexp, to, startIndex) {
739 let match = dart.dinvoke(regexp, '_execGlobal', receiver, startIndex); 739 let match = dart.dsend(regexp, '_execGlobal', receiver, startIndex);
740 if (match == null) 740 if (match == null)
741 return receiver; 741 return receiver;
742 let start = dart.dload(match, 'start'); 742 let start = dart.dload(match, 'start');
743 let end = dart.dload(match, 'end'); 743 let end = dart.dload(match, 'end');
744 return `${dart.dinvoke(receiver, 'substring', 0, start)}${to}${dart.dinvoke( receiver, 'substring', end)}`; 744 return `${dart.dsend(receiver, 'substring', 0, start)}${to}${dart.dsend(rece iver, 'substring', end)}`;
745 } 745 }
746 let ESCAPE_REGEXP = '[[\\]{}()*+?.\\\\^$|]'; 746 let ESCAPE_REGEXP = '[[\\]{}()*+?.\\\\^$|]';
747 // Function stringReplaceAllUnchecked: (dynamic, dynamic, dynamic) → dynamic 747 // Function stringReplaceAllUnchecked: (dynamic, dynamic, dynamic) → dynamic
748 function stringReplaceAllUnchecked(receiver, from, to) { 748 function stringReplaceAllUnchecked(receiver, from, to) {
749 checkString(to); 749 checkString(to);
750 if (typeof from == 'string') { 750 if (typeof from == 'string') {
751 if (dart.equals(from, "")) { 751 if (dart.equals(from, "")) {
752 if (dart.equals(receiver, "")) { 752 if (dart.equals(receiver, "")) {
753 return to; 753 return to;
754 } else { 754 } else {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 } 790 }
791 if (onMatch == null) 791 if (onMatch == null)
792 onMatch = _matchString; 792 onMatch = _matchString;
793 if (onNonMatch == null) 793 if (onNonMatch == null)
794 onNonMatch = _stringIdentity; 794 onNonMatch = _stringIdentity;
795 if (typeof pattern == 'string') { 795 if (typeof pattern == 'string') {
796 return stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onN onMatch); 796 return stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onN onMatch);
797 } 797 }
798 let buffer = new core.StringBuffer(); 798 let buffer = new core.StringBuffer();
799 let startIndex = 0; 799 let startIndex = 0;
800 for (let match of dart.as(dart.dinvoke(pattern, 'allMatches', receiver), cor e.Iterable$(core.Match))) { 800 for (let match of dart.as(dart.dsend(pattern, 'allMatches', receiver), core. Iterable$(core.Match))) {
801 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substring', startIndex, match.start))); 801 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring', star tIndex, match.start)));
802 buffer.write(dart.dinvokef(onMatch, match)); 802 buffer.write(dart.dcall(onMatch, match));
803 startIndex = match.end; 803 startIndex = match.end;
804 } 804 }
805 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substring', s tartIndex))); 805 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring', startI ndex)));
806 return buffer.toString(); 806 return buffer.toString();
807 } 807 }
808 // Function stringReplaceAllEmptyFuncUnchecked: (dynamic, dynamic, dynamic) → dynamic 808 // Function stringReplaceAllEmptyFuncUnchecked: (dynamic, dynamic, dynamic) → dynamic
809 function stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch) { 809 function stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch) {
810 let buffer = new core.StringBuffer(); 810 let buffer = new core.StringBuffer();
811 let length = dart.as(dart.dload(receiver, 'length'), core.int); 811 let length = dart.as(dart.dload(receiver, 'length'), core.int);
812 let i = 0; 812 let i = 0;
813 buffer.write(dart.dinvokef(onNonMatch, "")); 813 buffer.write(dart.dcall(onNonMatch, ""));
814 while (dart.notNull(i) < dart.notNull(length)) { 814 while (dart.notNull(i) < dart.notNull(length)) {
815 buffer.write(dart.dinvokef(onMatch, new StringMatch(i, dart.as(receiver, c ore.String), ""))); 815 buffer.write(dart.dcall(onMatch, new StringMatch(i, dart.as(receiver, core .String), "")));
816 let code = dart.as(dart.dinvoke(receiver, 'codeUnitAt', i), core.int); 816 let code = dart.as(dart.dsend(receiver, 'codeUnitAt', i), core.int);
817 if ((dart.notNull(code) & ~1023) == 55296 && dart.notNull(length) > dart.n otNull(i) + 1) { 817 if ((dart.notNull(code) & ~1023) == 55296 && dart.notNull(length) > dart.n otNull(i) + 1) {
818 code = dart.as(dart.dinvoke(receiver, 'codeUnitAt', dart.notNull(i) + 1) , core.int); 818 code = dart.as(dart.dsend(receiver, 'codeUnitAt', dart.notNull(i) + 1), core.int);
819 if ((dart.notNull(code) & ~1023) == 56320) { 819 if ((dart.notNull(code) & ~1023) == 56320) {
820 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substri ng', i, dart.notNull(i) + 2))); 820 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring', i, dart.notNull(i) + 2)));
821 i = dart.notNull(i) + 2; 821 i = dart.notNull(i) + 2;
822 continue; 822 continue;
823 } 823 }
824 } 824 }
825 buffer.write(dart.dinvokef(onNonMatch, dart.dindex(receiver, i))); 825 buffer.write(dart.dcall(onNonMatch, dart.dindex(receiver, i)));
826 i = dart.notNull(i) + 1; 826 i = dart.notNull(i) + 1;
827 } 827 }
828 buffer.write(dart.dinvokef(onMatch, new StringMatch(i, dart.as(receiver, cor e.String), ""))); 828 buffer.write(dart.dcall(onMatch, new StringMatch(i, dart.as(receiver, core.S tring), "")));
829 buffer.write(dart.dinvokef(onNonMatch, "")); 829 buffer.write(dart.dcall(onNonMatch, ""));
830 return buffer.toString(); 830 return buffer.toString();
831 } 831 }
832 // Function stringReplaceAllStringFuncUnchecked: (dynamic, dynamic, dynamic, d ynamic) → dynamic 832 // Function stringReplaceAllStringFuncUnchecked: (dynamic, dynamic, dynamic, d ynamic) → dynamic
833 function stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onNon Match) { 833 function stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onNon Match) {
834 let patternLength = dart.as(dart.dload(pattern, 'length'), core.int); 834 let patternLength = dart.as(dart.dload(pattern, 'length'), core.int);
835 if (patternLength == 0) { 835 if (patternLength == 0) {
836 return stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch); 836 return stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch);
837 } 837 }
838 let length = dart.as(dart.dload(receiver, 'length'), core.int); 838 let length = dart.as(dart.dload(receiver, 'length'), core.int);
839 let buffer = new core.StringBuffer(); 839 let buffer = new core.StringBuffer();
840 let startIndex = 0; 840 let startIndex = 0;
841 while (dart.notNull(startIndex) < dart.notNull(length)) { 841 while (dart.notNull(startIndex) < dart.notNull(length)) {
842 let position = dart.as(dart.dinvoke(receiver, 'indexOf', pattern, startInd ex), core.int); 842 let position = dart.as(dart.dsend(receiver, 'indexOf', pattern, startIndex ), core.int);
843 if (position == -1) { 843 if (position == -1) {
844 break; 844 break;
845 } 845 }
846 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substring', startIndex, position))); 846 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring', star tIndex, position)));
847 buffer.write(dart.dinvokef(onMatch, new StringMatch(position, dart.as(rece iver, core.String), dart.as(pattern, core.String)))); 847 buffer.write(dart.dcall(onMatch, new StringMatch(position, dart.as(receive r, core.String), dart.as(pattern, core.String))));
848 startIndex = dart.notNull(position) + dart.notNull(patternLength); 848 startIndex = dart.notNull(position) + dart.notNull(patternLength);
849 } 849 }
850 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substring', s tartIndex))); 850 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring', startI ndex)));
851 return buffer.toString(); 851 return buffer.toString();
852 } 852 }
853 // Function stringReplaceFirstUnchecked: (dynamic, dynamic, dynamic, [int]) → dynamic 853 // Function stringReplaceFirstUnchecked: (dynamic, dynamic, dynamic, [int]) → dynamic
854 function stringReplaceFirstUnchecked(receiver, from, to, startIndex) { 854 function stringReplaceFirstUnchecked(receiver, from, to, startIndex) {
855 if (startIndex === void 0) 855 if (startIndex === void 0)
856 startIndex = 0; 856 startIndex = 0;
857 if (typeof from == 'string') { 857 if (typeof from == 'string') {
858 let index = dart.dinvoke(receiver, 'indexOf', from, startIndex); 858 let index = dart.dsend(receiver, 'indexOf', from, startIndex);
859 if (dart.dbinary(index, '<', 0)) 859 if (dart.dsend(index, '<', 0))
860 return receiver; 860 return receiver;
861 return `${dart.dinvoke(receiver, 'substring', 0, index)}${to}` + `${dart.d invoke(receiver, 'substring', dart.dbinary(index, '+', dart.dload(from, 'length' )))}`; 861 return `${dart.dsend(receiver, 'substring', 0, index)}${to}` + `${dart.dse nd(receiver, 'substring', dart.dsend(index, '+', dart.dload(from, 'length')))}`;
862 } else if (dart.is(from, JSSyntaxRegExp)) { 862 } else if (dart.is(from, JSSyntaxRegExp)) {
863 return startIndex == 0 ? stringReplaceJS(receiver, regExpGetNative(dart.as (from, JSSyntaxRegExp)), to) : stringReplaceFirstRE(receiver, from, to, startInd ex); 863 return startIndex == 0 ? stringReplaceJS(receiver, regExpGetNative(dart.as (from, JSSyntaxRegExp)), to) : stringReplaceFirstRE(receiver, from, to, startInd ex);
864 } else { 864 } else {
865 checkNull(from); 865 checkNull(from);
866 throw "String.replace(Pattern) UNIMPLEMENTED"; 866 throw "String.replace(Pattern) UNIMPLEMENTED";
867 } 867 }
868 } 868 }
869 // Function stringJoinUnchecked: (dynamic, dynamic) → dynamic 869 // Function stringJoinUnchecked: (dynamic, dynamic) → dynamic
870 function stringJoinUnchecked(array, separator) { 870 function stringJoinUnchecked(array, separator) {
871 return array.join(separator); 871 return array.join(separator);
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 return false; 1217 return false;
1218 } 1218 }
1219 return true; 1219 return true;
1220 } 1220 }
1221 // Function isFunctionSubtype: (dynamic, dynamic) → bool 1221 // Function isFunctionSubtype: (dynamic, dynamic) → bool
1222 function isFunctionSubtype(s, t) { 1222 function isFunctionSubtype(s, t) {
1223 dart.assert(hasField(t, `${_foreign_helper.JS_FUNCTION_TYPE_TAG()}`)); 1223 dart.assert(hasField(t, `${_foreign_helper.JS_FUNCTION_TYPE_TAG()}`));
1224 if (hasNoField(s, `${_foreign_helper.JS_FUNCTION_TYPE_TAG()}`)) 1224 if (hasNoField(s, `${_foreign_helper.JS_FUNCTION_TYPE_TAG()}`))
1225 return false; 1225 return false;
1226 if (hasField(s, `${_foreign_helper.JS_FUNCTION_TYPE_VOID_RETURN_TAG()}`)) { 1226 if (hasField(s, `${_foreign_helper.JS_FUNCTION_TYPE_VOID_RETURN_TAG()}`)) {
1227 if (dart.dbinary(hasNoField(t, `${_foreign_helper.JS_FUNCTION_TYPE_VOID_RE TURN_TAG()}`), '&&', hasField(t, `${_foreign_helper.JS_FUNCTION_TYPE_RETURN_TYPE _TAG()}`))) { 1227 if (dart.dsend(hasNoField(t, `${_foreign_helper.JS_FUNCTION_TYPE_VOID_RETU RN_TAG()}`), '&&', hasField(t, `${_foreign_helper.JS_FUNCTION_TYPE_RETURN_TYPE_T AG()}`))) {
1228 return false; 1228 return false;
1229 } 1229 }
1230 } else if (hasNoField(t, `${_foreign_helper.JS_FUNCTION_TYPE_VOID_RETURN_TAG ()}`)) { 1230 } else if (hasNoField(t, `${_foreign_helper.JS_FUNCTION_TYPE_VOID_RETURN_TAG ()}`)) {
1231 let sReturnType = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_RETURN_T YPE_TAG()}`); 1231 let sReturnType = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_RETURN_T YPE_TAG()}`);
1232 let tReturnType = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_RETURN_T YPE_TAG()}`); 1232 let tReturnType = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_RETURN_T YPE_TAG()}`);
1233 if (!dart.notNull(isAssignable(sReturnType, tReturnType))) 1233 if (!dart.notNull(isAssignable(sReturnType, tReturnType)))
1234 return false; 1234 return false;
1235 } 1235 }
1236 let sParameterTypes = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_REQUIR ED_PARAMETERS_TAG()}`); 1236 let sParameterTypes = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_REQUIR ED_PARAMETERS_TAG()}`);
1237 let tParameterTypes = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_REQUIR ED_PARAMETERS_TAG()}`); 1237 let tParameterTypes = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_REQUIR ED_PARAMETERS_TAG()}`);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 // Function isJsArray: (dynamic) → bool 1309 // Function isJsArray: (dynamic) → bool
1310 function isJsArray(value) { 1310 function isJsArray(value) {
1311 return dart.is(value, _interceptors.JSArray); 1311 return dart.is(value, _interceptors.JSArray);
1312 } 1312 }
1313 // Function hasField: (dynamic, dynamic) → dynamic 1313 // Function hasField: (dynamic, dynamic) → dynamic
1314 function hasField(object, name) { 1314 function hasField(object, name) {
1315 return name in object; 1315 return name in object;
1316 } 1316 }
1317 // Function hasNoField: (dynamic, dynamic) → dynamic 1317 // Function hasNoField: (dynamic, dynamic) → dynamic
1318 function hasNoField(object, name) { 1318 function hasNoField(object, name) {
1319 return dart.dunary('!', hasField(object, name)); 1319 return dart.dsend(hasField(object, name), '!');
1320 } 1320 }
1321 // Function isJsFunction: (dynamic) → bool 1321 // Function isJsFunction: (dynamic) → bool
1322 function isJsFunction(o) { 1322 function isJsFunction(o) {
1323 return typeof o == "function"; 1323 return typeof o == "function";
1324 } 1324 }
1325 // Function isJsObject: (dynamic) → bool 1325 // Function isJsObject: (dynamic) → bool
1326 function isJsObject(o) { 1326 function isJsObject(o) {
1327 return typeof o == 'object'; 1327 return typeof o == 'object';
1328 } 1328 }
1329 // Function isIdentical: (dynamic, dynamic) → bool 1329 // Function isIdentical: (dynamic, dynamic) → bool
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 } else { 1500 } else {
1501 return new CachedInvocation(name, method, isIntercepted, dart.as(inter ceptor, _interceptors.Interceptor)); 1501 return new CachedInvocation(name, method, isIntercepted, dart.as(inter ceptor, _interceptors.Interceptor));
1502 } 1502 }
1503 } else { 1503 } else {
1504 return new CachedNoSuchMethodInvocation(interceptor); 1504 return new CachedNoSuchMethodInvocation(interceptor);
1505 } 1505 }
1506 } 1506 }
1507 static invokeFromMirror(invocation, victim) { 1507 static invokeFromMirror(invocation, victim) {
1508 let cached = invocation[_getCachedInvocation](victim); 1508 let cached = invocation[_getCachedInvocation](victim);
1509 if (dart.dload(cached, 'isNoSuchMethod')) { 1509 if (dart.dload(cached, 'isNoSuchMethod')) {
1510 return dart.dinvoke(cached, 'invokeOn', victim, invocation); 1510 return dart.dsend(cached, 'invokeOn', victim, invocation);
1511 } else { 1511 } else {
1512 return dart.dinvoke(cached, 'invokeOn', victim, invocation[_arguments]); 1512 return dart.dsend(cached, 'invokeOn', victim, invocation[_arguments]);
1513 } 1513 }
1514 } 1514 }
1515 static getCachedInvocation(invocation, victim) { 1515 static getCachedInvocation(invocation, victim) {
1516 return invocation[_getCachedInvocation](victim); 1516 return invocation[_getCachedInvocation](victim);
1517 } 1517 }
1518 } 1518 }
1519 JSInvocationMirror[dart.implements] = () => [core.Invocation]; 1519 JSInvocationMirror[dart.implements] = () => [core.Invocation];
1520 JSInvocationMirror.METHOD = 0; 1520 JSInvocationMirror.METHOD = 0;
1521 JSInvocationMirror.GETTER = 1; 1521 JSInvocationMirror.GETTER = 1;
1522 JSInvocationMirror.SETTER = 2; 1522 JSInvocationMirror.SETTER = 2;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 this.interceptor = interceptor; 1596 this.interceptor = interceptor;
1597 } 1597 }
1598 get isNoSuchMethod() { 1598 get isNoSuchMethod() {
1599 return true; 1599 return true;
1600 } 1600 }
1601 get isGetterStub() { 1601 get isGetterStub() {
1602 return false; 1602 return false;
1603 } 1603 }
1604 invokeOn(victim, invocation) { 1604 invokeOn(victim, invocation) {
1605 let receiver = this.interceptor == null ? victim : this.interceptor; 1605 let receiver = this.interceptor == null ? victim : this.interceptor;
1606 return dart.dinvoke(receiver, 'noSuchMethod', invocation); 1606 return dart.dsend(receiver, 'noSuchMethod', invocation);
1607 } 1607 }
1608 } 1608 }
1609 class ReflectionInfo extends core.Object { 1609 class ReflectionInfo extends core.Object {
1610 internal(jsFunction, data, isAccessor, requiredParameterCount, optionalParam eterCount, areOptionalParametersNamed, functionType) { 1610 internal(jsFunction, data, isAccessor, requiredParameterCount, optionalParam eterCount, areOptionalParametersNamed, functionType) {
1611 this.jsFunction = jsFunction; 1611 this.jsFunction = jsFunction;
1612 this.data = data; 1612 this.data = data;
1613 this.isAccessor = isAccessor; 1613 this.isAccessor = isAccessor;
1614 this.requiredParameterCount = requiredParameterCount; 1614 this.requiredParameterCount = requiredParameterCount;
1615 this.optionalParameterCount = optionalParameterCount; 1615 this.optionalParameterCount = optionalParameterCount;
1616 this.areOptionalParametersNamed = areOptionalParametersNamed; 1616 this.areOptionalParametersNamed = areOptionalParametersNamed;
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1873 } 1873 }
1874 result = result + String.fromCharCode.apply(null, subarray); 1874 result = result + String.fromCharCode.apply(null, subarray);
1875 } 1875 }
1876 return result; 1876 return result;
1877 } 1877 }
1878 static stringFromCodePoints(codePoints) { 1878 static stringFromCodePoints(codePoints) {
1879 let a = new core.List$(core.int).from([]); 1879 let a = new core.List$(core.int).from([]);
1880 for (let i of dart.as(codePoints, core.Iterable)) { 1880 for (let i of dart.as(codePoints, core.Iterable)) {
1881 if (!(typeof i == 'number')) 1881 if (!(typeof i == 'number'))
1882 throw new core.ArgumentError(i); 1882 throw new core.ArgumentError(i);
1883 if (dart.dbinary(i, '<=', 65535)) { 1883 if (dart.dsend(i, '<=', 65535)) {
1884 a[core.$add](dart.as(i, core.int)); 1884 a[core.$add](dart.as(i, core.int));
1885 } else if (dart.dbinary(i, '<=', 1114111)) { 1885 } else if (dart.dsend(i, '<=', 1114111)) {
1886 a[core.$add](55296['+'](dart.dbinary(dart.dbinary(dart.dbinary(i, '-', 65536), '>>', 10), '&', 1023))); 1886 a[core.$add](55296['+'](dart.dsend(dart.dsend(dart.dsend(i, '-', 65536 ), '>>', 10), '&', 1023)));
1887 a[core.$add](56320['+'](dart.dbinary(i, '&', 1023))); 1887 a[core.$add](56320['+'](dart.dsend(i, '&', 1023)));
1888 } else { 1888 } else {
1889 throw new core.ArgumentError(i); 1889 throw new core.ArgumentError(i);
1890 } 1890 }
1891 } 1891 }
1892 return Primitives[_fromCharCodeApply](a); 1892 return Primitives[_fromCharCodeApply](a);
1893 } 1893 }
1894 static stringFromCharCodes(charCodes) { 1894 static stringFromCharCodes(charCodes) {
1895 for (let i of dart.as(charCodes, core.Iterable)) { 1895 for (let i of dart.as(charCodes, core.Iterable)) {
1896 if (!(typeof i == 'number')) 1896 if (!(typeof i == 'number'))
1897 throw new core.ArgumentError(i); 1897 throw new core.ArgumentError(i);
1898 if (dart.dbinary(i, '<', 0)) 1898 if (dart.dsend(i, '<', 0))
1899 throw new core.ArgumentError(i); 1899 throw new core.ArgumentError(i);
1900 if (dart.dbinary(i, '>', 65535)) 1900 if (dart.dsend(i, '>', 65535))
1901 return Primitives.stringFromCodePoints(charCodes); 1901 return Primitives.stringFromCodePoints(charCodes);
1902 } 1902 }
1903 return Primitives[_fromCharCodeApply](dart.as(charCodes, core.List$(core.i nt))); 1903 return Primitives[_fromCharCodeApply](dart.as(charCodes, core.List$(core.i nt)));
1904 } 1904 }
1905 static stringFromCharCode(charCode) { 1905 static stringFromCharCode(charCode) {
1906 if (0['<='](charCode)) { 1906 if (0['<='](charCode)) {
1907 if (dart.dbinary(charCode, '<=', 65535)) { 1907 if (dart.dsend(charCode, '<=', 65535)) {
1908 return String.fromCharCode(charCode); 1908 return String.fromCharCode(charCode);
1909 } 1909 }
1910 if (dart.dbinary(charCode, '<=', 1114111)) { 1910 if (dart.dsend(charCode, '<=', 1114111)) {
1911 let bits = dart.dbinary(charCode, '-', 65536); 1911 let bits = dart.dsend(charCode, '-', 65536);
1912 let low = 56320['|'](dart.dbinary(bits, '&', 1023)); 1912 let low = 56320['|'](dart.dsend(bits, '&', 1023));
1913 let high = 55296['|'](dart.dbinary(bits, '>>', 10)); 1913 let high = 55296['|'](dart.dsend(bits, '>>', 10));
1914 return String.fromCharCode(high, low); 1914 return String.fromCharCode(high, low);
1915 } 1915 }
1916 } 1916 }
1917 throw new core.RangeError.range(dart.as(charCode, core.num), 0, 1114111); 1917 throw new core.RangeError.range(dart.as(charCode, core.num), 0, 1114111);
1918 } 1918 }
1919 static stringConcatUnchecked(string1, string2) { 1919 static stringConcatUnchecked(string1, string2) {
1920 return _foreign_helper.JS_STRING_CONCAT(string1, string2); 1920 return _foreign_helper.JS_STRING_CONCAT(string1, string2);
1921 } 1921 }
1922 static flattenString(str) { 1922 static flattenString(str) {
1923 return str.charCodeAt(0) == 0 ? str : str; 1923 return str.charCodeAt(0) == 0 ? str : str;
(...skipping 17 matching lines...) Expand all
1941 static valueFromDecomposedDate(years, month, day, hours, minutes, seconds, m illiseconds, isUtc) { 1941 static valueFromDecomposedDate(years, month, day, hours, minutes, seconds, m illiseconds, isUtc) {
1942 let MAX_MILLISECONDS_SINCE_EPOCH = 8640000000000000; 1942 let MAX_MILLISECONDS_SINCE_EPOCH = 8640000000000000;
1943 checkInt(years); 1943 checkInt(years);
1944 checkInt(month); 1944 checkInt(month);
1945 checkInt(day); 1945 checkInt(day);
1946 checkInt(hours); 1946 checkInt(hours);
1947 checkInt(minutes); 1947 checkInt(minutes);
1948 checkInt(seconds); 1948 checkInt(seconds);
1949 checkInt(milliseconds); 1949 checkInt(milliseconds);
1950 checkBool(isUtc); 1950 checkBool(isUtc);
1951 let jsMonth = dart.dbinary(month, '-', 1); 1951 let jsMonth = dart.dsend(month, '-', 1);
1952 let value = null; 1952 let value = null;
1953 if (isUtc) { 1953 if (isUtc) {
1954 value = Date.UTC(years, jsMonth, day, hours, minutes, seconds, milliseco nds); 1954 value = Date.UTC(years, jsMonth, day, hours, minutes, seconds, milliseco nds);
1955 } else { 1955 } else {
1956 value = new Date(years, jsMonth, day, hours, minutes, seconds, milliseco nds).valueOf(); 1956 value = new Date(years, jsMonth, day, hours, minutes, seconds, milliseco nds).valueOf();
1957 } 1957 }
1958 if (core.bool['||'](dart.dbinary(dart.dload(value, 'isNaN'), '||', dart.db inary(value, '<', -dart.notNull(MAX_MILLISECONDS_SINCE_EPOCH))), dart.dbinary(va lue, '>', MAX_MILLISECONDS_SINCE_EPOCH))) { 1958 if (core.bool['||'](dart.dsend(dart.dload(value, 'isNaN'), '||', dart.dsen d(value, '<', -dart.notNull(MAX_MILLISECONDS_SINCE_EPOCH))), dart.dsend(value, ' >', MAX_MILLISECONDS_SINCE_EPOCH))) {
1959 return null; 1959 return null;
1960 } 1960 }
1961 if (dart.dbinary(dart.dbinary(years, '<=', 0), '||', dart.dbinary(years, ' <', 100))) 1961 if (dart.dsend(dart.dsend(years, '<=', 0), '||', dart.dsend(years, '<', 10 0)))
1962 return Primitives.patchUpY2K(value, years, isUtc); 1962 return Primitives.patchUpY2K(value, years, isUtc);
1963 return value; 1963 return value;
1964 } 1964 }
1965 static patchUpY2K(value, years, isUtc) { 1965 static patchUpY2K(value, years, isUtc) {
1966 let date = new Date(value); 1966 let date = new Date(value);
1967 if (isUtc) { 1967 if (isUtc) {
1968 date.setUTCFullYear(years); 1968 date.setUTCFullYear(years);
1969 } else { 1969 } else {
1970 date.setFullYear(years); 1970 date.setFullYear(years);
1971 } 1971 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2033 let names = ''; 2033 let names = '';
2034 if (dart.notNull(namedArguments != null) && !dart.notNull(namedArguments.i sEmpty)) { 2034 if (dart.notNull(namedArguments != null) && !dart.notNull(namedArguments.i sEmpty)) {
2035 namedArguments.forEach((name, argument) => { 2035 namedArguments.forEach((name, argument) => {
2036 names = `${names}$${name}`; 2036 names = `${names}$${name}`;
2037 namedArgumentList[core.$add](name); 2037 namedArgumentList[core.$add](name);
2038 arguments$[core.$add](argument); 2038 arguments$[core.$add](argument);
2039 argumentCount = dart.notNull(argumentCount) + 1; 2039 argumentCount = dart.notNull(argumentCount) + 1;
2040 }); 2040 });
2041 } 2041 }
2042 let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argume ntCount}${names}`; 2042 let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argume ntCount}${names}`;
2043 return dart.dinvoke(func, 'noSuchMethod', createUnmangledInvocationMirror( dart.throw_("Unimplemented SymbolLiteral: #call"), selectorName, JSInvocationMir ror.METHOD, arguments$, namedArgumentList)); 2043 return dart.dsend(func, 'noSuchMethod', createUnmangledInvocationMirror(da rt.throw_("Unimplemented SymbolLiteral: #call"), selectorName, JSInvocationMirro r.METHOD, arguments$, namedArgumentList));
2044 } 2044 }
2045 static applyFunction(func, positionalArguments, namedArguments) { 2045 static applyFunction(func, positionalArguments, namedArguments) {
2046 return namedArguments == null ? Primitives.applyFunctionWithPositionalArgu ments(func, positionalArguments) : Primitives.applyFunctionWithNamedArguments(fu nc, positionalArguments, namedArguments); 2046 return namedArguments == null ? Primitives.applyFunctionWithPositionalArgu ments(func, positionalArguments) : Primitives.applyFunctionWithNamedArguments(fu nc, positionalArguments, namedArguments);
2047 } 2047 }
2048 static applyFunctionWithPositionalArguments(func, positionalArguments) { 2048 static applyFunctionWithPositionalArguments(func, positionalArguments) {
2049 let argumentCount = 0; 2049 let argumentCount = 0;
2050 let arguments$ = null; 2050 let arguments$ = null;
2051 if (positionalArguments != null) { 2051 if (positionalArguments != null) {
2052 if (positionalArguments instanceof Array) { 2052 if (positionalArguments instanceof Array) {
2053 arguments$ = positionalArguments; 2053 arguments$ = positionalArguments;
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
2475 let nsme = TypeErrorDecoder.noSuchMethodPattern; 2475 let nsme = TypeErrorDecoder.noSuchMethodPattern;
2476 let notClosure = TypeErrorDecoder.notClosurePattern; 2476 let notClosure = TypeErrorDecoder.notClosurePattern;
2477 let nullCall = TypeErrorDecoder.nullCallPattern; 2477 let nullCall = TypeErrorDecoder.nullCallPattern;
2478 let nullLiteralCall = TypeErrorDecoder.nullLiteralCallPattern; 2478 let nullLiteralCall = TypeErrorDecoder.nullLiteralCallPattern;
2479 let undefCall = TypeErrorDecoder.undefinedCallPattern; 2479 let undefCall = TypeErrorDecoder.undefinedCallPattern;
2480 let undefLiteralCall = TypeErrorDecoder.undefinedLiteralCallPattern; 2480 let undefLiteralCall = TypeErrorDecoder.undefinedLiteralCallPattern;
2481 let nullProperty = TypeErrorDecoder.nullPropertyPattern; 2481 let nullProperty = TypeErrorDecoder.nullPropertyPattern;
2482 let nullLiteralProperty = TypeErrorDecoder.nullLiteralPropertyPattern; 2482 let nullLiteralProperty = TypeErrorDecoder.nullLiteralPropertyPattern;
2483 let undefProperty = TypeErrorDecoder.undefinedPropertyPattern; 2483 let undefProperty = TypeErrorDecoder.undefinedPropertyPattern;
2484 let undefLiteralProperty = TypeErrorDecoder.undefinedLiteralPropertyPatter n; 2484 let undefLiteralProperty = TypeErrorDecoder.undefinedLiteralPropertyPatter n;
2485 if ((match = dart.dinvoke(nsme, 'matchTypeError', message)) != null) { 2485 if ((match = dart.dsend(nsme, 'matchTypeError', message)) != null) {
2486 return saveStackTrace(new JsNoSuchMethodError(dart.as(message, core.Stri ng), match)); 2486 return saveStackTrace(new JsNoSuchMethodError(dart.as(message, core.Stri ng), match));
2487 } else if ((match = dart.dinvoke(notClosure, 'matchTypeError', message)) ! = null) { 2487 } else if ((match = dart.dsend(notClosure, 'matchTypeError', message)) != null) {
2488 match.method = "call"; 2488 match.method = "call";
2489 return saveStackTrace(new JsNoSuchMethodError(dart.as(message, core.Stri ng), match)); 2489 return saveStackTrace(new JsNoSuchMethodError(dart.as(message, core.Stri ng), match));
2490 } else if (dart.notNull((match = dart.dinvoke(nullCall, 'matchTypeError', message)) != null) || dart.notNull((match = dart.dinvoke(nullLiteralCall, 'match TypeError', message)) != null) || dart.notNull((match = dart.dinvoke(undefCall, 'matchTypeError', message)) != null) || dart.notNull((match = dart.dinvoke(undef LiteralCall, 'matchTypeError', message)) != null) || dart.notNull((match = dart. dinvoke(nullProperty, 'matchTypeError', message)) != null) || dart.notNull((matc h = dart.dinvoke(nullLiteralCall, 'matchTypeError', message)) != null) || dart.n otNull((match = dart.dinvoke(undefProperty, 'matchTypeError', message)) != null) || dart.notNull((match = dart.dinvoke(undefLiteralProperty, 'matchTypeError', m essage)) != null)) { 2490 } else if (dart.notNull((match = dart.dsend(nullCall, 'matchTypeError', me ssage)) != null) || dart.notNull((match = dart.dsend(nullLiteralCall, 'matchType Error', message)) != null) || dart.notNull((match = dart.dsend(undefCall, 'match TypeError', message)) != null) || dart.notNull((match = dart.dsend(undefLiteralC all, 'matchTypeError', message)) != null) || dart.notNull((match = dart.dsend(nu llProperty, 'matchTypeError', message)) != null) || dart.notNull((match = dart.d send(nullLiteralCall, 'matchTypeError', message)) != null) || dart.notNull((matc h = dart.dsend(undefProperty, 'matchTypeError', message)) != null) || dart.notNu ll((match = dart.dsend(undefLiteralProperty, 'matchTypeError', message)) != null )) {
2491 return saveStackTrace(new NullError(dart.as(message, core.String), match )); 2491 return saveStackTrace(new NullError(dart.as(message, core.String), match ));
2492 } 2492 }
2493 return saveStackTrace(new UnknownJsTypeError(dart.as(typeof message == 'st ring' ? message : '', core.String))); 2493 return saveStackTrace(new UnknownJsTypeError(dart.as(typeof message == 'st ring' ? message : '', core.String)));
2494 } 2494 }
2495 if (ex instanceof RangeError) { 2495 if (ex instanceof RangeError) {
2496 if (dart.notNull(typeof message == 'string') && dart.notNull(contains(dart .as(message, core.String), 'call stack'))) { 2496 if (dart.notNull(typeof message == 'string') && dart.notNull(contains(dart .as(message, core.String), 'call stack'))) {
2497 return new core.StackOverflowError(); 2497 return new core.StackOverflowError();
2498 } 2498 }
2499 return saveStackTrace(new core.ArgumentError()); 2499 return saveStackTrace(new core.ArgumentError());
2500 } 2500 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2550 index = dart.notNull(x$) + 1; 2550 index = dart.notNull(x$) + 1;
2551 return x$; 2551 return x$;
2552 })()); 2552 })());
2553 result.set(key, value); 2553 result.set(key, value);
2554 } 2554 }
2555 return result; 2555 return result;
2556 } 2556 }
2557 // Function invokeClosure: (Function, dynamic, int, dynamic, dynamic, dynamic, dynamic) → dynamic 2557 // Function invokeClosure: (Function, dynamic, int, dynamic, dynamic, dynamic, dynamic) → dynamic
2558 function invokeClosure(closure, isolate, numberOfArguments, arg1, arg2, arg3, arg4) { 2558 function invokeClosure(closure, isolate, numberOfArguments, arg1, arg2, arg3, arg4) {
2559 if (numberOfArguments == 0) { 2559 if (numberOfArguments == 0) {
2560 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure)); 2560 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dcall(closur e));
2561 } else if (numberOfArguments == 1) { 2561 } else if (numberOfArguments == 1) {
2562 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1)); 2562 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dcall(closur e, arg1));
2563 } else if (numberOfArguments == 2) { 2563 } else if (numberOfArguments == 2) {
2564 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1, arg2)); 2564 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dcall(closur e, arg1, arg2));
2565 } else if (numberOfArguments == 3) { 2565 } else if (numberOfArguments == 3) {
2566 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1, arg2, arg3)); 2566 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dcall(closur e, arg1, arg2, arg3));
2567 } else if (numberOfArguments == 4) { 2567 } else if (numberOfArguments == 4) {
2568 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1, arg2, arg3, arg4)); 2568 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dcall(closur e, arg1, arg2, arg3, arg4));
2569 } else { 2569 } else {
2570 throw new core.Exception('Unsupported number of arguments for wrapped clos ure'); 2570 throw new core.Exception('Unsupported number of arguments for wrapped clos ure');
2571 } 2571 }
2572 } 2572 }
2573 // Function convertDartClosureToJS: (dynamic, int) → dynamic 2573 // Function convertDartClosureToJS: (dynamic, int) → dynamic
2574 function convertDartClosureToJS(closure, arity) { 2574 function convertDartClosureToJS(closure, arity) {
2575 if (closure == null) 2575 if (closure == null)
2576 return null; 2576 return null;
2577 let func = closure.$identity; 2577 let func = closure.$identity;
2578 if (!!func) 2578 if (!!func)
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
3023 throw new TypeErrorImplementation(value, 'int'); 3023 throw new TypeErrorImplementation(value, 'int');
3024 } 3024 }
3025 // Function intTypeCast: (dynamic) → dynamic 3025 // Function intTypeCast: (dynamic) → dynamic
3026 function intTypeCast(value) { 3026 function intTypeCast(value) {
3027 if (dart.notNull(typeof value == 'number') || dart.notNull(value == null)) 3027 if (dart.notNull(typeof value == 'number') || dart.notNull(value == null))
3028 return value; 3028 return value;
3029 throw new CastErrorImplementation(Primitives.objectTypeName(value), 'int'); 3029 throw new CastErrorImplementation(Primitives.objectTypeName(value), 'int');
3030 } 3030 }
3031 // Function propertyTypeError: (dynamic, dynamic) → void 3031 // Function propertyTypeError: (dynamic, dynamic) → void
3032 function propertyTypeError(value, property) { 3032 function propertyTypeError(value, property) {
3033 let name = dart.as(dart.dinvoke(property, 'substring', 3, dart.dload(propert y, 'length')), core.String); 3033 let name = dart.as(dart.dsend(property, 'substring', 3, dart.dload(property, 'length')), core.String);
3034 throw new TypeErrorImplementation(value, name); 3034 throw new TypeErrorImplementation(value, name);
3035 } 3035 }
3036 // Function propertyTypeCastError: (dynamic, dynamic) → void 3036 // Function propertyTypeCastError: (dynamic, dynamic) → void
3037 function propertyTypeCastError(value, property) { 3037 function propertyTypeCastError(value, property) {
3038 let actualType = Primitives.objectTypeName(value); 3038 let actualType = Primitives.objectTypeName(value);
3039 let expectedType = dart.as(dart.dinvoke(property, 'substring', 3, dart.dload (property, 'length')), core.String); 3039 let expectedType = dart.as(dart.dsend(property, 'substring', 3, dart.dload(p roperty, 'length')), core.String);
3040 throw new CastErrorImplementation(actualType, expectedType); 3040 throw new CastErrorImplementation(actualType, expectedType);
3041 } 3041 }
3042 // Function propertyTypeCheck: (dynamic, dynamic) → dynamic 3042 // Function propertyTypeCheck: (dynamic, dynamic) → dynamic
3043 function propertyTypeCheck(value, property) { 3043 function propertyTypeCheck(value, property) {
3044 if (value == null) 3044 if (value == null)
3045 return value; 3045 return value;
3046 if (!!value[property]) 3046 if (!!value[property])
3047 return value; 3047 return value;
3048 propertyTypeError(value, property); 3048 propertyTypeError(value, property);
3049 } 3049 }
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
3249 super.FallThroughError(); 3249 super.FallThroughError();
3250 } 3250 }
3251 toString() { 3251 toString() {
3252 return "Switch case fall-through."; 3252 return "Switch case fall-through.";
3253 } 3253 }
3254 } 3254 }
3255 // Function assertHelper: (dynamic) → void 3255 // Function assertHelper: (dynamic) → void
3256 function assertHelper(condition) { 3256 function assertHelper(condition) {
3257 if (!(typeof condition == 'boolean')) { 3257 if (!(typeof condition == 'boolean')) {
3258 if (dart.is(condition, core.Function)) 3258 if (dart.is(condition, core.Function))
3259 condition = dart.dinvokef(condition); 3259 condition = dart.dcall(condition);
3260 if (!(typeof condition == 'boolean')) { 3260 if (!(typeof condition == 'boolean')) {
3261 throw new TypeErrorImplementation(condition, 'bool'); 3261 throw new TypeErrorImplementation(condition, 'bool');
3262 } 3262 }
3263 } 3263 }
3264 if (!dart.equals(true, condition)) 3264 if (!dart.equals(true, condition))
3265 throw new core.AssertionError(); 3265 throw new core.AssertionError();
3266 } 3266 }
3267 // Function throwNoSuchMethod: (dynamic, dynamic, dynamic, dynamic) → void 3267 // Function throwNoSuchMethod: (dynamic, dynamic, dynamic, dynamic) → void
3268 function throwNoSuchMethod(obj, name, arguments$, expectedArgumentNames) { 3268 function throwNoSuchMethod(obj, name, arguments$, expectedArgumentNames) {
3269 let memberName = new _internal.Symbol.unvalidated(dart.as(name, core.String) ); 3269 let memberName = new _internal.Symbol.unvalidated(dart.as(name, core.String) );
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
3365 result[_foreign_helper.JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG()] = Run timeFunctionType.listToRti(this.parameterTypes); 3365 result[_foreign_helper.JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG()] = Run timeFunctionType.listToRti(this.parameterTypes);
3366 } 3366 }
3367 if (dart.notNull(this.optionalParameterTypes != null) && !dart.notNull(thi s.optionalParameterTypes[core.$isEmpty])) { 3367 if (dart.notNull(this.optionalParameterTypes != null) && !dart.notNull(thi s.optionalParameterTypes[core.$isEmpty])) {
3368 result[_foreign_helper.JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG()] = Run timeFunctionType.listToRti(this.optionalParameterTypes); 3368 result[_foreign_helper.JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG()] = Run timeFunctionType.listToRti(this.optionalParameterTypes);
3369 } 3369 }
3370 if (this.namedParameters != null) { 3370 if (this.namedParameters != null) {
3371 let namedRti = Object.create(null); 3371 let namedRti = Object.create(null);
3372 let keys = _js_names.extractKeys(this.namedParameters); 3372 let keys = _js_names.extractKeys(this.namedParameters);
3373 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = dart.notNull(i) + 1) { 3373 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = dart.notNull(i) + 1) {
3374 let name = keys[core.$get](i); 3374 let name = keys[core.$get](i);
3375 let rti = dart.dinvoke(this.namedParameters[name], 'toRti'); 3375 let rti = dart.dsend(this.namedParameters[name], 'toRti');
3376 namedRti[name] = rti; 3376 namedRti[name] = rti;
3377 } 3377 }
3378 result[_foreign_helper.JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG()] = namedR ti; 3378 result[_foreign_helper.JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG()] = namedR ti;
3379 } 3379 }
3380 return result; 3380 return result;
3381 } 3381 }
3382 static listToRti(list) { 3382 static listToRti(list) {
3383 list = list; 3383 list = list;
3384 let result = []; 3384 let result = [];
3385 for (let i = 0; i['<'](dart.dload(list, 'length')); i = dart.notNull(i) + 1) { 3385 for (let i = 0; i['<'](dart.dload(list, 'length')); i = dart.notNull(i) + 1) {
3386 result.push(dart.dinvoke(dart.dindex(list, i), 'toRti')); 3386 result.push(dart.dsend(dart.dindex(list, i), 'toRti'));
3387 } 3387 }
3388 return result; 3388 return result;
3389 } 3389 }
3390 toString() { 3390 toString() {
3391 let result = '('; 3391 let result = '(';
3392 let needsComma = false; 3392 let needsComma = false;
3393 if (this.parameterTypes != null) { 3393 if (this.parameterTypes != null) {
3394 for (let i = 0; dart.notNull(i) < dart.notNull(this.parameterTypes[core. $length]); i = dart.notNull(i) + 1) { 3394 for (let i = 0; dart.notNull(i) < dart.notNull(this.parameterTypes[core. $length]); i = dart.notNull(i) + 1) {
3395 let type = this.parameterTypes[core.$get](i); 3395 let type = this.parameterTypes[core.$get](i);
3396 if (needsComma) { 3396 if (needsComma) {
(...skipping 23 matching lines...) Expand all
3420 result = core.String['+'](result, ', '); 3420 result = core.String['+'](result, ', ');
3421 } 3421 }
3422 needsComma = false; 3422 needsComma = false;
3423 result = core.String['+'](result, '{'); 3423 result = core.String['+'](result, '{');
3424 let keys = _js_names.extractKeys(this.namedParameters); 3424 let keys = _js_names.extractKeys(this.namedParameters);
3425 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = dart.notNull(i) + 1) { 3425 for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = dart.notNull(i) + 1) {
3426 let name = keys[core.$get](i); 3426 let name = keys[core.$get](i);
3427 if (needsComma) { 3427 if (needsComma) {
3428 result = core.String['+'](result, ', '); 3428 result = core.String['+'](result, ', ');
3429 } 3429 }
3430 let rti = dart.dinvoke(this.namedParameters[name], 'toRti'); 3430 let rti = dart.dsend(this.namedParameters[name], 'toRti');
3431 result = core.String['+'](result, `${rti} ${name}`); 3431 result = core.String['+'](result, `${rti} ${name}`);
3432 needsComma = true; 3432 needsComma = true;
3433 } 3433 }
3434 result = core.String['+'](result, '}'); 3434 result = core.String['+'](result, '}');
3435 } 3435 }
3436 result = core.String['+'](result, `) -> ${this.returnType}`); 3436 result = core.String['+'](result, `) -> ${this.returnType}`);
3437 return result; 3437 return result;
3438 } 3438 }
3439 } 3439 }
3440 RuntimeFunctionType.inAssert = false; 3440 RuntimeFunctionType.inAssert = false;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
3491 let fixedListOrNull = dart.as(x, core.List); 3491 let fixedListOrNull = dart.as(x, core.List);
3492 let fixedListOrNull2 = dart.as(x, core.List); 3492 let fixedListOrNull2 = dart.as(x, core.List);
3493 let fixedList = dart.as(x, core.List); 3493 let fixedList = dart.as(x, core.List);
3494 let jsObject = x; 3494 let jsObject = x;
3495 buildFunctionType(dyn, fixedListOrNull, fixedListOrNull2); 3495 buildFunctionType(dyn, fixedListOrNull, fixedListOrNull2);
3496 buildNamedFunctionType(dyn, fixedList, jsObject); 3496 buildNamedFunctionType(dyn, fixedList, jsObject);
3497 buildInterfaceType(dyn, fixedListOrNull); 3497 buildInterfaceType(dyn, fixedListOrNull);
3498 getDynamicRuntimeType(); 3498 getDynamicRuntimeType();
3499 getVoidRuntimeType(); 3499 getVoidRuntimeType();
3500 convertRtiToRuntimeType(dyn); 3500 convertRtiToRuntimeType(dyn);
3501 dart.dinvoke(dyn, '_isTest', dyn2); 3501 dart.dsend(dyn, '_isTest', dyn2);
3502 dart.dinvoke(dyn, '_asCheck', dyn2); 3502 dart.dsend(dyn, '_asCheck', dyn2);
3503 dart.dinvoke(dyn, '_assertCheck', dyn2); 3503 dart.dsend(dyn, '_assertCheck', dyn2);
3504 } 3504 }
3505 // Function convertRtiToRuntimeType: (dynamic) → RuntimeType 3505 // Function convertRtiToRuntimeType: (dynamic) → RuntimeType
3506 function convertRtiToRuntimeType(rti) { 3506 function convertRtiToRuntimeType(rti) {
3507 if (rti == null) { 3507 if (rti == null) {
3508 return getDynamicRuntimeType(); 3508 return getDynamicRuntimeType();
3509 } else if (typeof rti == "function") { 3509 } else if (typeof rti == "function") {
3510 return new RuntimeTypePlain(rti.name); 3510 return new RuntimeTypePlain(rti.name);
3511 } else if (rti.constructor == Array) { 3511 } else if (rti.constructor == Array) {
3512 let list = dart.as(rti, core.List); 3512 let list = dart.as(rti, core.List);
3513 let name = list[core.$get](0).name; 3513 let name = list[core.$get](0).name;
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
4043 exports.jsonEncodeNative = jsonEncodeNative; 4043 exports.jsonEncodeNative = jsonEncodeNative;
4044 exports.getIsolateAffinityTag = getIsolateAffinityTag; 4044 exports.getIsolateAffinityTag = getIsolateAffinityTag;
4045 exports.LoadLibraryFunctionType = LoadLibraryFunctionType; 4045 exports.LoadLibraryFunctionType = LoadLibraryFunctionType;
4046 exports.DeferredLoadCallback = DeferredLoadCallback; 4046 exports.DeferredLoadCallback = DeferredLoadCallback;
4047 exports.loadDeferredLibrary = loadDeferredLibrary; 4047 exports.loadDeferredLibrary = loadDeferredLibrary;
4048 exports.MainError = MainError; 4048 exports.MainError = MainError;
4049 exports.missingMain = missingMain; 4049 exports.missingMain = missingMain;
4050 exports.badMain = badMain; 4050 exports.badMain = badMain;
4051 exports.mainHasTooManyParameters = mainHasTooManyParameters; 4051 exports.mainHasTooManyParameters = mainHasTooManyParameters;
4052 })(_js_helper || (_js_helper = {})); 4052 })(_js_helper || (_js_helper = {}));
OLDNEW
« no previous file with comments | « lib/runtime/dart/_isolate_helper.js ('k') | lib/runtime/dart/_native_typed_data.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698