Skip to content

Commit

Permalink
JS: fix when parenthesized expr has assignments for the same variable…
Browse files Browse the repository at this point in the history
… which only when interpreted as arguments for an arrow func should error, fixes #528
  • Loading branch information
tdewolff committed Aug 31, 2022
1 parent 8f47f10 commit 655ab04
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ require (
github.com/fsnotify/fsnotify v1.5.4
github.com/matryer/try v0.0.0-20161228173917-9ac251b645a2
github.com/spf13/pflag v1.0.5
github.com/tdewolff/parse/v2 v2.6.2
github.com/tdewolff/parse/v2 v2.6.3
github.com/tdewolff/test v1.0.7
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/tdewolff/parse/v2 v2.6.2 h1:RDExtQ7ThRGSucatK0nri3p+HD/tSreYh1IDtDDAS/I=
github.com/tdewolff/parse/v2 v2.6.2/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs=
github.com/tdewolff/parse/v2 v2.6.3 h1:O5rshbkaRmpRtD7k2lG65bEJpcfUMNg5Cx2uRKWVsI8=
github.com/tdewolff/parse/v2 v2.6.3/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs=
github.com/tdewolff/test v1.0.7 h1:8Vs0142DmPFW/bQeHRP3MV19m1gvndjUb1sn8yy74LM=
github.com/tdewolff/test v1.0.7/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0=
Expand Down
5 changes: 2 additions & 3 deletions js/js_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,6 @@ func TestJS(t *testing.T) {
{`for(var a=5,c=6;;);`, `for(var a=5,c=6;;);`},
{`while(a);var b;var c`, `for(var b,c;a;);`},
{`while(a){d()}var b;var c`, `for(var b,c;a;)d()`},
{`function a(){}var a`, `function a(){}var a`},
{`var a;function a(){}`, `var a;function a(){}`},
{`var [a,b=5,,...c]=[d,e,...f];var z;z`, `var[a,b=5,,...c]=[d,e,...f],z;z`},
{`var {a,b=5,[5+8]:c,...d}={d,e,...f};var z;z`, `var{a,b=5,[5+8]:c,...d}={d,e,...f},z;z`},
{`var a=5;var b=6;a,b`, `var a=5,b=6;a,b`},
Expand Down Expand Up @@ -792,7 +790,8 @@ func TestJS(t *testing.T) {
{`var a=5;({});var b=function(){3}`, `var b,a=5;({},b=function(){3})`}, // #494
{`var a=5;({});var b=class{c(){3}}`, `var b,a=5;({},b=class{c(){3}})`}, // #494
{`({});a={b(){3}}`, `({},a={b(){3}})`}, // #494
{`export default function Foo(){a}Foo.prototype.bar=b`, `export default function Foo(){a}Foo.prototype.bar=b;Foo=6`}, // #525
{`export default function Foo(){a}Foo.prototype.bar=b`, `export default function Foo(){a}Foo.prototype.bar=b`}, // #525
{`(e=1,e=2)`, `e=1,e=2`}, // #528
}

m := minify.New()
Expand Down

0 comments on commit 655ab04

Please sign in to comment.