Skip to content

Commit

Permalink
fix a es3 reserved word usage, close #980
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Sep 1, 2021
1 parent 9f0fc9e commit 4cd6fa6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -3,7 +3,8 @@
- [Accessible `Object.prototype.hasOwnProperty` (`Object.hasOwn`) proposal](https://github.com/tc39/proposal-accessible-object-hasownproperty) moved to the stable ES, [per August 2021 TC39 meeting](https://github.com/babel/proposals/issues/76#issuecomment-909288348)
- [Relative indexing method (`.at`) proposal](https://github.com/tc39/proposal-relative-indexing-method) moved to the stable ES, [per August 2021 TC39 meeting](https://github.com/babel/proposals/issues/76#issuecomment-909285053)
- Exposed by default the stable version of `String.prototype.at`. It was not exposed because of the conflict with the alternative obsolete proposal (that will be completely removed in the next major version). For the backward compatibility, in the case of loading this proposal, it will be overwritten.
- Some more iteration closing fixes
- Some more iteration closing fixes
- Fixed a ES3 reserved word usage, [#980](https://github.com/zloirock/core-js/issues/980)

##### 3.16.4 - 2021.08.29
- `AsyncFromSyncIterator` made stricter, related mainly to `AsyncIterator.from` and `AsyncIterator.prototype.flatMap`
Expand Down
30 changes: 15 additions & 15 deletions packages/core-js/modules/web.url.js
Expand Up @@ -118,45 +118,45 @@ var parseIPv6 = function (input) {
var pointer = 0;
var value, length, numbersSeen, ipv4Piece, number, swaps, swap;

var char = function () {
var chr = function () {
return input.charAt(pointer);
};

if (char() == ':') {
if (chr() == ':') {
if (input.charAt(1) != ':') return;
pointer += 2;
pieceIndex++;
compress = pieceIndex;
}
while (char()) {
while (chr()) {
if (pieceIndex == 8) return;
if (char() == ':') {
if (chr() == ':') {
if (compress !== null) return;
pointer++;
pieceIndex++;
compress = pieceIndex;
continue;
}
value = length = 0;
while (length < 4 && HEX.test(char())) {
value = value * 16 + parseInt(char(), 16);
while (length < 4 && HEX.test(chr())) {
value = value * 16 + parseInt(chr(), 16);
pointer++;
length++;
}
if (char() == '.') {
if (chr() == '.') {
if (length == 0) return;
pointer -= length;
if (pieceIndex > 6) return;
numbersSeen = 0;
while (char()) {
while (chr()) {
ipv4Piece = null;
if (numbersSeen > 0) {
if (char() == '.' && numbersSeen < 4) pointer++;
if (chr() == '.' && numbersSeen < 4) pointer++;
else return;
}
if (!DIGIT.test(char())) return;
while (DIGIT.test(char())) {
number = parseInt(char(), 10);
if (!DIGIT.test(chr())) return;
while (DIGIT.test(chr())) {
number = parseInt(chr(), 10);
if (ipv4Piece === null) ipv4Piece = number;
else if (ipv4Piece == 0) return;
else ipv4Piece = ipv4Piece * 10 + number;
Expand All @@ -169,10 +169,10 @@ var parseIPv6 = function (input) {
}
if (numbersSeen != 4) return;
break;
} else if (char() == ':') {
} else if (chr() == ':') {
pointer++;
if (!char()) return;
} else if (char()) return;
if (!chr()) return;
} else if (chr()) return;
address[pieceIndex++] = value;
}
if (compress !== null) {
Expand Down

0 comments on commit 4cd6fa6

Please sign in to comment.