| OLD | NEW |
| (Empty) |
| 1 dart_library.library('dart/_js_helper', null, /* Imports */[ | |
| 2 "dart_runtime/dart", | |
| 3 'dart/core', | |
| 4 'dart/collection', | |
| 5 'dart/_interceptors', | |
| 6 'dart/_foreign_helper' | |
| 7 ], /* Lazy imports */[ | |
| 8 ], function(exports, dart, core, collection, _interceptors, _foreign_helper) { | |
| 9 'use strict'; | |
| 10 let dartx = dart.dartx; | |
| 11 class NoThrows extends core.Object { | |
| 12 NoThrows() { | |
| 13 } | |
| 14 } | |
| 15 dart.setSignature(NoThrows, { | |
| 16 constructors: () => ({NoThrows: [NoThrows, []]}) | |
| 17 }); | |
| 18 class NoInline extends core.Object { | |
| 19 NoInline() { | |
| 20 } | |
| 21 } | |
| 22 dart.setSignature(NoInline, { | |
| 23 constructors: () => ({NoInline: [NoInline, []]}) | |
| 24 }); | |
| 25 class Native extends core.Object { | |
| 26 Native(name) { | |
| 27 this.name = name; | |
| 28 } | |
| 29 } | |
| 30 dart.setSignature(Native, { | |
| 31 constructors: () => ({Native: [Native, [core.String]]}) | |
| 32 }); | |
| 33 class JsName extends core.Object { | |
| 34 JsName(opts) { | |
| 35 let name = opts && 'name' in opts ? opts.name : null; | |
| 36 this.name = name; | |
| 37 } | |
| 38 } | |
| 39 dart.setSignature(JsName, { | |
| 40 constructors: () => ({JsName: [JsName, [], {name: core.String}]}) | |
| 41 }); | |
| 42 class JsPeerInterface extends core.Object { | |
| 43 JsPeerInterface(opts) { | |
| 44 let name = opts && 'name' in opts ? opts.name : null; | |
| 45 this.name = name; | |
| 46 } | |
| 47 } | |
| 48 dart.setSignature(JsPeerInterface, { | |
| 49 constructors: () => ({JsPeerInterface: [JsPeerInterface, [], {name: core.Str
ing}]}) | |
| 50 }); | |
| 51 class SupportJsExtensionMethods extends core.Object { | |
| 52 SupportJsExtensionMethods() { | |
| 53 } | |
| 54 } | |
| 55 dart.setSignature(SupportJsExtensionMethods, { | |
| 56 constructors: () => ({SupportJsExtensionMethods: [SupportJsExtensionMethods,
[]]}) | |
| 57 }); | |
| 58 function defineProperty(obj, property, value) { | |
| 59 Object.defineProperty(obj, property, {value: value, enumerable: false, writa
ble: true, configurable: true}); | |
| 60 } | |
| 61 dart.fn(defineProperty, dart.void, [dart.dynamic, core.String, dart.dynamic]); | |
| 62 let _nativeRegExp = Symbol('_nativeRegExp'); | |
| 63 function regExpGetNative(regexp) { | |
| 64 return regexp[_nativeRegExp]; | |
| 65 } | |
| 66 dart.fn(regExpGetNative, () => dart.definiteFunctionType(dart.dynamic, [JSSynt
axRegExp])); | |
| 67 let _nativeGlobalVersion = Symbol('_nativeGlobalVersion'); | |
| 68 function regExpGetGlobalNative(regexp) { | |
| 69 let nativeRegexp = regexp[_nativeGlobalVersion]; | |
| 70 nativeRegexp.lastIndex = 0; | |
| 71 return nativeRegexp; | |
| 72 } | |
| 73 dart.fn(regExpGetGlobalNative, () => dart.definiteFunctionType(dart.dynamic, [
JSSyntaxRegExp])); | |
| 74 let _nativeAnchoredVersion = Symbol('_nativeAnchoredVersion'); | |
| 75 function regExpCaptureCount(regexp) { | |
| 76 let nativeAnchoredRegExp = regexp[_nativeAnchoredVersion]; | |
| 77 let match = nativeAnchoredRegExp.exec(''); | |
| 78 return dart.as(dart.dsend(dart.dload(match, 'length'), '-', 2), core.int); | |
| 79 } | |
| 80 dart.fn(regExpCaptureCount, () => dart.definiteFunctionType(core.int, [JSSynta
xRegExp])); | |
| 81 let _nativeGlobalRegExp = Symbol('_nativeGlobalRegExp'); | |
| 82 let _nativeAnchoredRegExp = Symbol('_nativeAnchoredRegExp'); | |
| 83 let _isMultiLine = Symbol('_isMultiLine'); | |
| 84 let _isCaseSensitive = Symbol('_isCaseSensitive'); | |
| 85 let _execGlobal = Symbol('_execGlobal'); | |
| 86 let _execAnchored = Symbol('_execAnchored'); | |
| 87 class JSSyntaxRegExp extends core.Object { | |
| 88 toString() { | |
| 89 return `RegExp/${this.pattern}/`; | |
| 90 } | |
| 91 JSSyntaxRegExp(source, opts) { | |
| 92 let multiLine = opts && 'multiLine' in opts ? opts.multiLine : false; | |
| 93 let caseSensitive = opts && 'caseSensitive' in opts ? opts.caseSensitive :
true; | |
| 94 this.pattern = source; | |
| 95 this[_nativeRegExp] = JSSyntaxRegExp.makeNative(source, multiLine, caseSen
sitive, false); | |
| 96 this[_nativeGlobalRegExp] = null; | |
| 97 this[_nativeAnchoredRegExp] = null; | |
| 98 } | |
| 99 get [_nativeGlobalVersion]() { | |
| 100 if (this[_nativeGlobalRegExp] != null) | |
| 101 return this[_nativeGlobalRegExp]; | |
| 102 return this[_nativeGlobalRegExp] = JSSyntaxRegExp.makeNative(this.pattern,
this[_isMultiLine], this[_isCaseSensitive], true); | |
| 103 } | |
| 104 get [_nativeAnchoredVersion]() { | |
| 105 if (this[_nativeAnchoredRegExp] != null) | |
| 106 return this[_nativeAnchoredRegExp]; | |
| 107 return this[_nativeAnchoredRegExp] = JSSyntaxRegExp.makeNative(`${this.pat
tern}|()`, this[_isMultiLine], this[_isCaseSensitive], true); | |
| 108 } | |
| 109 get [_isMultiLine]() { | |
| 110 return this[_nativeRegExp].multiline; | |
| 111 } | |
| 112 get [_isCaseSensitive]() { | |
| 113 return !this[_nativeRegExp].ignoreCase; | |
| 114 } | |
| 115 static makeNative(source, multiLine, caseSensitive, global) { | |
| 116 checkString(source); | |
| 117 let m = dart.notNull(multiLine) ? 'm' : ''; | |
| 118 let i = dart.notNull(caseSensitive) ? '' : 'i'; | |
| 119 let g = dart.notNull(global) ? 'g' : ''; | |
| 120 let regexp = (function() { | |
| 121 try { | |
| 122 return new RegExp(source, m + i + g); | |
| 123 } catch (e) { | |
| 124 return e; | |
| 125 } | |
| 126 | |
| 127 })(); | |
| 128 if (regexp instanceof RegExp) | |
| 129 return regexp; | |
| 130 let errorMessage = String(regexp); | |
| 131 dart.throw(new core.FormatException(`Illegal RegExp pattern: ${source}, ${
errorMessage}`)); | |
| 132 } | |
| 133 firstMatch(string) { | |
| 134 let m = dart.as(this[_nativeRegExp].exec(checkString(string)), core.List$(
core.String)); | |
| 135 if (m == null) | |
| 136 return null; | |
| 137 return new _MatchImplementation(this, m); | |
| 138 } | |
| 139 hasMatch(string) { | |
| 140 return this[_nativeRegExp].test(checkString(string)); | |
| 141 } | |
| 142 stringMatch(string) { | |
| 143 let match = this.firstMatch(string); | |
| 144 if (match != null) | |
| 145 return match.group(0); | |
| 146 return null; | |
| 147 } | |
| 148 allMatches(string, start) { | |
| 149 if (start === void 0) | |
| 150 start = 0; | |
| 151 checkString(string); | |
| 152 checkInt(start); | |
| 153 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[d
artx.length])) { | |
| 154 dart.throw(new core.RangeError.range(start, 0, string[dartx.length])); | |
| 155 } | |
| 156 return new _AllMatchesIterable(this, string, start); | |
| 157 } | |
| 158 [_execGlobal](string, start) { | |
| 159 let regexp = this[_nativeGlobalVersion]; | |
| 160 regexp.lastIndex = start; | |
| 161 let match = dart.as(regexp.exec(string), core.List); | |
| 162 if (match == null) | |
| 163 return null; | |
| 164 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin
g))); | |
| 165 } | |
| 166 [_execAnchored](string, start) { | |
| 167 let regexp = this[_nativeAnchoredVersion]; | |
| 168 regexp.lastIndex = start; | |
| 169 let match = dart.as(regexp.exec(string), core.List); | |
| 170 if (match == null) | |
| 171 return null; | |
| 172 if (match[dartx.get](dart.notNull(match[dartx.length]) - 1) != null) | |
| 173 return null; | |
| 174 match[dartx.length] = dart.notNull(match[dartx.length]) - 1; | |
| 175 return new _MatchImplementation(this, dart.as(match, core.List$(core.Strin
g))); | |
| 176 } | |
| 177 matchAsPrefix(string, start) { | |
| 178 if (start === void 0) | |
| 179 start = 0; | |
| 180 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string[d
artx.length])) { | |
| 181 dart.throw(new core.RangeError.range(start, 0, string[dartx.length])); | |
| 182 } | |
| 183 return this[_execAnchored](string, start); | |
| 184 } | |
| 185 get isMultiLine() { | |
| 186 return this[_isMultiLine]; | |
| 187 } | |
| 188 get isCaseSensitive() { | |
| 189 return this[_isCaseSensitive]; | |
| 190 } | |
| 191 } | |
| 192 JSSyntaxRegExp[dart.implements] = () => [core.RegExp]; | |
| 193 dart.setSignature(JSSyntaxRegExp, { | |
| 194 constructors: () => ({JSSyntaxRegExp: [JSSyntaxRegExp, [core.String], {multi
Line: core.bool, caseSensitive: core.bool}]}), | |
| 195 methods: () => ({ | |
| 196 firstMatch: [core.Match, [core.String]], | |
| 197 hasMatch: [core.bool, [core.String]], | |
| 198 stringMatch: [core.String, [core.String]], | |
| 199 allMatches: [core.Iterable$(core.Match), [core.String], [core.int]], | |
| 200 [_execGlobal]: [core.Match, [core.String, core.int]], | |
| 201 [_execAnchored]: [core.Match, [core.String, core.int]], | |
| 202 matchAsPrefix: [core.Match, [core.String], [core.int]] | |
| 203 }), | |
| 204 statics: () => ({makeNative: [dart.dynamic, [core.String, core.bool, core.bo
ol, core.bool]]}), | |
| 205 names: ['makeNative'] | |
| 206 }); | |
| 207 dart.defineExtensionMembers(JSSyntaxRegExp, ['allMatches', 'matchAsPrefix']); | |
| 208 let _match = Symbol('_match'); | |
| 209 class _MatchImplementation extends core.Object { | |
| 210 _MatchImplementation(pattern, match) { | |
| 211 this.pattern = pattern; | |
| 212 this[_match] = match; | |
| 213 dart.assert(typeof this[_match].input == 'string'); | |
| 214 dart.assert(typeof this[_match].index == 'number'); | |
| 215 } | |
| 216 get input() { | |
| 217 return this[_match].input; | |
| 218 } | |
| 219 get start() { | |
| 220 return this[_match].index; | |
| 221 } | |
| 222 get end() { | |
| 223 return dart.notNull(this.start) + dart.notNull(this[_match][dartx.get](0)[
dartx.length]); | |
| 224 } | |
| 225 group(index) { | |
| 226 return this[_match][dartx.get](index); | |
| 227 } | |
| 228 get(index) { | |
| 229 return this.group(index); | |
| 230 } | |
| 231 get groupCount() { | |
| 232 return dart.notNull(this[_match][dartx.length]) - 1; | |
| 233 } | |
| 234 groups(groups) { | |
| 235 let out = dart.list([], core.String); | |
| 236 for (let i of groups) { | |
| 237 out[dartx.add](this.group(i)); | |
| 238 } | |
| 239 return out; | |
| 240 } | |
| 241 } | |
| 242 _MatchImplementation[dart.implements] = () => [core.Match]; | |
| 243 dart.setSignature(_MatchImplementation, { | |
| 244 constructors: () => ({_MatchImplementation: [_MatchImplementation, [core.Pat
tern, core.List$(core.String)]]}), | |
| 245 methods: () => ({ | |
| 246 group: [core.String, [core.int]], | |
| 247 get: [core.String, [core.int]], | |
| 248 groups: [core.List$(core.String), [core.List$(core.int)]] | |
| 249 }) | |
| 250 }); | |
| 251 let _re = Symbol('_re'); | |
| 252 let _string = Symbol('_string'); | |
| 253 let _start = Symbol('_start'); | |
| 254 class _AllMatchesIterable extends collection.IterableBase$(core.Match) { | |
| 255 _AllMatchesIterable(re, string, start) { | |
| 256 this[_re] = re; | |
| 257 this[_string] = string; | |
| 258 this[_start] = start; | |
| 259 super.IterableBase(); | |
| 260 } | |
| 261 get iterator() { | |
| 262 return new _AllMatchesIterator(this[_re], this[_string], this[_start]); | |
| 263 } | |
| 264 } | |
| 265 dart.setSignature(_AllMatchesIterable, { | |
| 266 constructors: () => ({_AllMatchesIterable: [_AllMatchesIterable, [JSSyntaxRe
gExp, core.String, core.int]]}) | |
| 267 }); | |
| 268 dart.defineExtensionMembers(_AllMatchesIterable, ['iterator']); | |
| 269 let _regExp = Symbol('_regExp'); | |
| 270 let _nextIndex = Symbol('_nextIndex'); | |
| 271 let _current = Symbol('_current'); | |
| 272 class _AllMatchesIterator extends core.Object { | |
| 273 _AllMatchesIterator(regExp, string, nextIndex) { | |
| 274 this[_regExp] = regExp; | |
| 275 this[_string] = string; | |
| 276 this[_nextIndex] = nextIndex; | |
| 277 this[_current] = null; | |
| 278 } | |
| 279 get current() { | |
| 280 return this[_current]; | |
| 281 } | |
| 282 moveNext() { | |
| 283 if (this[_string] == null) | |
| 284 return false; | |
| 285 if (dart.notNull(this[_nextIndex]) <= dart.notNull(this[_string][dartx.len
gth])) { | |
| 286 let match = this[_regExp][_execGlobal](this[_string], this[_nextIndex]); | |
| 287 if (match != null) { | |
| 288 this[_current] = match; | |
| 289 let nextIndex = match.end; | |
| 290 if (match.start == nextIndex) { | |
| 291 nextIndex = dart.notNull(nextIndex) + 1; | |
| 292 } | |
| 293 this[_nextIndex] = nextIndex; | |
| 294 return true; | |
| 295 } | |
| 296 } | |
| 297 this[_current] = null; | |
| 298 this[_string] = null; | |
| 299 return false; | |
| 300 } | |
| 301 } | |
| 302 _AllMatchesIterator[dart.implements] = () => [core.Iterator$(core.Match)]; | |
| 303 dart.setSignature(_AllMatchesIterator, { | |
| 304 constructors: () => ({_AllMatchesIterator: [_AllMatchesIterator, [JSSyntaxRe
gExp, core.String, core.int]]}), | |
| 305 methods: () => ({moveNext: [core.bool, []]}) | |
| 306 }); | |
| 307 function firstMatchAfter(regExp, string, start) { | |
| 308 return regExp[_execGlobal](string, start); | |
| 309 } | |
| 310 dart.fn(firstMatchAfter, core.Match, [JSSyntaxRegExp, core.String, core.int]); | |
| 311 class StringMatch extends core.Object { | |
| 312 StringMatch(start, input, pattern) { | |
| 313 this.start = start; | |
| 314 this.input = input; | |
| 315 this.pattern = pattern; | |
| 316 } | |
| 317 get end() { | |
| 318 return dart.notNull(this.start) + dart.notNull(this.pattern[dartx.length])
; | |
| 319 } | |
| 320 get(g) { | |
| 321 return this.group(g); | |
| 322 } | |
| 323 get groupCount() { | |
| 324 return 0; | |
| 325 } | |
| 326 group(group_) { | |
| 327 if (group_ != 0) { | |
| 328 dart.throw(new core.RangeError.value(group_)); | |
| 329 } | |
| 330 return this.pattern; | |
| 331 } | |
| 332 groups(groups_) { | |
| 333 let result = core.List$(core.String).new(); | |
| 334 for (let g of groups_) { | |
| 335 result[dartx.add](this.group(g)); | |
| 336 } | |
| 337 return result; | |
| 338 } | |
| 339 } | |
| 340 StringMatch[dart.implements] = () => [core.Match]; | |
| 341 dart.setSignature(StringMatch, { | |
| 342 constructors: () => ({StringMatch: [StringMatch, [core.int, core.String, cor
e.String]]}), | |
| 343 methods: () => ({ | |
| 344 get: [core.String, [core.int]], | |
| 345 group: [core.String, [core.int]], | |
| 346 groups: [core.List$(core.String), [core.List$(core.int)]] | |
| 347 }) | |
| 348 }); | |
| 349 function allMatchesInStringUnchecked(needle, haystack, startIndex) { | |
| 350 let result = core.List$(core.Match).new(); | |
| 351 let length = haystack[dartx.length]; | |
| 352 let patternLength = needle[dartx.length]; | |
| 353 while (true) { | |
| 354 let position = haystack[dartx.indexOf](needle, startIndex); | |
| 355 if (position == -1) { | |
| 356 break; | |
| 357 } | |
| 358 result[dartx.add](new StringMatch(position, haystack, needle)); | |
| 359 let endIndex = dart.notNull(position) + dart.notNull(patternLength); | |
| 360 if (endIndex == length) { | |
| 361 break; | |
| 362 } else if (position == endIndex) { | |
| 363 startIndex = dart.notNull(startIndex) + 1; | |
| 364 } else { | |
| 365 startIndex = endIndex; | |
| 366 } | |
| 367 } | |
| 368 return result; | |
| 369 } | |
| 370 dart.fn(allMatchesInStringUnchecked, core.List$(core.Match), [core.String, cor
e.String, core.int]); | |
| 371 function stringContainsUnchecked(receiver, other, startIndex) { | |
| 372 if (typeof other == 'string') { | |
| 373 return !dart.equals(dart.dsend(receiver, 'indexOf', other, startIndex), -1
); | |
| 374 } else if (dart.is(other, JSSyntaxRegExp)) { | |
| 375 return dart.dsend(other, 'hasMatch', dart.dsend(receiver, 'substring', sta
rtIndex)); | |
| 376 } else { | |
| 377 let substr = dart.dsend(receiver, 'substring', startIndex); | |
| 378 return dart.dload(dart.dsend(other, 'allMatches', substr), 'isNotEmpty'); | |
| 379 } | |
| 380 } | |
| 381 dart.fn(stringContainsUnchecked); | |
| 382 function stringReplaceJS(receiver, replacer, to) { | |
| 383 to = to.replace(/\$/g, "$$$$"); | |
| 384 return receiver.replace(replacer, to); | |
| 385 } | |
| 386 dart.fn(stringReplaceJS); | |
| 387 function stringReplaceFirstRE(receiver, regexp, to, startIndex) { | |
| 388 let match = dart.dsend(regexp, _execGlobal, receiver, startIndex); | |
| 389 if (match == null) | |
| 390 return receiver; | |
| 391 let start = dart.dload(match, 'start'); | |
| 392 let end = dart.dload(match, 'end'); | |
| 393 return `${dart.dsend(receiver, 'substring', 0, start)}${to}${dart.dsend(rece
iver, 'substring', end)}`; | |
| 394 } | |
| 395 dart.fn(stringReplaceFirstRE); | |
| 396 let ESCAPE_REGEXP = '[[\\]{}()*+?.\\\\^$|]'; | |
| 397 function stringReplaceAllUnchecked(receiver, from, to) { | |
| 398 checkString(to); | |
| 399 if (typeof from == 'string') { | |
| 400 if (dart.equals(from, "")) { | |
| 401 if (dart.equals(receiver, "")) { | |
| 402 return to; | |
| 403 } else { | |
| 404 let result = new core.StringBuffer(); | |
| 405 let length = dart.as(dart.dload(receiver, 'length'), core.int); | |
| 406 result.write(to); | |
| 407 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNu
ll(i) + 1) { | |
| 408 result.write(dart.dindex(receiver, i)); | |
| 409 result.write(to); | |
| 410 } | |
| 411 return dart.toString(result); | |
| 412 } | |
| 413 } else { | |
| 414 let quoter = new RegExp(ESCAPE_REGEXP, 'g'); | |
| 415 let quoted = from.replace(quoter, "\\$&"); | |
| 416 let replacer = new RegExp(quoted, 'g'); | |
| 417 return stringReplaceJS(receiver, replacer, to); | |
| 418 } | |
| 419 } else if (dart.is(from, JSSyntaxRegExp)) { | |
| 420 let re = regExpGetGlobalNative(dart.as(from, JSSyntaxRegExp)); | |
| 421 return stringReplaceJS(receiver, re, to); | |
| 422 } else { | |
| 423 checkNull(from); | |
| 424 dart.throw("String.replaceAll(Pattern) UNIMPLEMENTED"); | |
| 425 } | |
| 426 } | |
| 427 dart.fn(stringReplaceAllUnchecked); | |
| 428 function _matchString(match) { | |
| 429 return match.get(0); | |
| 430 } | |
| 431 dart.fn(_matchString, core.String, [core.Match]); | |
| 432 function _stringIdentity(string) { | |
| 433 return string; | |
| 434 } | |
| 435 dart.fn(_stringIdentity, core.String, [core.String]); | |
| 436 function stringReplaceAllFuncUnchecked(receiver, pattern, onMatch, onNonMatch)
{ | |
| 437 if (!dart.is(pattern, core.Pattern)) { | |
| 438 dart.throw(new core.ArgumentError(`${pattern} is not a Pattern`)); | |
| 439 } | |
| 440 if (onMatch == null) | |
| 441 onMatch = _matchString; | |
| 442 if (onNonMatch == null) | |
| 443 onNonMatch = _stringIdentity; | |
| 444 if (typeof pattern == 'string') { | |
| 445 return stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onN
onMatch); | |
| 446 } | |
| 447 let buffer = new core.StringBuffer(); | |
| 448 let startIndex = 0; | |
| 449 for (let match of dart.as(dart.dsend(pattern, 'allMatches', receiver), core.
Iterable$(core.Match))) { | |
| 450 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring', star
tIndex, match.start))); | |
| 451 buffer.write(dart.dcall(onMatch, match)); | |
| 452 startIndex = match.end; | |
| 453 } | |
| 454 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring', startI
ndex))); | |
| 455 return dart.toString(buffer); | |
| 456 } | |
| 457 dart.fn(stringReplaceAllFuncUnchecked); | |
| 458 function stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch) { | |
| 459 let buffer = new core.StringBuffer(); | |
| 460 let length = dart.as(dart.dload(receiver, 'length'), core.int); | |
| 461 let i = 0; | |
| 462 buffer.write(dart.dcall(onNonMatch, "")); | |
| 463 while (dart.notNull(i) < dart.notNull(length)) { | |
| 464 buffer.write(dart.dcall(onMatch, new StringMatch(i, dart.as(receiver, core
.String), ""))); | |
| 465 let code = dart.as(dart.dsend(receiver, 'codeUnitAt', i), core.int); | |
| 466 if ((dart.notNull(code) & ~1023) == 55296 && dart.notNull(length) > dart.n
otNull(i) + 1) { | |
| 467 code = dart.as(dart.dsend(receiver, 'codeUnitAt', dart.notNull(i) + 1),
core.int); | |
| 468 if ((dart.notNull(code) & ~1023) == 56320) { | |
| 469 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring',
i, dart.notNull(i) + 2))); | |
| 470 i = dart.notNull(i) + 2; | |
| 471 continue; | |
| 472 } | |
| 473 } | |
| 474 buffer.write(dart.dcall(onNonMatch, dart.dindex(receiver, i))); | |
| 475 i = dart.notNull(i) + 1; | |
| 476 } | |
| 477 buffer.write(dart.dcall(onMatch, new StringMatch(i, dart.as(receiver, core.S
tring), ""))); | |
| 478 buffer.write(dart.dcall(onNonMatch, "")); | |
| 479 return dart.toString(buffer); | |
| 480 } | |
| 481 dart.fn(stringReplaceAllEmptyFuncUnchecked); | |
| 482 function stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onNon
Match) { | |
| 483 let patternLength = dart.as(dart.dload(pattern, 'length'), core.int); | |
| 484 if (patternLength == 0) { | |
| 485 return stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch); | |
| 486 } | |
| 487 let length = dart.as(dart.dload(receiver, 'length'), core.int); | |
| 488 let buffer = new core.StringBuffer(); | |
| 489 let startIndex = 0; | |
| 490 while (dart.notNull(startIndex) < dart.notNull(length)) { | |
| 491 let position = dart.as(dart.dsend(receiver, 'indexOf', pattern, startIndex
), core.int); | |
| 492 if (position == -1) { | |
| 493 break; | |
| 494 } | |
| 495 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring', star
tIndex, position))); | |
| 496 buffer.write(dart.dcall(onMatch, new StringMatch(position, dart.as(receive
r, core.String), dart.as(pattern, core.String)))); | |
| 497 startIndex = dart.notNull(position) + dart.notNull(patternLength); | |
| 498 } | |
| 499 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring', startI
ndex))); | |
| 500 return dart.toString(buffer); | |
| 501 } | |
| 502 dart.fn(stringReplaceAllStringFuncUnchecked); | |
| 503 function stringReplaceFirstUnchecked(receiver, from, to, startIndex) { | |
| 504 if (startIndex === void 0) | |
| 505 startIndex = 0; | |
| 506 if (typeof from == 'string') { | |
| 507 let index = dart.dsend(receiver, 'indexOf', from, startIndex); | |
| 508 if (dart.notNull(dart.as(dart.dsend(index, '<', 0), core.bool))) | |
| 509 return receiver; | |
| 510 return `${dart.dsend(receiver, 'substring', 0, index)}${to}` + `${dart.dse
nd(receiver, 'substring', dart.dsend(index, '+', dart.dload(from, 'length')))}`; | |
| 511 } else if (dart.is(from, JSSyntaxRegExp)) { | |
| 512 return startIndex == 0 ? stringReplaceJS(receiver, regExpGetNative(dart.as
(from, JSSyntaxRegExp)), to) : stringReplaceFirstRE(receiver, from, to, startInd
ex); | |
| 513 } else { | |
| 514 checkNull(from); | |
| 515 dart.throw("String.replace(Pattern) UNIMPLEMENTED"); | |
| 516 } | |
| 517 } | |
| 518 dart.fn(stringReplaceFirstUnchecked, dart.dynamic, [dart.dynamic, dart.dynamic
, dart.dynamic], [core.int]); | |
| 519 function stringJoinUnchecked(array, separator) { | |
| 520 return array.join(separator); | |
| 521 } | |
| 522 dart.fn(stringJoinUnchecked); | |
| 523 function getRuntimeType(object) { | |
| 524 return dart.as(dart.realRuntimeType(object), core.Type); | |
| 525 } | |
| 526 dart.fn(getRuntimeType, core.Type, [dart.dynamic]); | |
| 527 function getIndex(array, index) { | |
| 528 dart.assert(isJsArray(array)); | |
| 529 return array[index]; | |
| 530 } | |
| 531 dart.fn(getIndex, dart.dynamic, [dart.dynamic, core.int]); | |
| 532 function getLength(array) { | |
| 533 dart.assert(isJsArray(array)); | |
| 534 return array.length; | |
| 535 } | |
| 536 dart.fn(getLength, core.int, [dart.dynamic]); | |
| 537 function isJsArray(value) { | |
| 538 return dart.is(value, _interceptors.JSArray); | |
| 539 } | |
| 540 dart.fn(isJsArray, core.bool, [dart.dynamic]); | |
| 541 class _Patch extends core.Object { | |
| 542 _Patch() { | |
| 543 } | |
| 544 } | |
| 545 dart.setSignature(_Patch, { | |
| 546 constructors: () => ({_Patch: [_Patch, []]}) | |
| 547 }); | |
| 548 let patch = dart.const(new _Patch()); | |
| 549 class InternalMap extends core.Object {} | |
| 550 class Primitives extends core.Object { | |
| 551 static initializeStatics(id) { | |
| 552 Primitives.mirrorFunctionCacheName = dart.notNull(Primitives.mirrorFunctio
nCacheName) + `_${id}`; | |
| 553 Primitives.mirrorInvokeCacheName = dart.notNull(Primitives.mirrorInvokeCac
heName) + `_${id}`; | |
| 554 } | |
| 555 static objectHashCode(object) { | |
| 556 let hash = dart.as(object.$identityHash, core.int); | |
| 557 if (hash == null) { | |
| 558 hash = Math.random() * 0x3fffffff | 0; | |
| 559 object.$identityHash = hash; | |
| 560 } | |
| 561 return hash; | |
| 562 } | |
| 563 static _throwFormatException(string) { | |
| 564 dart.throw(new core.FormatException(string)); | |
| 565 } | |
| 566 static parseInt(source, radix, handleError) { | |
| 567 if (handleError == null) | |
| 568 handleError = dart.fn(s => dart.as(Primitives._throwFormatException(dart
.as(s, core.String)), core.int), core.int, [dart.dynamic]); | |
| 569 checkString(source); | |
| 570 let match = /^\s*[+-]?((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$/i.exec(source)
; | |
| 571 let digitsIndex = 1; | |
| 572 let hexIndex = 2; | |
| 573 let decimalIndex = 3; | |
| 574 let nonDecimalHexIndex = 4; | |
| 575 if (radix == null) { | |
| 576 radix = 10; | |
| 577 if (match != null) { | |
| 578 if (dart.dindex(match, hexIndex) != null) { | |
| 579 return parseInt(source, 16); | |
| 580 } | |
| 581 if (dart.dindex(match, decimalIndex) != null) { | |
| 582 return parseInt(source, 10); | |
| 583 } | |
| 584 return handleError(source); | |
| 585 } | |
| 586 } else { | |
| 587 if (!(typeof radix == 'number')) | |
| 588 dart.throw(new core.ArgumentError("Radix is not an integer")); | |
| 589 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36) { | |
| 590 dart.throw(new core.RangeError(`Radix ${radix} not in range 2..36`)); | |
| 591 } | |
| 592 if (match != null) { | |
| 593 if (radix == 10 && dart.dindex(match, decimalIndex) != null) { | |
| 594 return parseInt(source, 10); | |
| 595 } | |
| 596 if (dart.notNull(radix) < 10 || dart.dindex(match, decimalIndex) == nu
ll) { | |
| 597 let maxCharCode = null; | |
| 598 if (dart.notNull(radix) <= 10) { | |
| 599 maxCharCode = 48 + dart.notNull(radix) - 1; | |
| 600 } else { | |
| 601 maxCharCode = 97 + dart.notNull(radix) - 10 - 1; | |
| 602 } | |
| 603 let digitsPart = dart.as(dart.dindex(match, digitsIndex), core.Strin
g); | |
| 604 for (let i = 0; dart.notNull(i) < dart.notNull(digitsPart[dartx.leng
th]); i = dart.notNull(i) + 1) { | |
| 605 let characterCode = dart.notNull(digitsPart[dartx.codeUnitAt](0))
| 32; | |
| 606 if (dart.notNull(digitsPart[dartx.codeUnitAt](i)) > dart.notNull(m
axCharCode)) { | |
| 607 return handleError(source); | |
| 608 } | |
| 609 } | |
| 610 } | |
| 611 } | |
| 612 } | |
| 613 if (match == null) | |
| 614 return handleError(source); | |
| 615 return parseInt(source, radix); | |
| 616 } | |
| 617 static parseDouble(source, handleError) { | |
| 618 checkString(source); | |
| 619 if (handleError == null) | |
| 620 handleError = dart.fn(s => dart.as(Primitives._throwFormatException(dart
.as(s, core.String)), core.double), core.double, [dart.dynamic]); | |
| 621 if (!/^\s*[+-]?(?:Infinity|NaN|(?:\.\d+|\d+(?:\.\d*)?)(?:[eE][+-]?\d+)?)\s
*$/.test(source)) { | |
| 622 return handleError(source); | |
| 623 } | |
| 624 let result = parseFloat(source); | |
| 625 if (dart.notNull(result[dartx.isNaN])) { | |
| 626 let trimmed = source[dartx.trim](); | |
| 627 if (trimmed == 'NaN' || trimmed == '+NaN' || trimmed == '-NaN') { | |
| 628 return result; | |
| 629 } | |
| 630 return handleError(source); | |
| 631 } | |
| 632 return result; | |
| 633 } | |
| 634 static objectTypeName(object) { | |
| 635 return dart.toString(getRuntimeType(object)); | |
| 636 } | |
| 637 static objectToString(object) { | |
| 638 let name = dart.typeName(dart.realRuntimeType(object)); | |
| 639 return `Instance of '${name}'`; | |
| 640 } | |
| 641 static dateNow() { | |
| 642 return Date.now(); | |
| 643 } | |
| 644 static initTicker() { | |
| 645 if (Primitives.timerFrequency != null) | |
| 646 return; | |
| 647 Primitives.timerFrequency = 1000; | |
| 648 Primitives.timerTicks = Primitives.dateNow; | |
| 649 if (typeof window == "undefined") | |
| 650 return; | |
| 651 let jsWindow = window; | |
| 652 if (jsWindow == null) | |
| 653 return; | |
| 654 let performance = jsWindow.performance; | |
| 655 if (performance == null) | |
| 656 return; | |
| 657 if (typeof performance.now != "function") | |
| 658 return; | |
| 659 Primitives.timerFrequency = 1000000; | |
| 660 Primitives.timerTicks = dart.fn(() => (1000 * performance.now())[dartx.flo
or](), core.int, []); | |
| 661 } | |
| 662 static get isD8() { | |
| 663 return typeof version == "function" && typeof os == "object" && "system" i
n os; | |
| 664 } | |
| 665 static get isJsshell() { | |
| 666 return typeof version == "function" && typeof system == "function"; | |
| 667 } | |
| 668 static currentUri() { | |
| 669 if (!!self.location) { | |
| 670 return self.location.href; | |
| 671 } | |
| 672 return null; | |
| 673 } | |
| 674 static _fromCharCodeApply(array) { | |
| 675 let result = ""; | |
| 676 let kMaxApply = 500; | |
| 677 let end = array[dartx.length]; | |
| 678 for (let i = 0; dart.notNull(i) < dart.notNull(end); i = dart.notNull(i) +
dart.notNull(kMaxApply)) { | |
| 679 let subarray = null; | |
| 680 if (dart.notNull(end) <= dart.notNull(kMaxApply)) { | |
| 681 subarray = array; | |
| 682 } else { | |
| 683 subarray = array.slice(i, dart.notNull(i) + dart.notNull(kMaxApply) <
dart.notNull(end) ? dart.notNull(i) + dart.notNull(kMaxApply) : end); | |
| 684 } | |
| 685 result = result + String.fromCharCode.apply(null, subarray); | |
| 686 } | |
| 687 return result; | |
| 688 } | |
| 689 static stringFromCodePoints(codePoints) { | |
| 690 let a = dart.list([], core.int); | |
| 691 for (let i of dart.as(codePoints, core.Iterable)) { | |
| 692 if (!(typeof i == 'number')) | |
| 693 dart.throw(new core.ArgumentError(i)); | |
| 694 if (dart.notNull(dart.as(dart.dsend(i, '<=', 65535), core.bool))) { | |
| 695 a[dartx.add](dart.as(i, core.int)); | |
| 696 } else if (dart.notNull(dart.as(dart.dsend(i, '<=', 1114111), core.bool)
)) { | |
| 697 a[dartx.add]((55296)[dartx['+']](dart.as(dart.dsend(dart.dsend(dart.ds
end(i, '-', 65536), '>>', 10), '&', 1023), core.num))); | |
| 698 a[dartx.add]((56320)[dartx['+']](dart.as(dart.dsend(i, '&', 1023), cor
e.num))); | |
| 699 } else { | |
| 700 dart.throw(new core.ArgumentError(i)); | |
| 701 } | |
| 702 } | |
| 703 return Primitives._fromCharCodeApply(a); | |
| 704 } | |
| 705 static stringFromCharCodes(charCodes) { | |
| 706 for (let i of dart.as(charCodes, core.Iterable)) { | |
| 707 if (!(typeof i == 'number')) | |
| 708 dart.throw(new core.ArgumentError(i)); | |
| 709 if (dart.notNull(dart.as(dart.dsend(i, '<', 0), core.bool))) | |
| 710 dart.throw(new core.ArgumentError(i)); | |
| 711 if (dart.notNull(dart.as(dart.dsend(i, '>', 65535), core.bool))) | |
| 712 return Primitives.stringFromCodePoints(charCodes); | |
| 713 } | |
| 714 return Primitives._fromCharCodeApply(dart.as(charCodes, core.List$(core.in
t))); | |
| 715 } | |
| 716 static stringFromCharCode(charCode) { | |
| 717 if (0 <= dart.notNull(dart.as(charCode, core.num))) { | |
| 718 if (dart.notNull(dart.as(dart.dsend(charCode, '<=', 65535), core.bool)))
{ | |
| 719 return String.fromCharCode(charCode); | |
| 720 } | |
| 721 if (dart.notNull(dart.as(dart.dsend(charCode, '<=', 1114111), core.bool)
)) { | |
| 722 let bits = dart.dsend(charCode, '-', 65536); | |
| 723 let low = (56320)[dartx['|']](dart.as(dart.dsend(bits, '&', 1023), cor
e.int)); | |
| 724 let high = (55296)[dartx['|']](dart.as(dart.dsend(bits, '>>', 10), cor
e.int)); | |
| 725 return String.fromCharCode(high, low); | |
| 726 } | |
| 727 } | |
| 728 dart.throw(new core.RangeError.range(dart.as(charCode, core.num), 0, 11141
11)); | |
| 729 } | |
| 730 static stringConcatUnchecked(string1, string2) { | |
| 731 return _foreign_helper.JS_STRING_CONCAT(string1, string2); | |
| 732 } | |
| 733 static flattenString(str) { | |
| 734 return str.charCodeAt(0) == 0 ? str : str; | |
| 735 } | |
| 736 static getTimeZoneName(receiver) { | |
| 737 let d = Primitives.lazyAsJsDate(receiver); | |
| 738 let match = dart.as(/\((.*)\)/.exec(d.toString()), core.List); | |
| 739 if (match != null) | |
| 740 return dart.as(match[dartx.get](1), core.String); | |
| 741 match = dart.as(/^[A-Z,a-z]{3}\s[A-Z,a-z]{3}\s\d+\s\d{2}:\d{2}:\d{2}\s([A-
Z]{3,5})\s\d{4}$/.exec(d.toString()), core.List); | |
| 742 if (match != null) | |
| 743 return dart.as(match[dartx.get](1), core.String); | |
| 744 match = dart.as(/(?:GMT|UTC)[+-]\d{4}/.exec(d.toString()), core.List); | |
| 745 if (match != null) | |
| 746 return dart.as(match[dartx.get](0), core.String); | |
| 747 return ""; | |
| 748 } | |
| 749 static getTimeZoneOffsetInMinutes(receiver) { | |
| 750 return -Primitives.lazyAsJsDate(receiver).getTimezoneOffset(); | |
| 751 } | |
| 752 static valueFromDecomposedDate(years, month, day, hours, minutes, seconds, m
illiseconds, isUtc) { | |
| 753 let MAX_MILLISECONDS_SINCE_EPOCH = 8640000000000000; | |
| 754 checkInt(years); | |
| 755 checkInt(month); | |
| 756 checkInt(day); | |
| 757 checkInt(hours); | |
| 758 checkInt(minutes); | |
| 759 checkInt(seconds); | |
| 760 checkInt(milliseconds); | |
| 761 checkBool(isUtc); | |
| 762 let jsMonth = dart.dsend(month, '-', 1); | |
| 763 let value = null; | |
| 764 if (dart.notNull(dart.as(isUtc, core.bool))) { | |
| 765 value = Date.UTC(years, jsMonth, day, hours, minutes, seconds, milliseco
nds); | |
| 766 } else { | |
| 767 value = new Date(years, jsMonth, day, hours, minutes, seconds, milliseco
nds).valueOf(); | |
| 768 } | |
| 769 if (dart.notNull(dart.as(dart.dload(value, 'isNaN'), core.bool)) || dart.n
otNull(dart.as(dart.dsend(value, '<', -dart.notNull(MAX_MILLISECONDS_SINCE_EPOCH
)), core.bool)) || dart.notNull(dart.as(dart.dsend(value, '>', MAX_MILLISECONDS_
SINCE_EPOCH), core.bool))) { | |
| 770 return null; | |
| 771 } | |
| 772 if (dart.notNull(dart.as(dart.dsend(years, '<=', 0), core.bool)) || dart.n
otNull(dart.as(dart.dsend(years, '<', 100), core.bool))) | |
| 773 return Primitives.patchUpY2K(value, years, isUtc); | |
| 774 return value; | |
| 775 } | |
| 776 static patchUpY2K(value, years, isUtc) { | |
| 777 let date = new Date(value); | |
| 778 if (dart.notNull(dart.as(isUtc, core.bool))) { | |
| 779 date.setUTCFullYear(years); | |
| 780 } else { | |
| 781 date.setFullYear(years); | |
| 782 } | |
| 783 return date.valueOf(); | |
| 784 } | |
| 785 static lazyAsJsDate(receiver) { | |
| 786 if (receiver.date === void 0) { | |
| 787 receiver.date = new Date(dart.dload(receiver, 'millisecondsSinceEpoch'))
; | |
| 788 } | |
| 789 return receiver.date; | |
| 790 } | |
| 791 static getYear(receiver) { | |
| 792 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P
rimitives.lazyAsJsDate(receiver).getUTCFullYear() + 0 : Primitives.lazyAsJsDate(
receiver).getFullYear() + 0; | |
| 793 } | |
| 794 static getMonth(receiver) { | |
| 795 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P
rimitives.lazyAsJsDate(receiver).getUTCMonth() + 1 : Primitives.lazyAsJsDate(rec
eiver).getMonth() + 1; | |
| 796 } | |
| 797 static getDay(receiver) { | |
| 798 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P
rimitives.lazyAsJsDate(receiver).getUTCDate() + 0 : Primitives.lazyAsJsDate(rece
iver).getDate() + 0; | |
| 799 } | |
| 800 static getHours(receiver) { | |
| 801 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P
rimitives.lazyAsJsDate(receiver).getUTCHours() + 0 : Primitives.lazyAsJsDate(rec
eiver).getHours() + 0; | |
| 802 } | |
| 803 static getMinutes(receiver) { | |
| 804 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P
rimitives.lazyAsJsDate(receiver).getUTCMinutes() + 0 : Primitives.lazyAsJsDate(r
eceiver).getMinutes() + 0; | |
| 805 } | |
| 806 static getSeconds(receiver) { | |
| 807 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P
rimitives.lazyAsJsDate(receiver).getUTCSeconds() + 0 : Primitives.lazyAsJsDate(r
eceiver).getSeconds() + 0; | |
| 808 } | |
| 809 static getMilliseconds(receiver) { | |
| 810 return dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.bool)) ? P
rimitives.lazyAsJsDate(receiver).getUTCMilliseconds() + 0 : Primitives.lazyAsJsD
ate(receiver).getMilliseconds() + 0; | |
| 811 } | |
| 812 static getWeekday(receiver) { | |
| 813 let weekday = dart.notNull(dart.as(dart.dload(receiver, 'isUtc'), core.boo
l)) ? Primitives.lazyAsJsDate(receiver).getUTCDay() + 0 : Primitives.lazyAsJsDat
e(receiver).getDay() + 0; | |
| 814 return (dart.notNull(weekday) + 6) % 7 + 1; | |
| 815 } | |
| 816 static valueFromDateString(str) { | |
| 817 if (!(typeof str == 'string')) | |
| 818 dart.throw(new core.ArgumentError(str)); | |
| 819 let value = Date.parse(str); | |
| 820 if (dart.notNull(value[dartx.isNaN])) | |
| 821 dart.throw(new core.ArgumentError(str)); | |
| 822 return value; | |
| 823 } | |
| 824 static getProperty(object, key) { | |
| 825 if (object == null || typeof object == 'boolean' || dart.is(object, core.n
um) || typeof object == 'string') { | |
| 826 dart.throw(new core.ArgumentError(object)); | |
| 827 } | |
| 828 return object[key]; | |
| 829 } | |
| 830 static setProperty(object, key, value) { | |
| 831 if (object == null || typeof object == 'boolean' || dart.is(object, core.n
um) || typeof object == 'string') { | |
| 832 dart.throw(new core.ArgumentError(object)); | |
| 833 } | |
| 834 object[key] = value; | |
| 835 } | |
| 836 static identicalImplementation(a, b) { | |
| 837 return a == null ? b == null : a === b; | |
| 838 } | |
| 839 static extractStackTrace(error) { | |
| 840 return getTraceFromException(error.$thrownJsError); | |
| 841 } | |
| 842 } | |
| 843 dart.setSignature(Primitives, { | |
| 844 statics: () => ({ | |
| 845 initializeStatics: [dart.void, [core.int]], | |
| 846 objectHashCode: [core.int, [dart.dynamic]], | |
| 847 _throwFormatException: [dart.dynamic, [core.String]], | |
| 848 parseInt: [core.int, [core.String, core.int, dart.functionType(core.int, [
core.String])]], | |
| 849 parseDouble: [core.double, [core.String, dart.functionType(core.double, [c
ore.String])]], | |
| 850 objectTypeName: [core.String, [core.Object]], | |
| 851 objectToString: [core.String, [core.Object]], | |
| 852 dateNow: [core.num, []], | |
| 853 initTicker: [dart.void, []], | |
| 854 currentUri: [core.String, []], | |
| 855 _fromCharCodeApply: [core.String, [core.List$(core.int)]], | |
| 856 stringFromCodePoints: [core.String, [dart.dynamic]], | |
| 857 stringFromCharCodes: [core.String, [dart.dynamic]], | |
| 858 stringFromCharCode: [core.String, [dart.dynamic]], | |
| 859 stringConcatUnchecked: [core.String, [core.String, core.String]], | |
| 860 flattenString: [core.String, [core.String]], | |
| 861 getTimeZoneName: [core.String, [dart.dynamic]], | |
| 862 getTimeZoneOffsetInMinutes: [core.int, [dart.dynamic]], | |
| 863 valueFromDecomposedDate: [dart.dynamic, [dart.dynamic, dart.dynamic, dart.
dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]], | |
| 864 patchUpY2K: [dart.dynamic, [dart.dynamic, dart.dynamic, dart.dynamic]], | |
| 865 lazyAsJsDate: [dart.dynamic, [dart.dynamic]], | |
| 866 getYear: [dart.dynamic, [dart.dynamic]], | |
| 867 getMonth: [dart.dynamic, [dart.dynamic]], | |
| 868 getDay: [dart.dynamic, [dart.dynamic]], | |
| 869 getHours: [dart.dynamic, [dart.dynamic]], | |
| 870 getMinutes: [dart.dynamic, [dart.dynamic]], | |
| 871 getSeconds: [dart.dynamic, [dart.dynamic]], | |
| 872 getMilliseconds: [dart.dynamic, [dart.dynamic]], | |
| 873 getWeekday: [dart.dynamic, [dart.dynamic]], | |
| 874 valueFromDateString: [dart.dynamic, [dart.dynamic]], | |
| 875 getProperty: [dart.dynamic, [dart.dynamic, dart.dynamic]], | |
| 876 setProperty: [dart.void, [dart.dynamic, dart.dynamic, dart.dynamic]], | |
| 877 identicalImplementation: [core.bool, [dart.dynamic, dart.dynamic]], | |
| 878 extractStackTrace: [core.StackTrace, [core.Error]] | |
| 879 }), | |
| 880 names: ['initializeStatics', 'objectHashCode', '_throwFormatException', 'par
seInt', 'parseDouble', 'objectTypeName', 'objectToString', 'dateNow', 'initTicke
r', 'currentUri', '_fromCharCodeApply', 'stringFromCodePoints', 'stringFromCharC
odes', 'stringFromCharCode', 'stringConcatUnchecked', 'flattenString', 'getTimeZ
oneName', 'getTimeZoneOffsetInMinutes', 'valueFromDecomposedDate', 'patchUpY2K',
'lazyAsJsDate', 'getYear', 'getMonth', 'getDay', 'getHours', 'getMinutes', 'get
Seconds', 'getMilliseconds', 'getWeekday', 'valueFromDateString', 'getProperty',
'setProperty', 'identicalImplementation', 'extractStackTrace'] | |
| 881 }); | |
| 882 Primitives.mirrorFunctionCacheName = '$cachedFunction'; | |
| 883 Primitives.mirrorInvokeCacheName = '$cachedInvocation'; | |
| 884 Primitives.DOLLAR_CHAR_VALUE = 36; | |
| 885 Primitives.timerFrequency = null; | |
| 886 Primitives.timerTicks = null; | |
| 887 function stringLastIndexOfUnchecked(receiver, element, start) { | |
| 888 return receiver.lastIndexOf(element, start); | |
| 889 } | |
| 890 dart.fn(stringLastIndexOfUnchecked); | |
| 891 function checkNull(object) { | |
| 892 if (object == null) | |
| 893 dart.throw(new core.ArgumentError(null)); | |
| 894 return object; | |
| 895 } | |
| 896 dart.fn(checkNull); | |
| 897 function checkNum(value) { | |
| 898 if (!dart.is(value, core.num)) { | |
| 899 dart.throw(new core.ArgumentError(value)); | |
| 900 } | |
| 901 return value; | |
| 902 } | |
| 903 dart.fn(checkNum); | |
| 904 function checkInt(value) { | |
| 905 if (!(typeof value == 'number')) { | |
| 906 dart.throw(new core.ArgumentError(value)); | |
| 907 } | |
| 908 return value; | |
| 909 } | |
| 910 dart.fn(checkInt); | |
| 911 function checkBool(value) { | |
| 912 if (!(typeof value == 'boolean')) { | |
| 913 dart.throw(new core.ArgumentError(value)); | |
| 914 } | |
| 915 return value; | |
| 916 } | |
| 917 dart.fn(checkBool); | |
| 918 function checkString(value) { | |
| 919 if (!(typeof value == 'string')) { | |
| 920 dart.throw(new core.ArgumentError(value)); | |
| 921 } | |
| 922 return value; | |
| 923 } | |
| 924 dart.fn(checkString); | |
| 925 function throwRuntimeError(message) { | |
| 926 dart.throw(new RuntimeError(message)); | |
| 927 } | |
| 928 dart.fn(throwRuntimeError); | |
| 929 function throwAbstractClassInstantiationError(className) { | |
| 930 dart.throw(new core.AbstractClassInstantiationError(dart.as(className, core.
String))); | |
| 931 } | |
| 932 dart.fn(throwAbstractClassInstantiationError); | |
| 933 let _message = Symbol('_message'); | |
| 934 let _method = Symbol('_method'); | |
| 935 class NullError extends core.Error { | |
| 936 NullError(message, match) { | |
| 937 this[_message] = message; | |
| 938 this[_method] = match == null ? null : dart.as(match.method, core.String); | |
| 939 super.Error(); | |
| 940 } | |
| 941 toString() { | |
| 942 if (this[_method] == null) | |
| 943 return `NullError: ${this[_message]}`; | |
| 944 return `NullError: Cannot call "${this[_method]}" on null`; | |
| 945 } | |
| 946 } | |
| 947 NullError[dart.implements] = () => [core.NoSuchMethodError]; | |
| 948 dart.setSignature(NullError, { | |
| 949 constructors: () => ({NullError: [NullError, [core.String, dart.dynamic]]}) | |
| 950 }); | |
| 951 let _receiver = Symbol('_receiver'); | |
| 952 class JsNoSuchMethodError extends core.Error { | |
| 953 JsNoSuchMethodError(message, match) { | |
| 954 this[_message] = message; | |
| 955 this[_method] = match == null ? null : dart.as(match.method, core.String); | |
| 956 this[_receiver] = match == null ? null : dart.as(match.receiver, core.Stri
ng); | |
| 957 super.Error(); | |
| 958 } | |
| 959 toString() { | |
| 960 if (this[_method] == null) | |
| 961 return `NoSuchMethodError: ${this[_message]}`; | |
| 962 if (this[_receiver] == null) { | |
| 963 return `NoSuchMethodError: Cannot call "${this[_method]}" (${this[_messa
ge]})`; | |
| 964 } | |
| 965 return `NoSuchMethodError: Cannot call "${this[_method]}" on "${this[_rece
iver]}" ` + `(${this[_message]})`; | |
| 966 } | |
| 967 } | |
| 968 JsNoSuchMethodError[dart.implements] = () => [core.NoSuchMethodError]; | |
| 969 dart.setSignature(JsNoSuchMethodError, { | |
| 970 constructors: () => ({JsNoSuchMethodError: [JsNoSuchMethodError, [core.Strin
g, dart.dynamic]]}) | |
| 971 }); | |
| 972 class UnknownJsTypeError extends core.Error { | |
| 973 UnknownJsTypeError(message) { | |
| 974 this[_message] = message; | |
| 975 super.Error(); | |
| 976 } | |
| 977 toString() { | |
| 978 return dart.notNull(this[_message][dartx.isEmpty]) ? 'Error' : `Error: ${t
his[_message]}`; | |
| 979 } | |
| 980 } | |
| 981 dart.setSignature(UnknownJsTypeError, { | |
| 982 constructors: () => ({UnknownJsTypeError: [UnknownJsTypeError, [core.String]
]}) | |
| 983 }); | |
| 984 function getTraceFromException(exception) { | |
| 985 return new _StackTrace(exception); | |
| 986 } | |
| 987 dart.fn(getTraceFromException, core.StackTrace, [dart.dynamic]); | |
| 988 let _exception = Symbol('_exception'); | |
| 989 let _trace = Symbol('_trace'); | |
| 990 class _StackTrace extends core.Object { | |
| 991 _StackTrace(exception) { | |
| 992 this[_exception] = exception; | |
| 993 this[_trace] = null; | |
| 994 } | |
| 995 toString() { | |
| 996 if (this[_trace] != null) | |
| 997 return this[_trace]; | |
| 998 let trace = null; | |
| 999 if (typeof this[_exception] === "object") { | |
| 1000 trace = dart.as(this[_exception].stack, core.String); | |
| 1001 } | |
| 1002 return this[_trace] = trace == null ? '' : trace; | |
| 1003 } | |
| 1004 } | |
| 1005 _StackTrace[dart.implements] = () => [core.StackTrace]; | |
| 1006 dart.setSignature(_StackTrace, { | |
| 1007 constructors: () => ({_StackTrace: [_StackTrace, [dart.dynamic]]}) | |
| 1008 }); | |
| 1009 function objectHashCode(object) { | |
| 1010 if (object == null || typeof object != 'object') { | |
| 1011 return dart.hashCode(object); | |
| 1012 } else { | |
| 1013 return Primitives.objectHashCode(object); | |
| 1014 } | |
| 1015 } | |
| 1016 dart.fn(objectHashCode, core.int, [dart.dynamic]); | |
| 1017 function fillLiteralMap(keyValuePairs, result) { | |
| 1018 let index = 0; | |
| 1019 let length = getLength(keyValuePairs); | |
| 1020 while (dart.notNull(index) < dart.notNull(length)) { | |
| 1021 let key = getIndex(keyValuePairs, (() => { | |
| 1022 let x = index; | |
| 1023 index = dart.notNull(x) + 1; | |
| 1024 return x; | |
| 1025 })()); | |
| 1026 let value = getIndex(keyValuePairs, (() => { | |
| 1027 let x = index; | |
| 1028 index = dart.notNull(x) + 1; | |
| 1029 return x; | |
| 1030 })()); | |
| 1031 result.set(key, value); | |
| 1032 } | |
| 1033 return result; | |
| 1034 } | |
| 1035 dart.fn(fillLiteralMap, dart.dynamic, [dart.dynamic, core.Map]); | |
| 1036 function jsHasOwnProperty(jsObject, property) { | |
| 1037 return jsObject.hasOwnProperty(property); | |
| 1038 } | |
| 1039 dart.fn(jsHasOwnProperty, core.bool, [dart.dynamic, core.String]); | |
| 1040 function jsPropertyAccess(jsObject, property) { | |
| 1041 return jsObject[property]; | |
| 1042 } | |
| 1043 dart.fn(jsPropertyAccess, dart.dynamic, [dart.dynamic, core.String]); | |
| 1044 function getFallThroughError() { | |
| 1045 return new FallThroughErrorImplementation(); | |
| 1046 } | |
| 1047 dart.fn(getFallThroughError); | |
| 1048 class Creates extends core.Object { | |
| 1049 Creates(types) { | |
| 1050 this.types = types; | |
| 1051 } | |
| 1052 } | |
| 1053 dart.setSignature(Creates, { | |
| 1054 constructors: () => ({Creates: [Creates, [core.String]]}) | |
| 1055 }); | |
| 1056 class Returns extends core.Object { | |
| 1057 Returns(types) { | |
| 1058 this.types = types; | |
| 1059 } | |
| 1060 } | |
| 1061 dart.setSignature(Returns, { | |
| 1062 constructors: () => ({Returns: [Returns, [core.String]]}) | |
| 1063 }); | |
| 1064 class JSName extends core.Object { | |
| 1065 JSName(name) { | |
| 1066 this.name = name; | |
| 1067 } | |
| 1068 } | |
| 1069 dart.setSignature(JSName, { | |
| 1070 constructors: () => ({JSName: [JSName, [core.String]]}) | |
| 1071 }); | |
| 1072 class JavaScriptIndexingBehavior extends _interceptors.JSMutableIndexable {} | |
| 1073 class TypeErrorImplementation extends core.Error { | |
| 1074 TypeErrorImplementation(value, type) { | |
| 1075 this.message = `type '${Primitives.objectTypeName(value)}' is not a subtyp
e ` + `of type '${type}'`; | |
| 1076 super.Error(); | |
| 1077 } | |
| 1078 fromMessage(message) { | |
| 1079 this.message = message; | |
| 1080 super.Error(); | |
| 1081 } | |
| 1082 toString() { | |
| 1083 return this.message; | |
| 1084 } | |
| 1085 } | |
| 1086 TypeErrorImplementation[dart.implements] = () => [core.TypeError]; | |
| 1087 dart.defineNamedConstructor(TypeErrorImplementation, 'fromMessage'); | |
| 1088 dart.setSignature(TypeErrorImplementation, { | |
| 1089 constructors: () => ({ | |
| 1090 TypeErrorImplementation: [TypeErrorImplementation, [core.Object, core.Stri
ng]], | |
| 1091 fromMessage: [TypeErrorImplementation, [core.String]] | |
| 1092 }) | |
| 1093 }); | |
| 1094 class CastErrorImplementation extends core.Error { | |
| 1095 CastErrorImplementation(actualType, expectedType) { | |
| 1096 this.message = `CastError: Casting value of type ${actualType} to` + ` inc
ompatible type ${expectedType}`; | |
| 1097 super.Error(); | |
| 1098 } | |
| 1099 toString() { | |
| 1100 return this.message; | |
| 1101 } | |
| 1102 } | |
| 1103 CastErrorImplementation[dart.implements] = () => [core.CastError]; | |
| 1104 dart.setSignature(CastErrorImplementation, { | |
| 1105 constructors: () => ({CastErrorImplementation: [CastErrorImplementation, [co
re.Object, core.Object]]}) | |
| 1106 }); | |
| 1107 class FallThroughErrorImplementation extends core.FallThroughError { | |
| 1108 FallThroughErrorImplementation() { | |
| 1109 super.FallThroughError(); | |
| 1110 } | |
| 1111 toString() { | |
| 1112 return "Switch case fall-through."; | |
| 1113 } | |
| 1114 } | |
| 1115 dart.setSignature(FallThroughErrorImplementation, { | |
| 1116 constructors: () => ({FallThroughErrorImplementation: [FallThroughErrorImple
mentation, []]}) | |
| 1117 }); | |
| 1118 class RuntimeError extends core.Error { | |
| 1119 RuntimeError(message) { | |
| 1120 this.message = message; | |
| 1121 super.Error(); | |
| 1122 } | |
| 1123 toString() { | |
| 1124 return `RuntimeError: ${this.message}`; | |
| 1125 } | |
| 1126 } | |
| 1127 dart.setSignature(RuntimeError, { | |
| 1128 constructors: () => ({RuntimeError: [RuntimeError, [dart.dynamic]]}) | |
| 1129 }); | |
| 1130 function random64() { | |
| 1131 let int32a = Math.random() * 0x100000000 >>> 0; | |
| 1132 let int32b = Math.random() * 0x100000000 >>> 0; | |
| 1133 return dart.notNull(int32a) + dart.notNull(int32b) * 4294967296; | |
| 1134 } | |
| 1135 dart.fn(random64, core.int, []); | |
| 1136 function jsonEncodeNative(string) { | |
| 1137 return JSON.stringify(string); | |
| 1138 } | |
| 1139 dart.fn(jsonEncodeNative, core.String, [core.String]); | |
| 1140 let _jsIterator = Symbol('_jsIterator'); | |
| 1141 let SyncIterator$ = dart.generic(function(E) { | |
| 1142 class SyncIterator extends core.Object { | |
| 1143 SyncIterator(jsIterator) { | |
| 1144 this[_jsIterator] = jsIterator; | |
| 1145 this[_current] = null; | |
| 1146 } | |
| 1147 get current() { | |
| 1148 return this[_current]; | |
| 1149 } | |
| 1150 moveNext() { | |
| 1151 let ret = this[_jsIterator].next(); | |
| 1152 this[_current] = dart.as(ret.value, E); | |
| 1153 return !ret.done; | |
| 1154 } | |
| 1155 } | |
| 1156 SyncIterator[dart.implements] = () => [core.Iterator$(E)]; | |
| 1157 dart.setSignature(SyncIterator, { | |
| 1158 constructors: () => ({SyncIterator: [SyncIterator$(E), [dart.dynamic]]}), | |
| 1159 methods: () => ({moveNext: [core.bool, []]}) | |
| 1160 }); | |
| 1161 return SyncIterator; | |
| 1162 }); | |
| 1163 let SyncIterator = SyncIterator$(); | |
| 1164 let _generator = Symbol('_generator'); | |
| 1165 let _args = Symbol('_args'); | |
| 1166 let SyncIterable$ = dart.generic(function(E) { | |
| 1167 class SyncIterable extends collection.IterableBase$(E) { | |
| 1168 SyncIterable(generator, args) { | |
| 1169 this[_generator] = generator; | |
| 1170 this[_args] = args; | |
| 1171 super.IterableBase(); | |
| 1172 } | |
| 1173 [_jsIterator]() { | |
| 1174 return this[_generator](...this[_args]); | |
| 1175 } | |
| 1176 get iterator() { | |
| 1177 return new (SyncIterator$(E))(this[_jsIterator]()); | |
| 1178 } | |
| 1179 } | |
| 1180 dart.setSignature(SyncIterable, { | |
| 1181 constructors: () => ({SyncIterable: [SyncIterable$(E), [dart.dynamic, dart
.dynamic]]}), | |
| 1182 methods: () => ({[_jsIterator]: [dart.dynamic, []]}) | |
| 1183 }); | |
| 1184 dart.defineExtensionMembers(SyncIterable, ['iterator']); | |
| 1185 return SyncIterable; | |
| 1186 }); | |
| 1187 let SyncIterable = SyncIterable$(); | |
| 1188 // Exports: | |
| 1189 exports.NoThrows = NoThrows; | |
| 1190 exports.NoInline = NoInline; | |
| 1191 exports.Native = Native; | |
| 1192 exports.JsName = JsName; | |
| 1193 exports.JsPeerInterface = JsPeerInterface; | |
| 1194 exports.SupportJsExtensionMethods = SupportJsExtensionMethods; | |
| 1195 exports.defineProperty = defineProperty; | |
| 1196 exports.regExpGetNative = regExpGetNative; | |
| 1197 exports.regExpGetGlobalNative = regExpGetGlobalNative; | |
| 1198 exports.regExpCaptureCount = regExpCaptureCount; | |
| 1199 exports.JSSyntaxRegExp = JSSyntaxRegExp; | |
| 1200 exports.firstMatchAfter = firstMatchAfter; | |
| 1201 exports.StringMatch = StringMatch; | |
| 1202 exports.allMatchesInStringUnchecked = allMatchesInStringUnchecked; | |
| 1203 exports.stringContainsUnchecked = stringContainsUnchecked; | |
| 1204 exports.stringReplaceJS = stringReplaceJS; | |
| 1205 exports.stringReplaceFirstRE = stringReplaceFirstRE; | |
| 1206 exports.ESCAPE_REGEXP = ESCAPE_REGEXP; | |
| 1207 exports.stringReplaceAllUnchecked = stringReplaceAllUnchecked; | |
| 1208 exports.stringReplaceAllFuncUnchecked = stringReplaceAllFuncUnchecked; | |
| 1209 exports.stringReplaceAllEmptyFuncUnchecked = stringReplaceAllEmptyFuncUnchecke
d; | |
| 1210 exports.stringReplaceAllStringFuncUnchecked = stringReplaceAllStringFuncUnchec
ked; | |
| 1211 exports.stringReplaceFirstUnchecked = stringReplaceFirstUnchecked; | |
| 1212 exports.stringJoinUnchecked = stringJoinUnchecked; | |
| 1213 exports.getRuntimeType = getRuntimeType; | |
| 1214 exports.getIndex = getIndex; | |
| 1215 exports.getLength = getLength; | |
| 1216 exports.isJsArray = isJsArray; | |
| 1217 exports.patch = patch; | |
| 1218 exports.InternalMap = InternalMap; | |
| 1219 exports.Primitives = Primitives; | |
| 1220 exports.stringLastIndexOfUnchecked = stringLastIndexOfUnchecked; | |
| 1221 exports.checkNull = checkNull; | |
| 1222 exports.checkNum = checkNum; | |
| 1223 exports.checkInt = checkInt; | |
| 1224 exports.checkBool = checkBool; | |
| 1225 exports.checkString = checkString; | |
| 1226 exports.throwRuntimeError = throwRuntimeError; | |
| 1227 exports.throwAbstractClassInstantiationError = throwAbstractClassInstantiation
Error; | |
| 1228 exports.NullError = NullError; | |
| 1229 exports.JsNoSuchMethodError = JsNoSuchMethodError; | |
| 1230 exports.UnknownJsTypeError = UnknownJsTypeError; | |
| 1231 exports.getTraceFromException = getTraceFromException; | |
| 1232 exports.objectHashCode = objectHashCode; | |
| 1233 exports.fillLiteralMap = fillLiteralMap; | |
| 1234 exports.jsHasOwnProperty = jsHasOwnProperty; | |
| 1235 exports.jsPropertyAccess = jsPropertyAccess; | |
| 1236 exports.getFallThroughError = getFallThroughError; | |
| 1237 exports.Creates = Creates; | |
| 1238 exports.Returns = Returns; | |
| 1239 exports.JSName = JSName; | |
| 1240 exports.JavaScriptIndexingBehavior = JavaScriptIndexingBehavior; | |
| 1241 exports.TypeErrorImplementation = TypeErrorImplementation; | |
| 1242 exports.CastErrorImplementation = CastErrorImplementation; | |
| 1243 exports.FallThroughErrorImplementation = FallThroughErrorImplementation; | |
| 1244 exports.RuntimeError = RuntimeError; | |
| 1245 exports.random64 = random64; | |
| 1246 exports.jsonEncodeNative = jsonEncodeNative; | |
| 1247 exports.SyncIterator$ = SyncIterator$; | |
| 1248 exports.SyncIterator = SyncIterator; | |
| 1249 exports.SyncIterable$ = SyncIterable$; | |
| 1250 exports.SyncIterable = SyncIterable; | |
| 1251 }); | |
| OLD | NEW |