| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 startIndex = endIndex; | 345 startIndex = endIndex; |
| 346 } | 346 } |
| 347 } | 347 } |
| 348 return result; | 348 return result; |
| 349 } | 349 } |
| 350 dart.fn(allMatchesInStringUnchecked, core.List$(core.Match), [core.String, cor
e.String, core.int]); | 350 dart.fn(allMatchesInStringUnchecked, core.List$(core.Match), [core.String, cor
e.String, core.int]); |
| 351 function stringContainsUnchecked(receiver, other, startIndex) { | 351 function stringContainsUnchecked(receiver, other, startIndex) { |
| 352 if (typeof other == 'string') { | 352 if (typeof other == 'string') { |
| 353 return !dart.equals(dart.dsend(receiver, 'indexOf', other, startIndex), -1
); | 353 return !dart.equals(dart.dsend(receiver, 'indexOf', other, startIndex), -1
); |
| 354 } else if (dart.is(other, JSSyntaxRegExp)) { | 354 } else if (dart.is(other, JSSyntaxRegExp)) { |
| 355 return dart.dsend(other, 'hasMatch', dart.dsend(receiver, 'substring', sta
rtIndex)); | 355 return other.hasMatch(dart.as(dart.dsend(receiver, 'substring', startIndex
), core.String)); |
| 356 } else { | 356 } else { |
| 357 let substr = dart.dsend(receiver, 'substring', startIndex); | 357 let substr = dart.dsend(receiver, 'substring', startIndex); |
| 358 return dart.dload(dart.dsend(other, 'allMatches', substr), 'isNotEmpty'); | 358 return dart.dload(dart.dsend(other, 'allMatches', substr), 'isNotEmpty'); |
| 359 } | 359 } |
| 360 } | 360 } |
| 361 dart.fn(stringContainsUnchecked); | 361 dart.fn(stringContainsUnchecked); |
| 362 function stringReplaceJS(receiver, replacer, to) { | 362 function stringReplaceJS(receiver, replacer, to) { |
| 363 to = to.replace(/\$/g, "$$$$"); | 363 to = to.replace(/\$/g, "$$$$"); |
| 364 return receiver.replace(replacer, to); | 364 return receiver.replace(replacer, to); |
| 365 } | 365 } |
| 366 dart.fn(stringReplaceJS); | 366 dart.fn(stringReplaceJS); |
| 367 function stringReplaceFirstRE(receiver, regexp, to, startIndex) { | 367 function stringReplaceFirstRE(receiver, regexp, to, startIndex) { |
| 368 let match = dart.dsend(regexp, _execGlobal, receiver, startIndex); | 368 let match = dart.dsend(regexp, _execGlobal, receiver, startIndex); |
| 369 if (match == null) return receiver; | 369 if (match == null) return receiver; |
| 370 let start = dart.dload(match, 'start'); | 370 let start = dart.dload(match, 'start'); |
| 371 let end = dart.dload(match, 'end'); | 371 let end = dart.dload(match, 'end'); |
| 372 return `${dart.dsend(receiver, 'substring', 0, start)}${to}${dart.dsend(rece
iver, 'substring', end)}`; | 372 return `${dart.dsend(receiver, 'substring', 0, start)}${to}${dart.dsend(rece
iver, 'substring', end)}`; |
| 373 } | 373 } |
| 374 dart.fn(stringReplaceFirstRE); | 374 dart.fn(stringReplaceFirstRE); |
| 375 const ESCAPE_REGEXP = '[[\\]{}()*+?.\\\\^$|]'; | 375 const ESCAPE_REGEXP = '[[\\]{}()*+?.\\\\^$|]'; |
| 376 function stringReplaceAllUnchecked(receiver, from, to) { | 376 function stringReplaceAllUnchecked(receiver, from, to) { |
| 377 checkString(to); | 377 checkString(to); |
| 378 if (typeof from == 'string') { | 378 if (typeof from == 'string') { |
| 379 if (dart.equals(from, "")) { | 379 if (from == "") { |
| 380 if (dart.equals(receiver, "")) { | 380 if (dart.equals(receiver, "")) { |
| 381 return to; | 381 return to; |
| 382 } else { | 382 } else { |
| 383 let result = new core.StringBuffer(); | 383 let result = new core.StringBuffer(); |
| 384 let length = dart.as(dart.dload(receiver, 'length'), core.int); | 384 let length = dart.as(dart.dload(receiver, 'length'), core.int); |
| 385 result.write(to); | 385 result.write(to); |
| 386 for (let i = 0; i < dart.notNull(length); i++) { | 386 for (let i = 0; i < dart.notNull(length); i++) { |
| 387 result.write(dart.dindex(receiver, i)); | 387 result.write(dart.dindex(receiver, i)); |
| 388 result.write(to); | 388 result.write(to); |
| 389 } | 389 } |
| 390 return dart.toString(result); | 390 return dart.toString(result); |
| 391 } | 391 } |
| 392 } else { | 392 } else { |
| 393 let quoter = new RegExp(ESCAPE_REGEXP, 'g'); | 393 let quoter = new RegExp(ESCAPE_REGEXP, 'g'); |
| 394 let quoted = from.replace(quoter, "\\$&"); | 394 let quoted = from.replace(quoter, "\\$&"); |
| 395 let replacer = new RegExp(quoted, 'g'); | 395 let replacer = new RegExp(quoted, 'g'); |
| 396 return stringReplaceJS(receiver, replacer, to); | 396 return stringReplaceJS(receiver, replacer, to); |
| 397 } | 397 } |
| 398 } else if (dart.is(from, JSSyntaxRegExp)) { | 398 } else if (dart.is(from, JSSyntaxRegExp)) { |
| 399 let re = regExpGetGlobalNative(dart.as(from, JSSyntaxRegExp)); | 399 let re = regExpGetGlobalNative(from); |
| 400 return stringReplaceJS(receiver, re, to); | 400 return stringReplaceJS(receiver, re, to); |
| 401 } else { | 401 } else { |
| 402 checkNull(from); | 402 checkNull(from); |
| 403 dart.throw("String.replaceAll(Pattern) UNIMPLEMENTED"); | 403 dart.throw("String.replaceAll(Pattern) UNIMPLEMENTED"); |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 dart.fn(stringReplaceAllUnchecked); | 406 dart.fn(stringReplaceAllUnchecked); |
| 407 function _matchString(match) { | 407 function _matchString(match) { |
| 408 return match.get(0); | 408 return match.get(0); |
| 409 } | 409 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 } | 475 } |
| 476 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring', startI
ndex))); | 476 buffer.write(dart.dcall(onNonMatch, dart.dsend(receiver, 'substring', startI
ndex))); |
| 477 return dart.toString(buffer); | 477 return dart.toString(buffer); |
| 478 } | 478 } |
| 479 dart.fn(stringReplaceAllStringFuncUnchecked); | 479 dart.fn(stringReplaceAllStringFuncUnchecked); |
| 480 function stringReplaceFirstUnchecked(receiver, from, to, startIndex) { | 480 function stringReplaceFirstUnchecked(receiver, from, to, startIndex) { |
| 481 if (startIndex === void 0) startIndex = 0; | 481 if (startIndex === void 0) startIndex = 0; |
| 482 if (typeof from == 'string') { | 482 if (typeof from == 'string') { |
| 483 let index = dart.dsend(receiver, 'indexOf', from, startIndex); | 483 let index = dart.dsend(receiver, 'indexOf', from, startIndex); |
| 484 if (dart.notNull(dart.as(dart.dsend(index, '<', 0), core.bool))) return re
ceiver; | 484 if (dart.notNull(dart.as(dart.dsend(index, '<', 0), core.bool))) return re
ceiver; |
| 485 return `${dart.dsend(receiver, 'substring', 0, index)}${to}` + `${dart.dse
nd(receiver, 'substring', dart.dsend(index, '+', dart.dload(from, 'length')))}`; | 485 return `${dart.dsend(receiver, 'substring', 0, index)}${to}` + `${dart.dse
nd(receiver, 'substring', dart.dsend(index, '+', from[dartx.length]))}`; |
| 486 } else if (dart.is(from, JSSyntaxRegExp)) { | 486 } else if (dart.is(from, JSSyntaxRegExp)) { |
| 487 return startIndex == 0 ? stringReplaceJS(receiver, regExpGetNative(dart.as
(from, JSSyntaxRegExp)), to) : stringReplaceFirstRE(receiver, from, to, startInd
ex); | 487 return startIndex == 0 ? stringReplaceJS(receiver, regExpGetNative(from),
to) : stringReplaceFirstRE(receiver, from, to, startIndex); |
| 488 } else { | 488 } else { |
| 489 checkNull(from); | 489 checkNull(from); |
| 490 dart.throw("String.replace(Pattern) UNIMPLEMENTED"); | 490 dart.throw("String.replace(Pattern) UNIMPLEMENTED"); |
| 491 } | 491 } |
| 492 } | 492 } |
| 493 dart.fn(stringReplaceFirstUnchecked, dart.dynamic, [dart.dynamic, dart.dynamic
, dart.dynamic], [core.int]); | 493 dart.fn(stringReplaceFirstUnchecked, dart.dynamic, [dart.dynamic, dart.dynamic
, dart.dynamic], [core.int]); |
| 494 function stringJoinUnchecked(array, separator) { | 494 function stringJoinUnchecked(array, separator) { |
| 495 return array.join(separator); | 495 return array.join(separator); |
| 496 } | 496 } |
| 497 dart.fn(stringJoinUnchecked); | 497 dart.fn(stringJoinUnchecked); |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 exports.CastErrorImplementation = CastErrorImplementation; | 1185 exports.CastErrorImplementation = CastErrorImplementation; |
| 1186 exports.FallThroughErrorImplementation = FallThroughErrorImplementation; | 1186 exports.FallThroughErrorImplementation = FallThroughErrorImplementation; |
| 1187 exports.RuntimeError = RuntimeError; | 1187 exports.RuntimeError = RuntimeError; |
| 1188 exports.random64 = random64; | 1188 exports.random64 = random64; |
| 1189 exports.jsonEncodeNative = jsonEncodeNative; | 1189 exports.jsonEncodeNative = jsonEncodeNative; |
| 1190 exports.SyncIterator$ = SyncIterator$; | 1190 exports.SyncIterator$ = SyncIterator$; |
| 1191 exports.SyncIterator = SyncIterator; | 1191 exports.SyncIterator = SyncIterator; |
| 1192 exports.SyncIterable$ = SyncIterable$; | 1192 exports.SyncIterable$ = SyncIterable$; |
| 1193 exports.SyncIterable = SyncIterable; | 1193 exports.SyncIterable = SyncIterable; |
| 1194 }); | 1194 }); |
| OLD | NEW |