2021-02-23 14:55:08 +00:00
constructor _1 : {
input : {
"use strict" ;
console . log ( new class {
constructor ( a ) {
this . a = a ;
}
} ( "PASS" ) . a ) ;
}
expect _exact : '"use strict";console.log(new class{constructor(a){this.a=a}}("PASS").a);'
expect _stdout : "PASS"
node _version : ">=4"
}
constructor _2 : {
input : {
"use strict" ;
console . log ( new class {
"constructor" ( a ) {
this . a = a ;
}
} ( "PASS" ) . a ) ;
}
expect _exact : '"use strict";console.log(new class{constructor(a){this.a=a}}("PASS").a);'
expect _stdout : "PASS"
node _version : ">=4"
}
constructor _3 : {
input : {
"use strict" ;
console . log ( new class {
[ "constructor" ] ( a ) {
this . a = a ;
}
} ( "FAIL" ) . a || "PASS" ) ;
}
expect _exact : '"use strict";console.log(new class{["constructor"](a){this.a=a}}("FAIL").a||"PASS");'
expect _stdout : "PASS"
node _version : ">=4"
}
constructor _4 : {
input : {
"use strict" ;
class A {
static constructor ( a ) {
console . log ( a ) ;
}
}
A . constructor ( "PASS" ) ;
}
expect _exact : '"use strict";class A{static constructor(a){console.log(a)}}A.constructor("PASS");'
expect _stdout : "PASS"
node _version : ">=4"
}
fields : {
input : {
var o = new class A {
"#p" ;
static # p = "PASS" ;
async
get
q ( ) {
return A . # p ;
}
;
[ 6 * 7 ] = console ? "foo" : "bar"
} ;
for ( var k in o )
console . log ( k , o [ k ] ) ;
console . log ( o . q ) ;
}
2021-05-22 02:12:37 +00:00
expect _exact : 'var o=new class A{"#p";static#p="PASS";async;get q(){return A.#p}[6*7]=console?"foo":"bar"};for(var k in o)console.log(k,o[k]);console.log(o.q);'
2021-02-23 14:55:08 +00:00
expect _stdout : [
"42 foo" ,
"#p undefined" ,
"async undefined" ,
"PASS" ,
]
node _version : ">=12"
}
2021-03-02 04:08:08 +00:00
modifier _as _field _name : {
input : {
for ( var k in new class { async ; static = 42 } )
console . log ( k ) ;
}
expect _exact : "for(var k in new class{async;static=42})console.log(k);"
expect _stdout : [
"async" ,
"static" ,
]
node _version : ">=12"
}
2021-02-23 14:55:08 +00:00
methods : {
input : {
"use strict" ;
class A {
static f ( ) {
return "foo" ;
}
* g ( ) {
yield A . f ( ) ;
yield "bar" ;
}
}
for ( var a of new A ( ) . g ( ) )
console . log ( a ) ;
}
expect _exact : '"use strict";class A{static f(){return"foo"}*g(){yield A.f();yield"bar"}}for(var a of(new A).g())console.log(a);'
expect _stdout : [
"foo" ,
"bar" ,
]
node _version : ">=4"
}
private _methods : {
input : {
new class A {
static * # f ( ) {
yield A . # p * 3 ;
}
async # g ( ) {
for ( var a of A . # f ( ) )
return a * await 2 ;
}
static get # p ( ) {
return 7 ;
}
get q ( ) {
return this . # g ( ) ;
}
} ( ) . q . then ( console . log ) ;
}
2021-05-22 02:12:37 +00:00
expect _exact : "(new class A{static*#f(){yield 3*A.#p}async#g(){for(var a of A.#f())return a*await 2}static get#p(){return 7}get q(){return this.#g()}}).q.then(console.log);"
2021-02-23 14:55:08 +00:00
expect _stdout : "42"
2021-03-01 20:55:09 +00:00
node _version : ">=14.6"
2021-02-23 14:55:08 +00:00
}
await : {
input : {
var await = "PASS" ;
( async function ( ) {
return await new class extends ( await function ( ) { } ) { [ await 42 ] = await } ;
} ) ( ) . then ( function ( o ) {
console . log ( o [ 42 ] ) ;
} ) ;
}
expect _exact : 'var await="PASS";(async function(){return await new class extends(await function(){}){[await 42]=await}})().then(function(o){console.log(o[42])});'
expect _stdout : "PASS"
node _version : ">=12"
}
yield : {
input : {
var a = function * ( ) {
yield new class { [ yield "foo" ] = "bar" } ;
} ( ) ;
console . log ( a . next ( ) . value ) ;
console . log ( a . next ( 42 ) . value [ 42 ] ) ;
}
expect _exact : 'var a=function*(){yield new class{[yield"foo"]="bar"}}();console.log(a.next().value);console.log(a.next(42).value[42]);'
expect _stdout : [
"foo" ,
"bar" ,
]
node _version : ">=12"
}
2021-02-23 21:57:11 +00:00
conditional _parentheses : {
2021-02-23 14:55:08 +00:00
options = {
conditionals : true ,
}
input : {
"use strict" ;
if ( class { } )
console . log ( "PASS" ) ;
}
expect _exact : '"use strict";(class{})&&console.log("PASS");'
expect _stdout : "PASS"
node _version : ">=4"
}
class _super : {
input : {
"use strict" ;
class A {
static get p ( ) {
return "Foo" ;
}
static get q ( ) {
return super . p || 42 ;
}
constructor ( ) {
console . log ( "a.p" , super . p , this . p ) ;
console . log ( "a.q" , super . q , this . q ) ;
}
get p ( ) {
return "foo" ;
}
get q ( ) {
return super . p || null ;
}
}
class B extends A {
static get p ( ) {
return "Bar" ;
}
static get q ( ) {
return super . p ;
}
constructor ( ) {
super ( ) ;
console . log ( "b.p" , super . p , this . p ) ;
console . log ( "b.q" , super . q , this . q ) ;
}
get p ( ) {
return "bar" ;
}
get q ( ) {
return super . p ;
}
}
console . log ( "A" , A . p , A . q ) ;
console . log ( "B" , B . p , B . q ) ;
new B ( ) ;
}
expect _exact : '"use strict";class A{static get p(){return"Foo"}static get q(){return super.p||42}constructor(){console.log("a.p",super.p,this.p);console.log("a.q",super.q,this.q)}get p(){return"foo"}get q(){return super.p||null}}class B extends A{static get p(){return"Bar"}static get q(){return super.p}constructor(){super();console.log("b.p",super.p,this.p);console.log("b.q",super.q,this.q)}get p(){return"bar"}get q(){return super.p}}console.log("A",A.p,A.q);console.log("B",B.p,B.q);new B;'
expect _stdout : [
"A Foo 42" ,
"B Bar Foo" ,
"a.p undefined bar" ,
"a.q undefined foo" ,
"b.p foo bar" ,
"b.q null foo" ,
]
node _version : ">=4"
}
2022-06-06 04:01:15 +00:00
static _init : {
input : {
var a = "foo" ;
var b = null ;
class A {
static {
var a = "bar" ;
b = true ;
var c = 42 ;
console . log ( a , b , c ) ;
}
}
console . log ( a , b , typeof c ) ;
}
expect _exact : 'var a="foo";var b=null;class A{static{var a="bar";b=true;var c=42;console.log(a,b,c)}}console.log(a,b,typeof c);'
expect _stdout : [
"bar true 42" ,
"foo true undefined" ,
]
node _version : ">=16"
}
static _field _init : {
options = {
side _effects : true ,
}
input : {
( class {
static [ console . log ( "foo" ) ] = console . log ( "bar" ) ;
static {
console . log ( "baz" ) ;
}
static [ console . log ( "moo" ) ] = console . log ( "moz" ) ;
} ) ;
}
expect : {
( class {
static [ ( console . log ( "foo" ) , console . log ( "moo" ) ) ] = (
console . log ( "bar" ) ,
( ( ) => {
console . log ( "baz" ) ;
} ) ( ) ,
console . log ( "moz" )
) ;
} ) ;
}
expect _stdout : [
"foo" ,
"moo" ,
"bar" ,
"baz" ,
"moz" ,
]
node _version : ">=16"
}
static _field _init _strict : {
options = {
side _effects : true ,
}
input : {
"use strict" ;
( class {
static [ console . log ( "foo" ) ] = console . log ( "bar" ) ;
static {
console . log ( "baz" ) ;
}
static [ console . log ( "moo" ) ] = console . log ( "moz" ) ;
} ) ;
}
expect : {
"use strict" ;
console . log ( "foo" ) ,
console . log ( "moo" ) ,
( ( ) => (
console . log ( "bar" ) ,
( ( ) => {
console . log ( "baz" ) ;
} ) ( ) ,
console . log ( "moz" )
) ) ( ) ;
}
expect _stdout : [
"foo" ,
"moo" ,
"bar" ,
"baz" ,
"moz" ,
]
node _version : ">=16"
}
static _init _side _effects _1 : {
options = {
merge _vars : true ,
side _effects : true ,
}
input : {
var a = "FAIL" ;
( class {
static {
a = "PASS" ;
}
} ) ;
console . log ( a ) ;
}
expect : {
var a = "FAIL" ;
( class {
static {
a = "PASS" ;
}
} ) ;
console . log ( a ) ;
}
expect _stdout : "PASS"
node _version : ">=16"
}
static _init _side _effects _1 _strict : {
options = {
merge _vars : true ,
side _effects : true ,
}
input : {
"use strict" ;
var a = "FAIL" ;
( class {
static {
a = "PASS" ;
}
} ) ;
console . log ( a ) ;
}
expect : {
"use strict" ;
var a = "FAIL" ;
( ( ) => ( ( ) => {
a = "PASS" ;
} ) ( ) ) ( ) ;
console . log ( a ) ;
}
expect _stdout : "PASS"
node _version : ">=16"
}
static _init _side _effects _2 : {
options = {
hoist _props : true ,
reduce _vars : true ,
side _effects : true ,
}
input : {
var a = "FAIL" ;
( class {
static {
a = "PASS" ;
}
} ) ;
console . log ( a ) ;
}
expect : {
var a = "FAIL" ;
( class {
static {
a = "PASS" ;
}
} ) ;
console . log ( a ) ;
}
expect _stdout : "PASS"
node _version : ">=16"
}
static _init _side _effects _2 _strict : {
options = {
hoist _props : true ,
reduce _vars : true ,
side _effects : true ,
}
input : {
"use strict" ;
var a = "FAIL" ;
( class {
static {
a = "PASS" ;
}
} ) ;
console . log ( a ) ;
}
expect : {
"use strict" ;
var a = "FAIL" ;
( ( ) => ( ( ) => {
a = "PASS" ;
} ) ( ) ) ( ) ;
console . log ( a ) ;
}
expect _stdout : "PASS"
node _version : ">=16"
}
2021-02-23 14:55:08 +00:00
block _scoped : {
options = {
evaluate : true ,
dead _code : true ,
loops : true ,
}
input : {
"use strict" ;
while ( 0 ) {
class A { }
}
if ( console ) {
class B { }
}
console . log ( typeof A , typeof B ) ;
}
expect : {
"use strict" ;
0 ;
2021-05-29 19:16:18 +00:00
{
class A { }
}
2021-02-23 14:55:08 +00:00
if ( console ) {
class B { }
}
console . log ( typeof A , typeof B ) ;
}
expect _stdout : "undefined undefined"
node _version : ">=4"
}
2021-05-29 19:16:18 +00:00
retain _declaration : {
options = {
dead _code : true ,
}
input : {
"use strict" ;
var a = "FAIL" ;
try {
console . log ( function ( ) {
return a ;
class a { }
} ( ) ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect : {
"use strict" ;
var a = "FAIL" ;
try {
console . log ( function ( ) {
return a ;
class a { }
} ( ) ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect _stdout : "PASS"
node _version : ">=4"
}
2021-03-02 05:43:10 +00:00
drop _extends : {
options = {
inline : true ,
passes : 2 ,
pure _getters : "strict" ,
reduce _vars : true ,
sequences : true ,
side _effects : true ,
unused : true ,
}
input : {
"use strict" ;
try {
( function ( ) {
var f = ( ) => { } ;
class A extends f {
get p ( ) { }
}
A . q = 42 ;
return class B extends A { } ;
} ) ( ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect : {
"use strict" ;
try {
( class extends ( ( ) => { } ) { } ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect _stdout : "PASS"
node _version : ">=4"
}
2022-05-22 19:53:32 +00:00
keep _extends _1 : {
2021-02-23 14:55:08 +00:00
options = {
toplevel : true ,
unused : true ,
}
input : {
"use strict" ;
try {
class A extends 42 { }
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect : {
"use strict" ;
try {
( class extends 42 { } ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect _stdout : "PASS"
node _version : ">=4"
}
2022-05-22 19:53:32 +00:00
keep _extends _2 : {
options = {
side _effects : true ,
}
input : {
"use strict" ;
( class extends Function { } ) ;
console . log ( "PASS" ) ;
}
expect : {
"use strict" ;
( class extends Function { } ) ;
console . log ( "PASS" ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
keep _extends _3 : {
options = {
toplevel : true ,
unused : true ,
}
input : {
"use strict" ;
class A extends Function { }
console . log ( "PASS" ) ;
}
expect : {
"use strict" ;
( class extends Function { } ) ;
console . log ( "PASS" ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
2021-02-23 14:55:08 +00:00
drop _name : {
options = {
unused : true ,
}
input : {
"use strict" ;
try {
console . log ( class A extends 42 { } )
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect : {
"use strict" ;
try {
console . log ( class extends 42 { } )
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect _stdout : "PASS"
node _version : ">=4"
}
separate _name : {
options = {
merge _vars : true ,
toplevel : true ,
}
input : {
"use strict" ;
class A {
constructor ( v ) {
this . p = v ;
}
}
var a = new A ( "PASS" ) ;
console . log ( a . p ) ;
}
expect : {
"use strict" ;
class A {
constructor ( v ) {
this . p = v ;
}
}
var a = new A ( "PASS" ) ;
console . log ( a . p ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
static _side _effects : {
options = {
inline : true ,
toplevel : true ,
unused : true ,
}
input : {
var a = "FAIL 1" ;
class A {
static p = a = "PASS" ;
q = a = "FAIL 2" ;
}
console . log ( a ) ;
}
expect : {
2022-01-09 13:15:42 +00:00
var a = "FAIL 1" ;
( class {
static c = a = "PASS" ;
} ) ;
console . log ( a ) ;
}
expect _stdout : "PASS"
node _version : ">=12"
}
static _side _effects _strict : {
options = {
inline : true ,
toplevel : true ,
unused : true ,
}
input : {
"use strict" ;
var a = "FAIL 1" ;
class A {
static p = a = "PASS" ;
q = a = "FAIL 2" ;
}
console . log ( a ) ;
}
expect : {
"use strict" ;
2021-02-23 14:55:08 +00:00
var a = "FAIL 1" ;
a = "PASS" ;
console . log ( a ) ;
}
expect _stdout : "PASS"
node _version : ">=12"
}
2021-03-02 05:43:10 +00:00
single _use _1 : {
2021-02-23 14:55:08 +00:00
options = {
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
"use strict" ;
class A { }
console . log ( typeof new A ( ) ) ;
}
expect : {
"use strict" ;
console . log ( typeof new class { } ( ) ) ;
}
expect _stdout : "object"
node _version : ">=4"
}
2021-03-02 05:43:10 +00:00
single _use _2 : {
options = {
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
"use strict" ;
class A {
f ( a ) {
console . log ( a ) ;
}
}
new A ( ) . f ( "PASS" ) ;
}
expect : {
"use strict" ;
new class {
f ( a ) {
console . log ( a ) ;
}
} ( ) . f ( "PASS" ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
single _use _3 : {
options = {
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
"use strict" ;
class A {
f ( ) {
return A ;
}
}
console . log ( typeof new A ( ) . f ( ) ) ;
}
expect : {
"use strict" ;
console . log ( typeof new class A {
f ( ) {
return A ;
}
} ( ) . f ( ) ) ;
}
expect _stdout : "function"
node _version : ">=4"
}
single _use _4 : {
options = {
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
"use strict" ;
console . log ( new class A {
f ( ) {
return typeof A ;
}
} ( ) . f ( ) ) ;
}
expect : {
"use strict" ;
console . log ( new class A {
f ( ) {
return typeof A ;
}
} ( ) . f ( ) ) ;
}
expect _stdout : "function"
node _version : ">=4"
}
single _use _5 : {
options = {
reduce _vars : true ,
unused : true ,
}
input : {
function f ( ) {
console . log ( "foo" ) ;
}
( function ( ) {
"use strict" ;
class A extends f {
f ( ) {
console . log ( "bar" ) ;
}
}
console . log ( "baz" ) ;
new A ( ) . f ( ) ;
} ) ( ) ;
}
expect : {
function f ( ) {
console . log ( "foo" ) ;
}
( function ( ) {
"use strict" ;
class A extends f {
f ( ) {
console . log ( "bar" ) ;
}
}
console . log ( "baz" ) ;
new A ( ) . f ( ) ;
} ) ( ) ;
}
expect _stdout : [
"baz" ,
"foo" ,
"bar" ,
]
node _version : ">=4"
}
single _use _6 : {
options = {
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
"use strict" ;
class A {
[ ( console . log ( "foo" ) , "f" ) ] ( ) {
console . log ( "bar" ) ;
}
}
console . log ( "baz" ) ;
new A ( ) . f ( ) ;
}
expect : {
"use strict" ;
class A {
[ ( console . log ( "foo" ) , "f" ) ] ( ) {
console . log ( "bar" ) ;
}
}
console . log ( "baz" ) ;
new A ( ) . f ( ) ;
}
expect _stdout : [
"foo" ,
"baz" ,
"bar" ,
]
node _version : ">=4"
}
2021-04-03 14:06:05 +00:00
single _use _7 : {
options = {
passes : 2 ,
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
"use strict" ;
class A {
static foo ( ) { }
}
var a = "foo" in A ;
console . log ( a ) ;
}
expect : {
"use strict" ;
console . log ( "foo" in class {
static foo ( ) { }
} ) ;
}
expect _stdout : "true"
node _version : ">=4"
}
2022-05-22 19:53:32 +00:00
single _use _extends : {
options = {
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
"use strict" ;
class A extends class B {
f ( ) {
return "PASS" ;
}
} { }
console . log ( new A ( ) . f ( ) ) ;
}
expect : {
"use strict" ;
console . log ( new class extends class {
f ( ) {
return "PASS" ;
}
} { } ( ) . f ( ) ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
single _use _extends _non _strict : {
options = {
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
class A extends class B {
f ( ) {
return "PASS" ;
}
} { }
console . log ( new A ( ) . f ( ) ) ;
}
expect : {
console . log ( new class extends class {
f ( ) {
return "PASS" ;
}
} { } ( ) . f ( ) ) ;
}
expect _stdout : "PASS"
node _version : ">=6"
}
2021-02-23 14:55:08 +00:00
collapse _non _strict : {
options = {
collapse _vars : true ,
toplevel : true ,
}
input : {
var a = 42. . p ++ ;
new class extends ( a || function ( ) {
console . log ( "PASS" ) ;
} ) { }
}
expect : {
var a = 42. . p ++ ;
new class extends ( a || function ( ) {
console . log ( "PASS" ) ;
} ) { }
}
expect _stdout : "PASS"
node _version : ">=6"
}
collapse _rhs : {
options = {
collapse _vars : true ,
2021-05-29 00:57:24 +00:00
unsafe : true ,
2021-02-23 14:55:08 +00:00
}
input : {
"use strict" ;
var a = "FAIL" ;
a = "PASS" ;
class A {
p = "PASS" ;
}
console . log ( a ) ;
}
expect : {
"use strict" ;
var a = "FAIL" ;
class A {
p = "PASS" ;
}
2021-03-05 05:18:01 +00:00
console . log ( a = "PASS" ) ;
2021-02-23 14:55:08 +00:00
}
expect _stdout : "PASS"
node _version : ">=12"
}
collapse _rhs _static : {
options = {
collapse _vars : true ,
}
input : {
"use strict" ;
var a = "FAIL" ;
a = "PASS" ;
class A {
static p = "PASS" ;
}
console . log ( a ) ;
}
expect : {
"use strict" ;
var a = "FAIL" ;
class A {
static p = a = "PASS" ;
}
console . log ( a ) ;
}
expect _stdout : "PASS"
node _version : ">=12"
}
2022-05-14 04:15:54 +00:00
inline _non _strict : {
options = {
reduce _funcs : true ,
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
function f ( a ) {
return a . p = "PASS" ;
}
class A {
g ( ) {
return f ( 42 ) ;
}
}
console . log ( new A ( ) . g ( ) ) ;
}
expect : {
function f ( a ) {
return a . p = "PASS" ;
}
console . log ( new class {
g ( ) {
return f ( 42 ) ;
}
} ( ) . g ( ) ) ;
}
expect _stdout : "PASS"
node _version : ">=6"
}
2021-04-03 14:06:05 +00:00
self _comparison : {
options = {
booleans : true ,
comparisons : true ,
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
"use strict" ;
class A { }
console . log ( A == A , A != A ) ;
console . log ( A === A , A !== A ) ;
}
expect : {
"use strict" ;
console . log ( ! 0 , ! 1 ) ;
console . log ( ! 0 , ! 1 ) ;
}
expect _stdout : [
"true false" ,
"true false" ,
]
node _version : ">=4"
}
2021-02-23 14:55:08 +00:00
property _side _effects : {
options = {
inline : true ,
keep _fargs : false ,
unused : true ,
}
input : {
"use strict" ;
( function f ( a , b ) {
class A {
[ a . log ( "PASS" ) ] ( ) {
b . log ( "FAIL" ) ;
}
}
} ) ( console , console ) ;
}
expect : {
"use strict" ;
( function ( a ) {
a . log ( "PASS" ) ;
} ) ( console , console ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
property _side _effects _static : {
options = {
inline : true ,
keep _fargs : false ,
unused : true ,
}
input : {
"use strict" ;
( function f ( a , b ) {
class A {
static [ a . log ( "PASS" ) ] ( ) {
b . log ( "FAIL" ) ;
}
}
} ) ( console , console ) ;
}
expect : {
"use strict" ;
( function ( a ) {
a . log ( "PASS" ) ;
} ) ( console , console ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
unused _await : {
options = {
inline : true ,
unused : true ,
}
input : {
var await = "PASS" ;
( async function ( ) {
class A {
static p = console . log ( await ) ;
}
} ) ( ) ;
}
expect : {
2022-01-09 13:15:42 +00:00
var await = "PASS" ;
( async function ( ) {
( class {
static c = console . log ( await ) ;
} ) ;
} ) ( ) ;
}
expect _stdout : true
node _version : ">=12 <16"
}
unused _await _strict : {
options = {
inline : true ,
unused : true ,
}
input : {
"use strict" ;
var await = "PASS" ;
( async function ( ) {
class A {
static p = console . log ( await ) ;
}
} ) ( ) ;
}
expect : {
"use strict" ;
2021-02-23 14:55:08 +00:00
var await = "PASS" ;
( async function ( ) {
( ( ) => console . log ( await ) ) ( ) ;
} ) ( ) ;
}
2021-03-20 22:33:45 +00:00
expect _stdout : true
2021-04-21 00:33:54 +00:00
node _version : ">=12 <16"
2021-02-23 14:55:08 +00:00
}
computed _key _side _effects : {
options = {
evaluate : true ,
reduce _vars : true ,
side _effects : true ,
toplevel : true ,
unused : true ,
}
input : {
"use strict" ;
var a = 0 ;
class A {
[ ( a ++ , 0 ) ] ( ) { }
}
console . log ( a ) ;
}
expect : {
"use strict" ;
console . log ( 1 ) ;
}
expect _stdout : "1"
node _version : ">=4"
}
computed _key _generator : {
options = {
unused : true ,
}
input : {
"use strict" ;
var a = function * ( ) {
class A {
static [ console . log ( yield ) ] ( ) { }
}
} ( ) ;
a . next ( "FAIL" ) ;
a . next ( "PASS" ) ;
}
expect : {
"use strict" ;
var a = function * ( ) {
console . log ( yield ) ;
} ( ) ;
a . next ( "FAIL" ) ;
a . next ( "PASS" ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
2021-02-24 18:17:28 +00:00
2021-03-17 01:28:27 +00:00
keep _fnames : {
options = {
keep _fnames : true ,
toplevel : true ,
}
mangle = {
keep _fnames : true ,
toplevel : true ,
}
input : {
"use strict" ;
class Foo { }
console . log ( Foo . name , class Bar { } . name ) ;
}
expect : {
"use strict" ;
class Foo { }
console . log ( Foo . name , class Bar { } . name ) ;
}
2022-03-28 19:01:01 +00:00
expect _stdout : "Foo Bar"
node _version : ">=4"
2021-03-17 01:28:27 +00:00
}
2021-03-01 20:55:09 +00:00
issue _805 _1 : {
options = {
inline : true ,
2021-12-15 00:08:24 +00:00
passes : 3 ,
2021-03-01 20:55:09 +00:00
pure _getters : "strict" ,
reduce _vars : true ,
sequences : true ,
side _effects : true ,
unused : true ,
}
input : {
"use strict" ;
( function ( a ) {
var unused = class { } ;
unused . prototype [ a ( ) ] = 42 ;
( unused . prototype . bar = function ( ) {
console . log ( "bar" ) ;
} ) ( ) ;
return unused ;
} ) ( function ( ) {
console . log ( "foo" ) ;
return "foo" ;
} ) ;
}
expect : {
"use strict" ;
console . log ( "foo" ) ,
console . log ( "bar" ) ;
}
expect _stdout : [
"foo" ,
"bar" ,
]
node _version : ">=4"
}
issue _805 _2 : {
options = {
inline : true ,
2021-12-15 00:08:24 +00:00
passes : 3 ,
2021-03-01 20:55:09 +00:00
pure _getters : "strict" ,
reduce _vars : true ,
sequences : true ,
side _effects : true ,
unused : true ,
}
input : {
"use strict" ;
( function ( a ) {
class unused { }
unused . prototype [ a ( ) ] = 42 ;
( unused . prototype . bar = function ( ) {
console . log ( "bar" ) ;
} ) ( ) ;
return unused ;
} ) ( function ( ) {
console . log ( "foo" ) ;
return "foo" ;
} ) ;
}
expect : {
"use strict" ;
console . log ( "foo" ) ,
console . log ( "bar" ) ;
}
expect _stdout : [
"foo" ,
"bar" ,
]
node _version : ">=4"
}
2021-02-24 18:17:28 +00:00
issue _4681 : {
options = {
unused : true ,
}
input : {
console . log ( function ( a ) {
class A {
static p = a = this ;
}
return typeof a ;
} ( ) ) ;
}
expect : {
console . log ( function ( a ) {
2021-06-03 12:23:14 +00:00
( class {
2021-02-24 18:17:28 +00:00
static p = a = this ;
2021-06-03 12:23:14 +00:00
} ) ;
2021-02-24 18:17:28 +00:00
return typeof a ;
} ( ) ) ;
}
expect _stdout : "function"
node _version : ">=12"
}
2021-02-24 20:41:21 +00:00
issue _4683 : {
options = {
dead _code : true ,
evaluate : true ,
loops : true ,
}
input : {
"use strict" ;
for ( class extends null { } ; void console . log ( "PASS" ) ; ) ;
}
expect : {
"use strict" ;
( class extends null { } ) ;
void console . log ( "PASS" ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
2021-02-25 01:01:45 +00:00
issue _4685 _1 : {
options = {
collapse _vars : true ,
unused : true ,
}
input : {
"use strict" ;
new class {
f ( ) {
( function ( g ) {
if ( g ( ) !== this )
console . log ( "PASS" ) ;
} ) ( ( ) => this ) ;
}
} ( ) . f ( ) ;
}
expect : {
"use strict" ;
new class {
f ( ) {
( function ( g ) {
if ( g ( ) !== this )
console . log ( "PASS" ) ;
} ) ( ( ) => this ) ;
}
} ( ) . f ( ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
issue _4685 _2 : {
options = {
reduce _vars : true ,
unused : true ,
}
input : {
"use strict" ;
new class {
f ( ) {
( function ( g ) {
if ( g ( ) !== this )
console . log ( "PASS" ) ;
} ) ( ( ) => {
if ( console )
return this ;
} ) ;
}
} ( ) . f ( ) ;
}
expect : {
"use strict" ;
new class {
f ( ) {
( function ( g ) {
if ( g ( ) !== this )
console . log ( "PASS" ) ;
} ) ( ( ) => {
if ( console )
return this ;
} ) ;
}
} ( ) . f ( ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
issue _4687 _1 : {
options = {
collapse _vars : true ,
unused : true ,
}
input : {
"use strict" ;
new class {
f ( ) {
console . log ( function ( g ) {
return g ( ) === this ;
} ( ( ) => this ) || "PASS" ) ;
}
} ( ) . f ( ) ;
}
expect : {
"use strict" ;
new class {
f ( ) {
console . log ( function ( g ) {
return g ( ) === this ;
} ( ( ) => this ) || "PASS" ) ;
}
} ( ) . f ( ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
issue _4687 _2 : {
options = {
reduce _vars : true ,
unused : true ,
}
input : {
"use strict" ;
new class {
f ( ) {
console . log ( function ( g ) {
return g ( ) === this ;
} ( ( ) => {
if ( console )
return this ;
} ) || "PASS" ) ;
}
} ( ) . f ( ) ;
}
expect : {
"use strict" ;
new class {
f ( ) {
console . log ( function ( g ) {
return g ( ) === this ;
} ( ( ) => {
if ( console )
return this ;
} ) || "PASS" ) ;
}
} ( ) . f ( ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
2021-02-27 20:41:21 +00:00
issue _4705 : {
options = {
evaluate : true ,
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
var a = "PASS" ;
class A {
p = a = "FAIL" ;
[ console . log ( a ) ] ;
}
}
expect : {
2022-01-09 13:15:42 +00:00
( class {
[ console . log ( "PASS" ) ] ( ) { }
} ) ;
}
expect _stdout : "PASS"
node _version : ">=12"
}
issue _4705 _strict : {
options = {
evaluate : true ,
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
"use strict" ;
var a = "PASS" ;
class A {
p = a = "FAIL" ;
[ console . log ( a ) ] ;
}
}
expect : {
"use strict" ;
2021-02-27 20:41:21 +00:00
console . log ( "PASS" ) ;
}
expect _stdout : "PASS"
node _version : ">=12"
}
2021-03-02 19:32:58 +00:00
issue _4720 : {
options = {
2021-07-17 12:20:56 +00:00
ie : true ,
2021-03-02 19:32:58 +00:00
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
class A {
static p = function f ( ) { } ;
}
console . log ( typeof A . p , typeof f ) ;
}
expect : {
class A {
static p = function f ( ) { } ;
}
console . log ( typeof A . p , typeof f ) ;
}
expect _stdout : "function undefined"
node _version : ">=12"
}
issue _4721 : {
options = {
side _effects : true ,
}
input : {
"use strict" ;
var a = "foo" ;
try {
( class extends 42 {
[ a = "bar" ] ( ) { }
} )
} catch ( e ) {
console . log ( a ) ;
}
}
expect : {
"use strict" ;
var a = "foo" ;
try {
( class extends 42 {
[ a = "bar" ] ( ) { }
} ) ;
} catch ( e ) {
console . log ( a ) ;
}
}
expect _stdout : true
node _version : ">=4"
}
issue _4722 _1 : {
options = {
side _effects : true ,
}
input : {
"use strict" ;
try {
( class extends function * ( ) { } { } ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect : {
"use strict" ;
try {
( class extends function * ( ) { } { } ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect _stdout : "PASS"
node _version : ">=4"
}
issue _4722 _2 : {
options = {
side _effects : true ,
}
input : {
"use strict" ;
try {
( class extends async function ( ) { } { } ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect : {
"use strict" ;
try {
( class extends async function ( ) { } { } ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect _stdout : "PASS"
node _version : ">=8"
}
issue _4722 _3 : {
options = {
side _effects : true ,
}
input : {
"use strict" ;
try {
( class extends async function * ( ) { } { } ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect : {
"use strict" ;
try {
( class extends async function * ( ) { } { } ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect _stdout : "PASS"
node _version : ">=10"
}
2021-03-03 01:18:02 +00:00
issue _4725 _1 : {
options = {
inline : true ,
}
input : {
"use strict" ;
console . log ( typeof new class {
f ( ) {
return function g ( ) {
return g ;
} ( ) ;
}
} ( ) . f ( ) ) ;
}
expect : {
"use strict" ;
console . log ( typeof new class {
f ( ) {
return function g ( ) {
return g ;
} ( ) ;
}
} ( ) . f ( ) ) ;
}
expect _stdout : "function"
node _version : ">=4"
}
issue _4725 _2 : {
options = {
2021-12-21 05:03:11 +00:00
if _return : true ,
2021-03-03 01:18:02 +00:00
inline : true ,
}
input : {
"use strict" ;
new class {
f ( ) {
return function ( ) {
while ( console . log ( "PASS" ) ) ;
} ( ) ;
}
} ( ) . f ( ) ;
}
expect : {
"use strict" ;
new class {
f ( ) {
while ( console . log ( "PASS" ) ) ;
}
} ( ) . f ( ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
2021-03-06 23:11:36 +00:00
new _target : {
input : {
console . log ( typeof new class {
constructor ( ) {
this . f = ( ) => new . target ;
}
} ( ) . f ( ) ) ;
}
expect : {
console . log ( typeof new class {
constructor ( ) {
this . f = ( ) => new . target ;
}
} ( ) . f ( ) ) ;
}
expect _stdout : "function"
node _version : ">=6"
}
2021-03-08 23:59:52 +00:00
issue _4756 : {
options = {
toplevel : true ,
unused : true ,
}
input : {
try {
class A extends 42 {
static [ console . log ( "foo" ) ] = console . log ( "bar" ) ;
}
} catch ( e ) {
console . log ( "baz" ) ;
}
}
expect : {
try {
( class extends 42 {
2022-01-09 13:15:42 +00:00
static [ console . log ( "foo" ) ] = console . log ( "bar" ) ;
} ) ;
} catch ( e ) {
console . log ( "baz" ) ;
}
}
expect _stdout : [
"foo" ,
"baz" ,
]
node _version : ">=12"
}
issue _4756 _strict : {
options = {
toplevel : true ,
unused : true ,
}
input : {
"use strict" ;
try {
class A extends 42 {
static [ console . log ( "foo" ) ] = console . log ( "bar" ) ;
}
} catch ( e ) {
console . log ( "baz" ) ;
}
}
expect : {
"use strict" ;
try {
( class extends 42 {
static [ console . log ( "foo" ) ] = console . log ( "bar" ) ;
} ) ;
2021-03-08 23:59:52 +00:00
} catch ( e ) {
console . log ( "baz" ) ;
}
}
expect _stdout : [
"foo" ,
"baz" ,
]
node _version : ">=12"
}
2021-03-24 20:36:50 +00:00
issue _4821 _1 : {
options = {
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
var a ;
class A {
static p = void ( a = this ) ;
}
console . log ( typeof a ) ;
}
expect : {
var a ;
2021-06-03 12:23:14 +00:00
( class {
2021-03-24 20:36:50 +00:00
static p = void ( a = this ) ;
2021-06-03 12:23:14 +00:00
} ) ;
2021-03-24 20:36:50 +00:00
console . log ( typeof a ) ;
}
expect _stdout : "function"
node _version : ">=12"
}
issue _4821 _2 : {
options = {
side _effects : true ,
toplevel : true ,
unused : true ,
}
input : {
var a ;
class A {
static p = void ( a = this ) ;
}
console . log ( typeof a ) ;
}
expect : {
var a ;
( class {
static p = void ( a = this ) ;
} ) ;
console . log ( typeof a ) ;
}
expect _stdout : "function"
node _version : ">=12"
}
2021-03-31 23:05:50 +00:00
2021-04-01 06:39:51 +00:00
issue _4829 _1 : {
2021-03-31 23:05:50 +00:00
options = {
properties : true ,
}
input : {
"use strict" ;
try {
2022-01-09 13:15:42 +00:00
class A extends { f ( ) { } } . f { }
2021-03-31 23:05:50 +00:00
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect : {
"use strict" ;
try {
class A extends [ ( ) => { } ] [ 0 ] { }
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect _stdout : "PASS"
node _version : ">=4"
}
2021-04-01 06:39:51 +00:00
issue _4829 _2 : {
options = {
properties : true ,
}
input : {
"use strict" ;
try {
class A extends {
f ( ) {
return arguments ;
} ,
} . f { }
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect : {
"use strict" ;
try {
class A extends {
f ( ) {
return arguments ;
} ,
} . f { }
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect _stdout : "PASS"
node _version : ">=4"
}
2021-04-02 22:00:19 +00:00
mangle _properties : {
mangle = {
properties : {
keep _quoted : true ,
} ,
}
input : {
class A {
static # P = "PASS" ;
static get Q ( ) {
return this . # P ;
}
# p ( n ) {
return ( this [ "q" ] = n ) * this . r ;
}
set q ( v ) {
this . r = v + 1 ;
}
r = this . # p ( 6 ) ;
}
console . log ( A . Q , new A ( ) . r ) ;
}
expect : {
class A {
static # t = "PASS" ;
static get s ( ) {
return this . # t ;
}
# i ( t ) {
return ( this [ "q" ] = t ) * this . e ;
}
set q ( t ) {
this . e = t + 1 ;
}
e = this . # i ( 6 ) ;
}
console . log ( A . s , new A ( ) . e ) ;
}
expect _stdout : "PASS 42"
node _version : ">=14.6"
}
2021-04-08 00:57:59 +00:00
issue _4848 : {
options = {
if _return : true ,
}
input : {
"use strict" ;
function f ( a ) {
a ( function ( ) {
new A ( ) ;
} ) ;
if ( ! console )
return ;
class A {
constructor ( ) {
console . log ( "PASS" ) ;
}
}
}
var g ;
f ( function ( h ) {
g = h ;
} ) ;
g ( ) ;
}
expect : {
"use strict" ;
function f ( a ) {
a ( function ( ) {
new A ( ) ;
} ) ;
if ( ! console )
return ;
class A {
constructor ( ) {
console . log ( "PASS" ) ;
}
}
}
var g ;
f ( function ( h ) {
g = h ;
} ) ;
g ( ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
2021-04-22 02:58:50 +00:00
drop _unused _self _reference : {
options = {
pure _getters : "strict" ,
reduce _vars : true ,
2021-04-23 23:17:30 +00:00
sequences : true ,
side _effects : true ,
2021-04-22 02:58:50 +00:00
toplevel : true ,
unused : true ,
}
input : {
"use strict" ;
class A { }
( A . p = A ) . q = console . log ( "PASS" ) ;
}
expect : {
"use strict" ;
console . log ( "PASS" ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
2021-05-22 02:12:37 +00:00
issue _4951 _1 : {
input : {
class A {
static # p = console . log ( "PASS" ) ;
}
}
expect _exact : 'class A{static#p=console.log("PASS")}'
expect _stdout : "PASS"
node _version : ">=12"
}
issue _4951 _2 : {
input : {
new class {
constructor ( ) {
this . # f ( ) . then ( console . log ) ;
}
async # f ( ) {
return await "PASS" ;
}
} ( ) ;
}
expect _exact : 'new class{constructor(){this.#f().then(console.log)}async#f(){return await"PASS"}};'
expect _stdout : "PASS"
node _version : ">=14.6"
}
2021-05-25 16:12:31 +00:00
issue _4962 _1 : {
options = {
2021-07-17 12:20:56 +00:00
ie : true ,
2021-05-25 16:12:31 +00:00
inline : true ,
reduce _vars : true ,
unused : true ,
}
input : {
( function ( ) {
function f ( ) {
while ( console . log ( typeof g ) ) ;
}
class A {
static p = f ( ) ;
}
} ) ( function g ( ) { } ) ;
}
expect : {
2022-05-14 04:15:54 +00:00
( function ( ) {
function f ( ) {
2022-01-09 13:15:42 +00:00
while ( console . log ( typeof g ) ) ;
2022-05-14 04:15:54 +00:00
}
( class {
static c = f ( ) ;
} ) ;
} ) ( function g ( ) { } ) ;
2022-01-09 13:15:42 +00:00
}
expect _stdout : "undefined"
node _version : ">=12"
}
issue _4962 _1 _strict : {
options = {
ie : true ,
inline : true ,
reduce _vars : true ,
unused : true ,
}
input : {
"use strict" ;
( function ( ) {
function f ( ) {
while ( console . log ( typeof g ) ) ;
}
class A {
static p = f ( ) ;
}
} ) ( function g ( ) { } ) ;
}
expect : {
"use strict" ;
2022-01-01 21:40:43 +00:00
( function g ( ) { } ) ;
while ( console . log ( typeof g ) ) ;
2021-05-25 16:12:31 +00:00
}
expect _stdout : "undefined"
node _version : ">=12"
}
2022-05-14 04:15:54 +00:00
issue _4962 _1 _strict _direct : {
options = {
ie : true ,
inline : true ,
reduce _vars : true ,
unused : true ,
}
input : {
( function ( ) {
function f ( ) {
"use strict" ;
while ( console . log ( typeof g ) ) ;
}
class A {
static p = f ( ) ;
}
} ) ( function g ( ) { } ) ;
}
expect : {
( function g ( ) { } ) ,
void class {
static c = function ( ) {
"use strict" ;
while ( console . log ( typeof g ) ) ;
} ( ) ;
} ;
}
expect _stdout : "undefined"
node _version : ">=12"
}
2021-05-25 16:12:31 +00:00
issue _4962 _2 : {
options = {
2021-07-17 12:20:56 +00:00
ie : true ,
2021-05-25 16:12:31 +00:00
inline : true ,
reduce _vars : true ,
unused : true ,
}
input : {
console . log ( function f ( ) { } ( function g ( ) {
function h ( ) {
f ;
}
class A {
static p = h ( ) ;
}
} , typeof g ) ) ;
}
expect : {
2022-01-09 13:15:42 +00:00
console . log ( function f ( ) { } ( function g ( ) {
2022-05-14 04:15:54 +00:00
function h ( ) {
f ;
}
2022-01-09 13:15:42 +00:00
( class {
2022-05-14 04:15:54 +00:00
static c = h ( ) ;
2022-01-09 13:15:42 +00:00
} ) ;
} ) ) ;
}
expect _stdout : "undefined"
node _version : ">=12"
}
issue _4962 _2 _strict : {
options = {
ie : true ,
inline : true ,
reduce _vars : true ,
unused : true ,
}
input : {
"use strict" ;
console . log ( function f ( ) { } ( function g ( ) {
function h ( ) {
f ;
}
class A {
static p = h ( ) ;
}
} , typeof g ) ) ;
}
expect : {
"use strict" ;
2021-05-25 16:12:31 +00:00
console . log ( function f ( ) { } ( function g ( ) {
f ;
} ) ) ;
}
expect _stdout : "undefined"
node _version : ">=12"
}
2021-05-30 01:00:48 +00:00
2022-05-14 04:15:54 +00:00
issue _4962 _2 _strict _direct : {
options = {
ie : true ,
inline : true ,
reduce _vars : true ,
unused : true ,
}
input : {
console . log ( function f ( ) { } ( function g ( ) {
function h ( ) {
"use strict" ;
f ;
}
class A {
static p = h ( ) ;
}
} , typeof g ) ) ;
}
expect : {
console . log ( function f ( ) { } ( function g ( ) {
( class {
static c = function ( ) {
"use strict" ;
f ;
} ( ) ;
} ) ;
} ) ) ;
}
expect _stdout : "undefined"
node _version : ">=12"
}
issue _4962 _2 _strict _direct _inline : {
options = {
directives : true ,
ie : true ,
inline : true ,
passes : 2 ,
reduce _vars : true ,
unused : true ,
}
input : {
console . log ( function f ( ) { } ( function g ( ) {
function h ( ) {
"use strict" ;
f ;
}
class A {
static p = h ( ) ;
}
} , typeof g ) ) ;
}
expect : {
console . log ( function f ( ) { } ( function g ( ) {
( class {
static c = f ;
} ) ;
} ) ) ;
}
expect _stdout : "undefined"
node _version : ">=12"
}
2021-05-30 01:00:48 +00:00
issue _4982 _1 : {
options = {
dead _code : true ,
}
input : {
"use strict" ;
try { } catch ( e ) {
class A extends 42 { }
}
console . log ( "PASS" ) ;
}
expect : {
"use strict" ;
{
class A { }
}
console . log ( "PASS" ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
issue _4982 _2 : {
options = {
dead _code : true ,
}
input : {
var a = "PASS" ;
try { } catch ( e ) {
class A {
static p = a = "FAIL" ;
}
}
console . log ( a ) ;
}
expect : {
var a = "PASS" ;
{
class A { }
}
console . log ( a ) ;
}
expect _stdout : "PASS"
node _version : ">=12"
}
2021-06-03 12:23:14 +00:00
issue _4992 : {
options = {
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
class A {
static P = this ;
get p ( ) { }
}
console . log ( typeof A . P ) ;
}
expect : {
console . log ( typeof class {
static P = this ;
get p ( ) { }
} . P ) ;
}
expect _stdout : "function"
node _version : ">=12"
}
2021-06-10 00:03:17 +00:00
issue _4996 _1 : {
options = {
evaluate : true ,
reduce _vars : true ,
toplevel : true ,
}
input : {
var a = 1 ;
console . log ( new class A {
p = a -- && new A ( ) ;
} ( ) . p . p ) ;
}
expect : {
var a = 1 ;
console . log ( new class A {
p = a -- && new A ( ) ;
} ( ) . p . p ) ;
}
expect _stdout : "0"
node _version : ">=12"
}
issue _4996 _2 : {
options = {
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
var a = 1 ;
console . log ( new class A {
p = a -- && new A ( ) ;
} ( ) . p . p ) ;
}
expect : {
var a = 1 ;
console . log ( new class A {
p = a -- && new A ( ) ;
} ( ) . p . p ) ;
}
expect _stdout : "0"
node _version : ">=12"
}
2021-06-20 19:13:05 +00:00
issue _5015 _1 : {
options = {
side _effects : true ,
}
input : {
"use strict" ;
var a ;
try {
( class a {
[ a ] ( ) { }
} ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect : {
"use strict" ;
var a ;
try {
( class a {
[ a ] ( ) { }
} ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect _stdout : "PASS"
node _version : ">=4"
}
issue _5015 _2 : {
options = {
reduce _vars : true ,
side _effects : true ,
toplevel : true ,
}
input : {
"use strict" ;
try {
new class A {
[ ( A , 42 ) ] ( ) { }
} ( ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect : {
"use strict" ;
try {
new class A {
[ ( A , 42 ) ] ( ) { }
} ( ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect _stdout : "PASS"
node _version : ">=4"
}
issue _5015 _3 : {
options = {
reduce _vars : true ,
side _effects : true ,
toplevel : true ,
}
input : {
"use strict" ;
( class A {
static f ( ) {
return A ;
}
} ) ;
console . log ( "PASS" ) ;
}
2022-01-14 17:44:36 +00:00
expect : {
"use strict" ;
( class A { } ) ;
console . log ( "PASS" ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
issue _5015 _4 : {
options = {
reduce _vars : true ,
sequences : true ,
side _effects : true ,
toplevel : true ,
unused : true ,
}
input : {
"use strict" ;
( class A {
static f ( ) {
return A ;
}
} ) ;
console . log ( "PASS" ) ;
}
2021-06-20 19:13:05 +00:00
expect : {
"use strict" ;
console . log ( "PASS" ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
2021-07-06 08:04:11 +00:00
issue _5053 _1 : {
options = {
evaluate : true ,
reduce _vars : true ,
toplevel : true ,
}
input : {
"use strict" ;
try {
console . log ( new class A {
constructor ( ) {
A = 42 ;
}
} ( ) ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect : {
"use strict" ;
try {
console . log ( new class A {
constructor ( ) {
A = 42 ;
}
} ( ) ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect _stdout : "PASS"
node _version : ">=4"
}
issue _5053 _2 : {
options = {
evaluate : true ,
reduce _vars : true ,
toplevel : true ,
}
input : {
"use strict" ;
try {
console . log ( new class A {
f ( ) {
A = 42 ;
}
} ( ) . f ( ) ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect : {
"use strict" ;
try {
console . log ( new class A {
f ( ) {
A = 42 ;
}
} ( ) . f ( ) ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect _stdout : "PASS"
node _version : ">=4"
}
issue _5053 _3 : {
options = {
evaluate : true ,
reduce _vars : true ,
toplevel : true ,
}
input : {
try {
console . log ( new class A {
p = A = 42 ;
} ( ) . p ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect : {
try {
console . log ( new class A {
p = A = 42 ;
} ( ) . p ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect _stdout : "PASS"
node _version : ">=12"
}
issue _5053 _4 : {
options = {
evaluate : true ,
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
"use strict" ;
class A {
constructor ( ) {
A = 42 ;
}
}
try {
console . log ( new A ( ) ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect : {
"use strict" ;
class A {
constructor ( ) {
A = 42 ;
}
}
try {
console . log ( new A ( ) ) ;
} catch ( e ) {
console . log ( "PASS" ) ;
}
}
expect _stdout : "PASS"
node _version : ">=4"
}
2021-07-16 14:13:33 +00:00
issue _5082 _1 : {
options = {
inline : true ,
reduce _vars : true ,
unused : true ,
}
input : {
( function ( ) {
class A {
p = console . log ( "PASS" ) ;
q ( ) { }
}
class B {
static P = new A ( ) ;
}
} ) ( ) ;
}
expect : {
2022-01-09 13:15:42 +00:00
( function ( ) {
class A {
p = console . log ( "PASS" ) ;
q ( ) { }
}
( class {
static c = new A ( ) ;
} ) ;
} ) ( ) ;
}
expect _stdout : "PASS"
node _version : ">=12"
}
issue _5082 _1 _strict : {
options = {
inline : true ,
reduce _vars : true ,
unused : true ,
}
input : {
"use strict" ;
( function ( ) {
class A {
p = console . log ( "PASS" ) ;
q ( ) { }
}
class B {
static P = new A ( ) ;
}
} ) ( ) ;
}
expect : {
"use strict" ;
2021-07-16 14:13:33 +00:00
( function ( ) {
class A {
p = console . log ( "PASS" ) ;
q ( ) { }
}
new A ( ) ;
} ) ( ) ;
}
expect _stdout : "PASS"
node _version : ">=12"
}
issue _5082 _2 : {
options = {
inline : true ,
passes : 2 ,
reduce _vars : true ,
unused : true ,
}
input : {
( function ( ) {
class A {
p = console . log ( "PASS" ) ;
q ( ) { }
}
class B {
static P = new A ( ) ;
}
} ) ( ) ;
}
expect : {
2022-01-09 13:15:42 +00:00
( function ( ) {
class A {
p = console . log ( "PASS" ) ;
q ( ) { }
}
( class {
static c = new A ( ) ;
} ) ;
} ) ( ) ;
}
expect _stdout : "PASS"
node _version : ">=12"
}
issue _5082 _2 _static : {
options = {
inline : true ,
passes : 2 ,
reduce _vars : true ,
unused : true ,
}
input : {
"use strict" ;
( function ( ) {
class A {
p = console . log ( "PASS" ) ;
q ( ) { }
}
class B {
static P = new A ( ) ;
}
} ) ( ) ;
}
expect : {
"use strict" ;
2021-07-16 14:13:33 +00:00
void new class {
p = console . log ( "PASS" ) ;
q ( ) { }
} ( ) ;
}
expect _stdout : "PASS"
node _version : ">=12"
}
2021-10-04 16:42:46 +00:00
issue _5142 : {
options = {
evaluate : true ,
merge _vars : true ,
reduce _vars : true ,
toplevel : true ,
}
input : {
var a = 0 , b ;
if ( ++ a )
new class {
p = b = null ;
constructor ( c ) {
console . log ( c ? "FAIL" : "PASS" ) ;
}
} ( b , a ) ;
}
expect : {
var a = 0 , b ;
if ( ++ a )
new class {
p = b = null ;
constructor ( c ) {
console . log ( c ? "FAIL" : "PASS" ) ;
}
} ( b , 1 ) ;
}
expect _stdout : "PASS"
node _version : ">=12"
}
2022-01-14 17:44:36 +00:00
issue _5294 _1 : {
options = {
reduce _vars : true ,
side _effects : true ,
toplevel : true ,
}
input : {
( class A {
static p = console . log ( typeof A ) ;
} ) ;
}
expect : {
( class A {
static c = console . log ( typeof A ) ;
} ) ;
}
expect _stdout : "function"
node _version : ">=12"
}
issue _5294 _2 : {
options = {
reduce _vars : true ,
side _effects : true ,
toplevel : true ,
}
input : {
class A {
static p = console . log ( typeof A ) ;
}
}
expect : {
class A {
static p = console . log ( typeof A ) ;
}
}
expect _stdout : "function"
node _version : ">=12"
}
issue _5294 _3 : {
options = {
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
var a = this ;
( class A {
static p = console . log ( a === A ? "FAIL" : "PASS" ) ;
} ) ;
}
expect : {
var a = this ;
( class A {
static p = console . log ( a === A ? "FAIL" : "PASS" ) ;
} ) ;
}
expect _stdout : "PASS"
node _version : ">=12"
}
issue _5294 _4 : {
options = {
reduce _vars : true ,
toplevel : true ,
unused : true ,
}
input : {
( class A {
static p = function ( ) {
var a = this ;
console . log ( a === A ? "FAIL" : "PASS" ) ;
} ( ) ;
} ) ;
}
expect : {
( class A {
static p = function ( ) {
console . log ( this === A ? "FAIL" : "PASS" ) ;
} ( ) ;
} ) ;
}
expect _stdout : "PASS"
node _version : ">=12"
}
2022-01-29 11:28:19 +00:00
issue _5322 : {
options = {
toplevel : true ,
unused : true ,
}
input : {
var a = 41 ;
class A {
static p ( ) {
console . log ( ++ a ) ;
}
static q = this . p ( ) ;
}
}
expect : {
var a = 41 ;
( class {
static p ( ) {
console . log ( ++ a ) ;
}
static q = this . p ( ) ;
} ) ;
}
expect _stdout : "42"
node _version : ">=12"
}
2022-02-13 00:22:34 +00:00
issue _5352 : {
options = {
merge _vars : true ,
}
input : {
function f ( a ) {
var b ;
new class {
[ b = console . log ( a ) ] = b ;
} ( a . p ) ;
}
f ( "PASS" ) ;
}
expect : {
function f ( a ) {
var b ;
new class {
[ b = console . log ( a ) ] = b ;
} ( a . p ) ;
}
f ( "PASS" ) ;
}
expect _stdout : "PASS"
node _version : ">=12"
}
2022-03-20 16:01:42 +00:00
issue _5387 : {
options = {
properties : true ,
}
input : {
"use strict" ;
( function ( a ) {
try {
class A extends a { }
} catch ( e ) {
console . log ( "PASS" ) ;
}
} ) ( {
f ( ) {
return this ;
}
} . f ) ;
}
expect : {
"use strict" ;
( function ( a ) {
try {
class A extends a { }
} catch ( e ) {
console . log ( "PASS" ) ;
}
} ) ( {
f ( ) {
return this ;
}
} . f ) ;
}
expect _stdout : "PASS"
node _version : ">=4"
}
2022-03-22 05:05:57 +00:00
2022-05-14 04:15:54 +00:00
issue _5389 _1 : {
2022-03-22 05:05:57 +00:00
options = {
collapse _vars : true ,
toplevel : true ,
}
input : {
function log ( m , n ) {
console . log ( m , n ) ;
}
var a = log ;
class A {
[ a = "FAIL" ] = a = "PASS" ;
}
var b = new A ( ) ;
log ( a , b . FAIL ) ;
}
expect : {
function log ( m , n ) {
console . log ( m , n ) ;
}
var a = log ;
class A {
[ a = "FAIL" ] = a = "PASS" ;
}
var b = new A ( ) ;
log ( a , b . FAIL ) ;
}
expect _stdout : "PASS PASS"
node _version : ">=12"
}
2022-05-07 20:16:28 +00:00
2022-05-14 04:15:54 +00:00
issue _5389 _2 : {
options = {
collapse _vars : true ,
toplevel : true ,
}
input : {
function log ( m , n ) {
console . log ( m , n ) ;
}
var a = log ;
var A = class {
[ a = "FAIL" ] = a = "PASS" ;
} ;
var b = new A ( ) ;
log ( a , b . FAIL ) ;
}
expect : {
function log ( m , n ) {
console . log ( m , n ) ;
}
var a = log ;
var A ;
var b = new class {
[ a = "FAIL" ] = a = "PASS" ;
} ( ) ;
log ( a , b . FAIL ) ;
}
expect _stdout : "PASS PASS"
node _version : ">=12"
}
2022-05-07 20:16:28 +00:00
issue _5436 : {
options = {
merge _vars : true ,
}
input : {
function f ( a ) {
class A {
p = a ;
}
var b = "FAIL" ;
A == b && b ( ) ;
return new A ( ) ;
}
console . log ( f ( "PASS" ) . p ) ;
}
expect : {
function f ( a ) {
class A {
p = a ;
}
var b = "FAIL" ;
A == b && b ( ) ;
return new A ( ) ;
}
console . log ( f ( "PASS" ) . p ) ;
}
expect _stdout : "PASS"
node _version : ">=12"
}
2022-06-01 18:42:39 +00:00
issue _5481 : {
options = {
collapse _vars : true ,
}
input : {
"use strict" ;
var a = "FAIL 1" , log = console . log ;
try {
a = "PASS" ;
( class extends 42 { } ) ;
log ( "FAIL 2" , a ) ;
} catch ( e ) {
log ( a ) ;
}
}
expect : {
"use strict" ;
var a = "FAIL 1" , log = console . log ;
try {
a = "PASS" ;
( class extends 42 { } ) ;
log ( "FAIL 2" , a ) ;
} catch ( e ) {
log ( a ) ;
}
}
expect _stdout : "PASS"
node _version : ">=4"
}