Changelog: swc v1.1.14

Bugfixes#

throw in nested finally block (#601)#

Previously,

function* foo() {
try {
} finally {
try {
} finally {
throw new Error("foo");
}
}
}

make swc panic. swc is now ok with it.

It was really hard to create a minimal reporduction case.

use-use conflict in hygiene (#599)#

All of the _templateObject in below code refer to differect function.

export function foo() {
console.log(i18n(_templateObject()));
console.log(i18n(_templateObject()));
console.log(i18n(_templateObject()));
console.log(i18n(_templateObject()));
}

But as previously swc cannot detect use-use conflict, it was miscompiled as-is.

Optimizer bug (#596)#

Thanks to @erikdesjardins, swc's optimizer does not break codes like

if (0 | x) y = 1;
else y = 2;
if (1 | x) y = 1;
else y = 2;
if (0 & x) y = 1;
else y = 2;
if (1 & x) y = 1;
else y = 2;

Span improvements#

Thanks to @dsherret, there are more span improvements.

  • as and const assertions (#593)
  • semicolon of a dynamic import statement (#595)