OLD | NEW |
1 dart_library.library('dart/_js_helper', null, /* Imports */[ | 1 dart_library.library('dart/_js_helper', null, /* Imports */[ |
2 "dart/_runtime", | 2 "dart/_runtime", |
3 'dart/core', | 3 'dart/core', |
4 'dart/collection', | 4 'dart/collection', |
5 'dart/_interceptors', | 5 'dart/_interceptors', |
6 'dart/_foreign_helper' | 6 'dart/_foreign_helper' |
7 ], /* Lazy imports */[ | 7 ], /* Lazy imports */[ |
8 ], function(exports, dart, core, collection, _interceptors, _foreign_helper) { | 8 ], function(exports, dart, core, collection, _interceptors, _foreign_helper) { |
9 'use strict'; | 9 'use strict'; |
10 let dartx = dart.dartx; | 10 let dartx = dart.dartx; |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 if (hash == null) { | 532 if (hash == null) { |
533 hash = Math.random() * 0x3fffffff | 0; | 533 hash = Math.random() * 0x3fffffff | 0; |
534 object.$identityHash = hash; | 534 object.$identityHash = hash; |
535 } | 535 } |
536 return hash; | 536 return hash; |
537 } | 537 } |
538 static _throwFormatException(string) { | 538 static _throwFormatException(string) { |
539 dart.throw(new core.FormatException(string)); | 539 dart.throw(new core.FormatException(string)); |
540 } | 540 } |
541 static parseInt(source, radix, handleError) { | 541 static parseInt(source, radix, handleError) { |
542 if (handleError == null) handleError = dart.fn(s => dart.as(Primitives._th
rowFormatException(dart.as(s, core.String)), core.int), core.int, [dart.dynamic]
); | 542 if (handleError == null) handleError = dart.fn(s => dart.as(Primitives._th
rowFormatException(s), core.int), core.int, [core.String]); |
543 checkString(source); | 543 checkString(source); |
544 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source)
; | 544 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source)
; |
545 let digitsIndex = 1; | 545 let digitsIndex = 1; |
546 let hexIndex = 2; | 546 let hexIndex = 2; |
547 let decimalIndex = 3; | 547 let decimalIndex = 3; |
548 let nonDecimalHexIndex = 4; | 548 let nonDecimalHexIndex = 4; |
549 if (radix == null) { | 549 if (radix == null) { |
550 radix = 10; | 550 radix = 10; |
551 if (match != null) { | 551 if (match != null) { |
552 if (dart.dindex(match, hexIndex) != null) { | 552 if (dart.dindex(match, hexIndex) != null) { |
(...skipping 28 matching lines...) Expand all Loading... |
581 } | 581 } |
582 } | 582 } |
583 } | 583 } |
584 } | 584 } |
585 } | 585 } |
586 if (match == null) return handleError(source); | 586 if (match == null) return handleError(source); |
587 return parseInt(source, radix); | 587 return parseInt(source, radix); |
588 } | 588 } |
589 static parseDouble(source, handleError) { | 589 static parseDouble(source, handleError) { |
590 checkString(source); | 590 checkString(source); |
591 if (handleError == null) handleError = dart.fn(s => dart.as(Primitives._th
rowFormatException(dart.as(s, core.String)), core.double), core.double, [dart.dy
namic]); | 591 if (handleError == null) handleError = dart.fn(s => dart.as(Primitives._th
rowFormatException(s), core.double), core.double, [core.String]); |
592 if (!/^\s*[+-]?(?:Infinity|NaN|(?:\.\d+|\d+(?:\.\d*)?)(?:[eE][+-]?\d+)?)\s
*$/.test(source)) { | 592 if (!/^\s*[+-]?(?:Infinity|NaN|(?:\.\d+|\d+(?:\.\d*)?)(?:[eE][+-]?\d+)?)\s
*$/.test(source)) { |
593 return handleError(source); | 593 return handleError(source); |
594 } | 594 } |
595 let result = parseFloat(source); | 595 let result = parseFloat(source); |
596 if (dart.notNull(result[dartx.isNaN])) { | 596 if (dart.notNull(result[dartx.isNaN])) { |
597 let trimmed = source[dartx.trim](); | 597 let trimmed = source[dartx.trim](); |
598 if (trimmed == 'NaN' || trimmed == '+NaN' || trimmed == '-NaN') { | 598 if (trimmed == 'NaN' || trimmed == '+NaN' || trimmed == '-NaN') { |
599 return result; | 599 return result; |
600 } | 600 } |
601 return handleError(source); | 601 return handleError(source); |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 dart.fn(throwRuntimeError); | 883 dart.fn(throwRuntimeError); |
884 function throwAbstractClassInstantiationError(className) { | 884 function throwAbstractClassInstantiationError(className) { |
885 dart.throw(new core.AbstractClassInstantiationError(dart.as(className, core.
String))); | 885 dart.throw(new core.AbstractClassInstantiationError(dart.as(className, core.
String))); |
886 } | 886 } |
887 dart.fn(throwAbstractClassInstantiationError); | 887 dart.fn(throwAbstractClassInstantiationError); |
888 const _message = Symbol('_message'); | 888 const _message = Symbol('_message'); |
889 const _method = Symbol('_method'); | 889 const _method = Symbol('_method'); |
890 class NullError extends core.Error { | 890 class NullError extends core.Error { |
891 NullError(message, match) { | 891 NullError(message, match) { |
892 this[_message] = message; | 892 this[_message] = message; |
893 this[_method] = match == null ? null : dart.as(match.method, core.String); | 893 this[_method] = dart.as(match == null ? null : match.method, core.String); |
894 super.Error(); | 894 super.Error(); |
895 } | 895 } |
896 toString() { | 896 toString() { |
897 if (this[_method] == null) return `NullError: ${this[_message]}`; | 897 if (this[_method] == null) return `NullError: ${this[_message]}`; |
898 return `NullError: Cannot call "${this[_method]}" on null`; | 898 return `NullError: Cannot call "${this[_method]}" on null`; |
899 } | 899 } |
900 } | 900 } |
901 NullError[dart.implements] = () => [core.NoSuchMethodError]; | 901 NullError[dart.implements] = () => [core.NoSuchMethodError]; |
902 dart.setSignature(NullError, { | 902 dart.setSignature(NullError, { |
903 constructors: () => ({NullError: [NullError, [core.String, dart.dynamic]]}) | 903 constructors: () => ({NullError: [NullError, [core.String, dart.dynamic]]}) |
904 }); | 904 }); |
905 const _receiver = Symbol('_receiver'); | 905 const _receiver = Symbol('_receiver'); |
906 class JsNoSuchMethodError extends core.Error { | 906 class JsNoSuchMethodError extends core.Error { |
907 JsNoSuchMethodError(message, match) { | 907 JsNoSuchMethodError(message, match) { |
908 this[_message] = message; | 908 this[_message] = message; |
909 this[_method] = match == null ? null : dart.as(match.method, core.String); | 909 this[_method] = dart.as(match == null ? null : match.method, core.String); |
910 this[_receiver] = match == null ? null : dart.as(match.receiver, core.Stri
ng); | 910 this[_receiver] = dart.as(match == null ? null : match.receiver, core.Stri
ng); |
911 super.Error(); | 911 super.Error(); |
912 } | 912 } |
913 toString() { | 913 toString() { |
914 if (this[_method] == null) return `NoSuchMethodError: ${this[_message]}`; | 914 if (this[_method] == null) return `NoSuchMethodError: ${this[_message]}`; |
915 if (this[_receiver] == null) { | 915 if (this[_receiver] == null) { |
916 return `NoSuchMethodError: Cannot call "${this[_method]}" (${this[_messa
ge]})`; | 916 return `NoSuchMethodError: Cannot call "${this[_method]}" (${this[_messa
ge]})`; |
917 } | 917 } |
918 return `NoSuchMethodError: Cannot call "${this[_method]}" on "${this[_rece
iver]}" ` + `(${this[_message]})`; | 918 return `NoSuchMethodError: Cannot call "${this[_method]}" on "${this[_rece
iver]}" ` + `(${this[_message]})`; |
919 } | 919 } |
920 } | 920 } |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 exports.CastErrorImplementation = CastErrorImplementation; | 1193 exports.CastErrorImplementation = CastErrorImplementation; |
1194 exports.FallThroughErrorImplementation = FallThroughErrorImplementation; | 1194 exports.FallThroughErrorImplementation = FallThroughErrorImplementation; |
1195 exports.RuntimeError = RuntimeError; | 1195 exports.RuntimeError = RuntimeError; |
1196 exports.random64 = random64; | 1196 exports.random64 = random64; |
1197 exports.jsonEncodeNative = jsonEncodeNative; | 1197 exports.jsonEncodeNative = jsonEncodeNative; |
1198 exports.SyncIterator$ = SyncIterator$; | 1198 exports.SyncIterator$ = SyncIterator$; |
1199 exports.SyncIterator = SyncIterator; | 1199 exports.SyncIterator = SyncIterator; |
1200 exports.SyncIterable$ = SyncIterable$; | 1200 exports.SyncIterable$ = SyncIterable$; |
1201 exports.SyncIterable = SyncIterable; | 1201 exports.SyncIterable = SyncIterable; |
1202 }); | 1202 }); |
OLD | NEW |