mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 05:32:09 +03:00
fix(es/minifier): Remap variables on IIFE evaluation (#4230)
- We now check if there's pending inlining before remapping variables. - We now use ad-hoc type for remapping. - We now inline before remapping to prevent interference with inlining.
This commit is contained in:
parent
012d3a67fa
commit
55b98fc874
@ -1,8 +1,7 @@
|
||||
var A;
|
||||
!function(A1) {
|
||||
var Color, Day;
|
||||
let Color;
|
||||
(Color = Color = A1.Color || (A1.Color = {}))[Color.Red = 0] = "Red", Color[Color.Blue = 1] = "Blue";
|
||||
let Day;
|
||||
(Day = Day || (Day = {}))[Day.Monday = 0] = "Monday", Day[Day.Tuesday = 1] = "Tuesday";
|
||||
(Color = A1.Color || (A1.Color = {}))[Color.Red = 0] = "Red", Color[Color.Blue = 1] = "Blue";
|
||||
let Day1;
|
||||
(Day = Day1 || (Day1 = {}))[Day.Monday = 0] = "Monday", Day[Day.Tuesday = 1] = "Tuesday";
|
||||
}(A || (A = {})), A.Color.Red, A.Day.Monday;
|
||||
|
@ -1,5 +1,5 @@
|
||||
var A;
|
||||
!function(A1) {
|
||||
var Color, Day, Color, Day;
|
||||
(Color = Color = A1.Color || (A1.Color = {}))[Color.Red = 0] = "Red", Color[Color.Blue = 1] = "Blue", (Day = Day || (Day = {}))[Day.Monday = 0] = "Monday", Day[Day.Tuesday = 1] = "Tuesday";
|
||||
var Day, Color, Day1;
|
||||
(Color = A1.Color || (A1.Color = {}))[Color.Red = 0] = "Red", Color[Color.Blue = 1] = "Blue", (Day1 = Day || (Day = {}))[Day1.Monday = 0] = "Monday", Day1[Day1.Tuesday = 1] = "Tuesday";
|
||||
}(A || (A = {})), A.Color.Red, A.Day.Monday;
|
||||
|
@ -1,14 +1,11 @@
|
||||
var x1, M, e1;
|
||||
var M, e1;
|
||||
function foo3() {
|
||||
return foo3();
|
||||
}
|
||||
function m1() {
|
||||
return 1;
|
||||
}
|
||||
x1 = 1, function(x) {
|
||||
var x1;
|
||||
x1 = 1;
|
||||
}(1), foo3(), function(x) {
|
||||
foo3(), function(x) {
|
||||
try {} catch (e) {
|
||||
return [];
|
||||
} finally{}
|
||||
|
@ -2,17 +2,14 @@ import * as swcHelpers from "@swc/helpers";
|
||||
function foo3() {
|
||||
return foo3();
|
||||
}
|
||||
x1 = 1, function(x) {
|
||||
var x1;
|
||||
x1 = 1;
|
||||
}(1), foo3(), function(x) {
|
||||
foo3(), function(x) {
|
||||
try {} catch (e) {
|
||||
return [];
|
||||
} finally{}
|
||||
}(1), function(x) {
|
||||
void 0 === x || swcHelpers.typeOf(x);
|
||||
}(1);
|
||||
var x1, M, e1, C = function() {
|
||||
var M, e1, C = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
};
|
||||
|
@ -6,8 +6,7 @@ export var Foo;
|
||||
Bar[Bar.A = 0] = "A", Bar[Bar.B = 1] = "B";
|
||||
}(Bar || (Bar = {})), Foo.A, Bar.A, function(ns1) {
|
||||
var Foo;
|
||||
let Foo;
|
||||
(Foo = Foo = ns1.Foo || (ns1.Foo = {}))[Foo.X = 0] = "X", ns.Foo.X;
|
||||
(Foo = ns1.Foo || (ns1.Foo = {}))[Foo.X = 0] = "X", ns.Foo.X;
|
||||
}(ns || (ns = {})), function(Foo) {
|
||||
Foo[Foo.X = 0] = "X";
|
||||
}(Foo || (Foo = {})), Foo.X;
|
||||
|
@ -5,8 +5,8 @@ export var Foo;
|
||||
}(Foo || (Foo = {})), function(Bar) {
|
||||
Bar[Bar.A = 0] = "A", Bar[Bar.B = 1] = "B";
|
||||
}(Bar || (Bar = {})), Foo.A, Bar.A, function(ns1) {
|
||||
var Foo, Foo;
|
||||
(Foo = Foo = ns1.Foo || (ns1.Foo = {}))[Foo.X = 0] = "X", ns.Foo.X;
|
||||
var Foo;
|
||||
(Foo = ns1.Foo || (ns1.Foo = {}))[Foo.X = 0] = "X", ns.Foo.X;
|
||||
}(ns || (ns = {})), function(Foo) {
|
||||
Foo[Foo.X = 0] = "X";
|
||||
}(Foo || (Foo = {})), Foo.X;
|
||||
|
@ -1,50 +1,29 @@
|
||||
var M, M1, M2;
|
||||
!function(M3) {
|
||||
var E1, E2, E3;
|
||||
let E1;
|
||||
(E1 = E1 = M3.E1 || (M3.E1 = {}))[E1.A = 0] = "A";
|
||||
let E2;
|
||||
(E2 = E2 = M3.E2 || (M3.E2 = {}))[E2.C = 0] = "C";
|
||||
let E3;
|
||||
(E3 = E3 = M3.E3 || (M3.E3 = {}))[E3.A = 0] = "A";
|
||||
(E1 = M3.E1 || (M3.E1 = {}))[E1.A = 0] = "A", (E2 = M3.E2 || (M3.E2 = {}))[E2.C = 0] = "C", (E3 = M3.E3 || (M3.E3 = {}))[E3.A = 0] = "A";
|
||||
}(M || (M = {})), function(M4) {
|
||||
var E1, E2, E3;
|
||||
let E1;
|
||||
(E1 = E1 = M4.E1 || (M4.E1 = {}))[E1.B = 3] = "B";
|
||||
let E2;
|
||||
(E2 = E2 = M4.E2 || (M4.E2 = {}))[E2.B = 3] = "B";
|
||||
let E3;
|
||||
(E3 = E3 = M4.E3 || (M4.E3 = {}))[E3.C = 0] = "C";
|
||||
(E1 = M4.E1 || (M4.E1 = {}))[E1.B = 3] = "B", (E2 = M4.E2 || (M4.E2 = {}))[E2.B = 3] = "B", (E3 = M4.E3 || (M4.E3 = {}))[E3.C = 0] = "C";
|
||||
}(M || (M = {})), function(M5) {
|
||||
var E1, E2, E3;
|
||||
let E1;
|
||||
(E1 = E1 = M5.E1 || (M5.E1 = {}))[E1.C = 0] = "C";
|
||||
let E2;
|
||||
(E2 = E2 = M5.E2 || (M5.E2 = {}))[E2.A = 0] = "A";
|
||||
let E3;
|
||||
(E3 = E3 = M5.E3 || (M5.E3 = {}))[E3.B = 3] = "B";
|
||||
(E1 = M5.E1 || (M5.E1 = {}))[E1.C = 0] = "C", (E2 = M5.E2 || (M5.E2 = {}))[E2.A = 0] = "A", (E3 = M5.E3 || (M5.E3 = {}))[E3.B = 3] = "B";
|
||||
}(M || (M = {})), function(M11) {
|
||||
var E1;
|
||||
let E1;
|
||||
(E1 = E1 = M11.E1 || (M11.E1 = {}))[E1.A = 0] = "A";
|
||||
(E1 = M11.E1 || (M11.E1 = {}))[E1.A = 0] = "A";
|
||||
}(M1 || (M1 = {})), function(M12) {
|
||||
var E1;
|
||||
let E1;
|
||||
(E1 = E1 = M12.E1 || (M12.E1 = {}))[E1.B = 0] = "B";
|
||||
(E1 = M12.E1 || (M12.E1 = {}))[E1.B = 0] = "B";
|
||||
}(M1 || (M1 = {})), function(M13) {
|
||||
var E1;
|
||||
let E1;
|
||||
(E1 = E1 = M13.E1 || (M13.E1 = {}))[E1.C = 0] = "C";
|
||||
(E1 = M13.E1 || (M13.E1 = {}))[E1.C = 0] = "C";
|
||||
}(M1 || (M1 = {})), function(M21) {
|
||||
var E1;
|
||||
let E1;
|
||||
(E1 = E1 = M21.E1 || (M21.E1 = {}))[E1.A = 0] = "A";
|
||||
(E1 = M21.E1 || (M21.E1 = {}))[E1.A = 0] = "A";
|
||||
}(M2 || (M2 = {})), function(M22) {
|
||||
var E1;
|
||||
let E1;
|
||||
(E1 = E1 = M22.E1 || (M22.E1 = {}))[E1.B = 0] = "B";
|
||||
(E1 = M22.E1 || (M22.E1 = {}))[E1.B = 0] = "B";
|
||||
}(M2 || (M2 = {})), function(M23) {
|
||||
var E1;
|
||||
let E1;
|
||||
(E1 = E1 = M23.E1 || (M23.E1 = {}))[E1.C = 0] = "C";
|
||||
(E1 = M23.E1 || (M23.E1 = {}))[E1.C = 0] = "C";
|
||||
}(M2 || (M2 = {}));
|
||||
|
@ -1,29 +1,29 @@
|
||||
var M, M1, M2;
|
||||
!function(M3) {
|
||||
var E1, E2, E3, E1, E2, E3;
|
||||
(E1 = E1 = M3.E1 || (M3.E1 = {}))[E1.A = 0] = "A", (E2 = E2 = M3.E2 || (M3.E2 = {}))[E2.C = 0] = "C", (E3 = E3 = M3.E3 || (M3.E3 = {}))[E3.A = 0] = "A";
|
||||
var E1, E2, E3;
|
||||
(E1 = M3.E1 || (M3.E1 = {}))[E1.A = 0] = "A", (E2 = M3.E2 || (M3.E2 = {}))[E2.C = 0] = "C", (E3 = M3.E3 || (M3.E3 = {}))[E3.A = 0] = "A";
|
||||
}(M || (M = {})), function(M4) {
|
||||
var E1, E2, E3, E1, E2, E3;
|
||||
(E1 = E1 = M4.E1 || (M4.E1 = {}))[E1.B = 3] = "B", (E2 = E2 = M4.E2 || (M4.E2 = {}))[E2.B = 3] = "B", (E3 = E3 = M4.E3 || (M4.E3 = {}))[E3.C = 0] = "C";
|
||||
var E1, E2, E3;
|
||||
(E1 = M4.E1 || (M4.E1 = {}))[E1.B = 3] = "B", (E2 = M4.E2 || (M4.E2 = {}))[E2.B = 3] = "B", (E3 = M4.E3 || (M4.E3 = {}))[E3.C = 0] = "C";
|
||||
}(M || (M = {})), function(M5) {
|
||||
var E1, E2, E3, E1, E2, E3;
|
||||
(E1 = E1 = M5.E1 || (M5.E1 = {}))[E1.C = 0] = "C", (E2 = E2 = M5.E2 || (M5.E2 = {}))[E2.A = 0] = "A", (E3 = E3 = M5.E3 || (M5.E3 = {}))[E3.B = 3] = "B";
|
||||
var E1, E2, E3;
|
||||
(E1 = M5.E1 || (M5.E1 = {}))[E1.C = 0] = "C", (E2 = M5.E2 || (M5.E2 = {}))[E2.A = 0] = "A", (E3 = M5.E3 || (M5.E3 = {}))[E3.B = 3] = "B";
|
||||
}(M || (M = {})), function(M11) {
|
||||
var E1, E1;
|
||||
(E1 = E1 = M11.E1 || (M11.E1 = {}))[E1.A = 0] = "A";
|
||||
var E1;
|
||||
(E1 = M11.E1 || (M11.E1 = {}))[E1.A = 0] = "A";
|
||||
}(M1 || (M1 = {})), function(M12) {
|
||||
var E1, E1;
|
||||
(E1 = E1 = M12.E1 || (M12.E1 = {}))[E1.B = 0] = "B";
|
||||
var E1;
|
||||
(E1 = M12.E1 || (M12.E1 = {}))[E1.B = 0] = "B";
|
||||
}(M1 || (M1 = {})), function(M13) {
|
||||
var E1, E1;
|
||||
(E1 = E1 = M13.E1 || (M13.E1 = {}))[E1.C = 0] = "C";
|
||||
var E1;
|
||||
(E1 = M13.E1 || (M13.E1 = {}))[E1.C = 0] = "C";
|
||||
}(M1 || (M1 = {})), function(M21) {
|
||||
var E1, E1;
|
||||
(E1 = E1 = M21.E1 || (M21.E1 = {}))[E1.A = 0] = "A";
|
||||
var E1;
|
||||
(E1 = M21.E1 || (M21.E1 = {}))[E1.A = 0] = "A";
|
||||
}(M2 || (M2 = {})), function(M22) {
|
||||
var E1, E1;
|
||||
(E1 = E1 = M22.E1 || (M22.E1 = {}))[E1.B = 0] = "B";
|
||||
var E1;
|
||||
(E1 = M22.E1 || (M22.E1 = {}))[E1.B = 0] = "B";
|
||||
}(M2 || (M2 = {})), function(M23) {
|
||||
var E1, E1;
|
||||
(E1 = E1 = M23.E1 || (M23.E1 = {}))[E1.C = 0] = "C";
|
||||
var E1;
|
||||
(E1 = M23.E1 || (M23.E1 = {}))[E1.C = 0] = "C";
|
||||
}(M2 || (M2 = {}));
|
||||
|
@ -1,32 +1,29 @@
|
||||
var M1, M2, M3, M4, M5, M6;
|
||||
!function(M11) {
|
||||
var EImpl1, EImpl1, EConst1, EConst1;
|
||||
let EImpl1;
|
||||
(EImpl1 = EImpl1 || (EImpl1 = {}))[EImpl1.A = 0] = "A", EImpl1[EImpl1.B = 1] = "B", EImpl1[EImpl1.C = 2] = "C", (EImpl1 = EImpl1 || (EImpl1 = {}))[EImpl1.D = 1] = "D", EImpl1[EImpl1.E = 2] = "E", EImpl1[EImpl1.F = 3] = "F";
|
||||
let EConst1;
|
||||
(EConst1 = EConst1 = M11.EConst1 || (M11.EConst1 = {}))[EConst1.A = 3] = "A", EConst1[EConst1.B = 2] = "B", EConst1[EConst1.C = 1] = "C", (EConst1 = EConst1 = M11.EConst1 || (M11.EConst1 = {}))[EConst1.D = 7] = "D", EConst1[EConst1.E = 9] = "E", EConst1[EConst1.F = 8] = "F", EConst1.A, EConst1.B, EConst1.C, EConst1.D, EConst1.E, EConst1.F;
|
||||
var EImpl1, EImpl11, EConst1, EConst11;
|
||||
let EImpl12;
|
||||
(EImpl1 = EImpl12 || (EImpl12 = {}))[EImpl1.A = 0] = "A", EImpl1[EImpl1.B = 1] = "B", EImpl1[EImpl1.C = 2] = "C", (EImpl11 = EImpl12 || (EImpl12 = {}))[EImpl11.D = 1] = "D", EImpl11[EImpl11.E = 2] = "E", EImpl11[EImpl11.F = 3] = "F";
|
||||
let EConst12;
|
||||
(EConst1 = EConst12 = M11.EConst1 || (M11.EConst1 = {}))[EConst1.A = 3] = "A", EConst1[EConst1.B = 2] = "B", EConst1[EConst1.C = 1] = "C", (EConst11 = EConst12 = M11.EConst1 || (M11.EConst1 = {}))[EConst11.D = 7] = "D", EConst11[EConst11.E = 9] = "E", EConst11[EConst11.F = 8] = "F", EConst12.A, EConst12.B, EConst12.C, EConst12.D, EConst12.E, EConst12.F;
|
||||
}(M1 || (M1 = {})), function(M21) {
|
||||
var EComp2, EComp2;
|
||||
let EComp2;
|
||||
(EComp2 = EComp2 = M21.EComp2 || (M21.EComp2 = {}))[EComp2.A = 3] = "A", EComp2[EComp2.B = 3] = "B", EComp2[EComp2.C = 3] = "C", (EComp2 = EComp2 = M21.EComp2 || (M21.EComp2 = {}))[EComp2.D = 3] = "D", EComp2[EComp2.E = 3] = "E", EComp2[EComp2.F = 3] = "F", EComp2.A, EComp2.B, EComp2.C, EComp2.D, EComp2.E, EComp2.F;
|
||||
var EComp2, EComp21;
|
||||
let EComp22;
|
||||
(EComp2 = EComp22 = M21.EComp2 || (M21.EComp2 = {}))[EComp2.A = 3] = "A", EComp2[EComp2.B = 3] = "B", EComp2[EComp2.C = 3] = "C", (EComp21 = EComp22 = M21.EComp2 || (M21.EComp2 = {}))[EComp21.D = 3] = "D", EComp21[EComp21.E = 3] = "E", EComp21[EComp21.F = 3] = "F", EComp22.A, EComp22.B, EComp22.C, EComp22.D, EComp22.E, EComp22.F;
|
||||
}(M2 || (M2 = {})), function(M3) {
|
||||
var EInit, EInit;
|
||||
let EInit;
|
||||
(EInit = EInit || (EInit = {}))[EInit.A = 0] = "A", EInit[EInit.B = 1] = "B", (EInit = EInit || (EInit = {}))[EInit.C = 1] = "C", EInit[EInit.D = 2] = "D", EInit[EInit.E = 3] = "E";
|
||||
var EInit, EInit1;
|
||||
let EInit2;
|
||||
(EInit = EInit2 || (EInit2 = {}))[EInit.A = 0] = "A", EInit[EInit.B = 1] = "B", (EInit1 = EInit2 || (EInit2 = {}))[EInit1.C = 1] = "C", EInit1[EInit1.D = 2] = "D", EInit1[EInit1.E = 3] = "E";
|
||||
}(M3 || (M3 = {})), function(M41) {
|
||||
var Color;
|
||||
let Color;
|
||||
(Color = Color = M41.Color || (M41.Color = {}))[Color.Red = 0] = "Red", Color[Color.Green = 1] = "Green", Color[Color.Blue = 2] = "Blue";
|
||||
(Color = M41.Color || (M41.Color = {}))[Color.Red = 0] = "Red", Color[Color.Green = 1] = "Green", Color[Color.Blue = 2] = "Blue";
|
||||
}(M4 || (M4 = {})), function(M51) {
|
||||
var Color;
|
||||
let Color;
|
||||
(Color = Color = M51.Color || (M51.Color = {}))[Color.Red = 0] = "Red", Color[Color.Green = 1] = "Green", Color[Color.Blue = 2] = "Blue";
|
||||
(Color = M51.Color || (M51.Color = {}))[Color.Red = 0] = "Red", Color[Color.Green = 1] = "Green", Color[Color.Blue = 2] = "Blue";
|
||||
}(M5 || (M5 = {})), function(M61) {
|
||||
var A, Color;
|
||||
let Color;
|
||||
(Color = Color = (A = M61.A || (M61.A = {})).Color || (A.Color = {}))[Color.Red = 0] = "Red", Color[Color.Green = 1] = "Green", Color[Color.Blue = 2] = "Blue";
|
||||
(Color = (A = M61.A || (M61.A = {})).Color || (A.Color = {}))[Color.Red = 0] = "Red", Color[Color.Green = 1] = "Green", Color[Color.Blue = 2] = "Blue";
|
||||
}(M6 || (M6 = {})), function(M62) {
|
||||
var A, Color;
|
||||
let A1, Color;
|
||||
(Color = Color = (A = A1 = M62.A || (M62.A = {})).Color || (A.Color = {}))[Color.Yellow = 1] = "Yellow", A1.Color.Yellow, A1.Color.Red;
|
||||
let A1;
|
||||
(Color = (A = A1 = M62.A || (M62.A = {})).Color || (A.Color = {}))[Color.Yellow = 1] = "Yellow", A1.Color.Yellow, A1.Color.Red;
|
||||
}(M6 || (M6 = {}));
|
||||
|
@ -1,23 +1,23 @@
|
||||
var M1, M2, M3, M4, M5, M6;
|
||||
!function(M11) {
|
||||
var EImpl1, EImpl1, EConst1, EConst1, EImpl1, EConst1;
|
||||
(EImpl1 = EImpl1 || (EImpl1 = {}))[EImpl1.A = 0] = "A", EImpl1[EImpl1.B = 1] = "B", EImpl1[EImpl1.C = 2] = "C", (EImpl1 = EImpl1 || (EImpl1 = {}))[EImpl1.D = 1] = "D", EImpl1[EImpl1.E = 2] = "E", EImpl1[EImpl1.F = 3] = "F", (EConst1 = EConst1 = M11.EConst1 || (M11.EConst1 = {}))[EConst1.A = 3] = "A", EConst1[EConst1.B = 2] = "B", EConst1[EConst1.C = 1] = "C", (EConst1 = EConst1 = M11.EConst1 || (M11.EConst1 = {}))[EConst1.D = 7] = "D", EConst1[EConst1.E = 9] = "E", EConst1[EConst1.F = 8] = "F", EConst1.A, EConst1.B, EConst1.C, EConst1.D, EConst1.E, EConst1.F;
|
||||
var EImpl1, EImpl11, EConst1, EConst11, EImpl12, EConst12;
|
||||
(EImpl1 = EImpl12 || (EImpl12 = {}))[EImpl1.A = 0] = "A", EImpl1[EImpl1.B = 1] = "B", EImpl1[EImpl1.C = 2] = "C", (EImpl11 = EImpl12 || (EImpl12 = {}))[EImpl11.D = 1] = "D", EImpl11[EImpl11.E = 2] = "E", EImpl11[EImpl11.F = 3] = "F", (EConst1 = EConst12 = M11.EConst1 || (M11.EConst1 = {}))[EConst1.A = 3] = "A", EConst1[EConst1.B = 2] = "B", EConst1[EConst1.C = 1] = "C", (EConst11 = EConst12 = M11.EConst1 || (M11.EConst1 = {}))[EConst11.D = 7] = "D", EConst11[EConst11.E = 9] = "E", EConst11[EConst11.F = 8] = "F", EConst12.A, EConst12.B, EConst12.C, EConst12.D, EConst12.E, EConst12.F;
|
||||
}(M1 || (M1 = {})), function(M21) {
|
||||
var EComp2, EComp2, EComp2;
|
||||
(EComp2 = EComp2 = M21.EComp2 || (M21.EComp2 = {}))[EComp2.A = 3] = "A", EComp2[EComp2.B = 3] = "B", EComp2[EComp2.C = 3] = "C", (EComp2 = EComp2 = M21.EComp2 || (M21.EComp2 = {}))[EComp2.D = 3] = "D", EComp2[EComp2.E = 3] = "E", EComp2[EComp2.F = 3] = "F", EComp2.A, EComp2.B, EComp2.C, EComp2.D, EComp2.E, EComp2.F;
|
||||
var EComp2, EComp21, EComp22;
|
||||
(EComp2 = EComp22 = M21.EComp2 || (M21.EComp2 = {}))[EComp2.A = 3] = "A", EComp2[EComp2.B = 3] = "B", EComp2[EComp2.C = 3] = "C", (EComp21 = EComp22 = M21.EComp2 || (M21.EComp2 = {}))[EComp21.D = 3] = "D", EComp21[EComp21.E = 3] = "E", EComp21[EComp21.F = 3] = "F", EComp22.A, EComp22.B, EComp22.C, EComp22.D, EComp22.E, EComp22.F;
|
||||
}(M2 || (M2 = {})), function(M3) {
|
||||
var EInit, EInit, EInit;
|
||||
(EInit = EInit || (EInit = {}))[EInit.A = 0] = "A", EInit[EInit.B = 1] = "B", (EInit = EInit || (EInit = {}))[EInit.C = 1] = "C", EInit[EInit.D = 2] = "D", EInit[EInit.E = 3] = "E";
|
||||
var EInit, EInit1, EInit2;
|
||||
(EInit1 = EInit || (EInit = {}))[EInit1.A = 0] = "A", EInit1[EInit1.B = 1] = "B", (EInit2 = EInit || (EInit = {}))[EInit2.C = 1] = "C", EInit2[EInit2.D = 2] = "D", EInit2[EInit2.E = 3] = "E";
|
||||
}(M3 || (M3 = {})), function(M41) {
|
||||
var Color, Color;
|
||||
(Color = Color = M41.Color || (M41.Color = {}))[Color.Red = 0] = "Red", Color[Color.Green = 1] = "Green", Color[Color.Blue = 2] = "Blue";
|
||||
var Color;
|
||||
(Color = M41.Color || (M41.Color = {}))[Color.Red = 0] = "Red", Color[Color.Green = 1] = "Green", Color[Color.Blue = 2] = "Blue";
|
||||
}(M4 || (M4 = {})), function(M51) {
|
||||
var Color, Color;
|
||||
(Color = Color = M51.Color || (M51.Color = {}))[Color.Red = 0] = "Red", Color[Color.Green = 1] = "Green", Color[Color.Blue = 2] = "Blue";
|
||||
var Color;
|
||||
(Color = M51.Color || (M51.Color = {}))[Color.Red = 0] = "Red", Color[Color.Green = 1] = "Green", Color[Color.Blue = 2] = "Blue";
|
||||
}(M5 || (M5 = {})), function(M61) {
|
||||
var A, Color, Color;
|
||||
(Color = Color = (A = M61.A || (M61.A = {})).Color || (A.Color = {}))[Color.Red = 0] = "Red", Color[Color.Green = 1] = "Green", Color[Color.Blue = 2] = "Blue";
|
||||
var A, Color;
|
||||
(Color = (A = M61.A || (M61.A = {})).Color || (A.Color = {}))[Color.Red = 0] = "Red", Color[Color.Green = 1] = "Green", Color[Color.Blue = 2] = "Blue";
|
||||
}(M6 || (M6 = {})), function(M62) {
|
||||
var A, Color, Color, A1;
|
||||
(Color = Color = (A = A1 = M62.A || (M62.A = {})).Color || (A.Color = {}))[Color.Yellow = 1] = "Yellow", A1.Color.Yellow, A1.Color.Red;
|
||||
var A, Color, A1;
|
||||
(Color = (A = A1 = M62.A || (M62.A = {})).Color || (A.Color = {}))[Color.Yellow = 1] = "Yellow", A1.Color.Yellow, A1.Color.Red;
|
||||
}(M6 || (M6 = {}));
|
||||
|
@ -3,11 +3,10 @@ var A, D, E, F;
|
||||
return !0;
|
||||
}, function(E1) {
|
||||
var Color;
|
||||
let Color;
|
||||
(Color = Color = E1.Color || (E1.Color = {}))[Color.Red = 0] = "Red", E1.fn = function() {}, E1.C = class {
|
||||
(Color = E1.Color || (E1.Color = {}))[Color.Red = 0] = "Red", E1.fn = function() {}, E1.C = class {
|
||||
}, (E1.M || (E1.M = {})).x = 42;
|
||||
}(E || (E = {})), function(F) {
|
||||
var Color;
|
||||
let Color;
|
||||
(Color = Color || (Color = {}))[Color.Red = 0] = "Red";
|
||||
let Color1;
|
||||
(Color = Color1 || (Color1 = {}))[Color.Red = 0] = "Red";
|
||||
}(F || (F = {}));
|
||||
|
@ -3,15 +3,15 @@ import * as swcHelpers from "@swc/helpers";
|
||||
(A || (A = {})).x = 12, (D || (D = {})).yes = function() {
|
||||
return !0;
|
||||
}, function(E1) {
|
||||
(Color = Color = E1.Color || (E1.Color = {}))[Color.Red = 0] = "Red", E1.fn = function() {};
|
||||
var Color, Color, C = function() {
|
||||
(Color = E1.Color || (E1.Color = {}))[Color.Red = 0] = "Red", E1.fn = function() {};
|
||||
var Color, C = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
};
|
||||
E1.C = C, (E1.M || (E1.M = {})).x = 42;
|
||||
}(E || (E = {})), function(F) {
|
||||
(Color = Color || (Color = {}))[Color.Red = 0] = "Red";
|
||||
var Color, Color, C = function() {
|
||||
(Color1 = Color || (Color = {}))[Color1.Red = 0] = "Red";
|
||||
var Color, Color1, C = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
};
|
||||
|
@ -1,18 +1,18 @@
|
||||
var onlyT, TU;
|
||||
!function(onlyT) {
|
||||
var E, F;
|
||||
let E;
|
||||
(E = E || (E = {}))[E.A = 0] = "A";
|
||||
let F;
|
||||
(F = F || (F = {}))[F.A = 0] = "A", function(x, a, b) {}(E.A, (x)=>E.A
|
||||
, (x)=>F.A
|
||||
let E1;
|
||||
(E = E1 || (E1 = {}))[E.A = 0] = "A";
|
||||
let F1;
|
||||
(F = F1 || (F1 = {}))[F.A = 0] = "A", function(x, a, b) {}(E1.A, (x)=>E1.A
|
||||
, (x)=>F1.A
|
||||
);
|
||||
}(onlyT || (onlyT = {})), function(TU) {
|
||||
var E, F;
|
||||
let E;
|
||||
(E = E || (E = {}))[E.A = 0] = "A";
|
||||
let F;
|
||||
(F = F || (F = {}))[F.A = 0] = "A", function(x, a, b) {}(E.A, (x)=>E.A
|
||||
, (x)=>F.A
|
||||
let E2;
|
||||
(E = E2 || (E2 = {}))[E.A = 0] = "A";
|
||||
let F2;
|
||||
(F = F2 || (F2 = {}))[F.A = 0] = "A", function(x, a, b) {}(E2.A, (x)=>E2.A
|
||||
, (x)=>F2.A
|
||||
);
|
||||
}(TU || (TU = {}));
|
||||
|
@ -1,22 +1,22 @@
|
||||
var onlyT, TU;
|
||||
!function(onlyT) {
|
||||
var E, F, E, F;
|
||||
var E, F, E1, F1;
|
||||
(function(a, b) {})(function(x) {
|
||||
return 1;
|
||||
}, function(x) {
|
||||
return "";
|
||||
}), (E = E || (E = {}))[E.A = 0] = "A", (F = F || (F = {}))[F.A = 0] = "A", function(x, a, b) {}(E.A, function(x) {
|
||||
}), (E1 = E || (E = {}))[E1.A = 0] = "A", (F1 = F || (F = {}))[F1.A = 0] = "A", function(x, a, b) {}(E.A, function(x) {
|
||||
return E.A;
|
||||
}, function(x) {
|
||||
return F.A;
|
||||
});
|
||||
}(onlyT || (onlyT = {})), function(TU) {
|
||||
var E, F, E, F;
|
||||
var E, F, E2, F2;
|
||||
(function(a, b) {})(function(x) {
|
||||
return 1;
|
||||
}, function(x) {
|
||||
return "";
|
||||
}), (E = E || (E = {}))[E.A = 0] = "A", (F = F || (F = {}))[F.A = 0] = "A", function(x, a, b) {}(E.A, function(x) {
|
||||
}), (E2 = E || (E = {}))[E2.A = 0] = "A", (F2 = F || (F = {}))[F2.A = 0] = "A", function(x, a, b) {}(E.A, function(x) {
|
||||
return E.A;
|
||||
}, function(x) {
|
||||
return F.A;
|
||||
|
@ -11,8 +11,7 @@ M.Point, m.Point, (M2 || (M2 = {})).Point = class {
|
||||
var m2 = M2, a2 = m2.Point, a2 = M2.Point;
|
||||
a2.Origin(), new m2.Point(), new M2.Point(), function(M31) {
|
||||
var Color;
|
||||
let Color;
|
||||
(Color = Color = M31.Color || (M31.Color = {}))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red";
|
||||
(Color = M31.Color || (M31.Color = {}))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red";
|
||||
}(M3 || (M3 = {}));
|
||||
var m3 = M3, a3 = m3.Color, a3 = M3.Color;
|
||||
a3.Blue, M3.Color.Red, m3.Color.Blue;
|
||||
|
@ -18,8 +18,8 @@ M.Point, m.Point, function(M21) {
|
||||
}(M2 || (M2 = {}));
|
||||
var m2 = M2, a2 = m2.Point, a2 = M2.Point;
|
||||
a2.Origin(), new m2.Point(), new M2.Point(), function(M31) {
|
||||
var Color, Color;
|
||||
(Color = Color = M31.Color || (M31.Color = {}))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red";
|
||||
var Color;
|
||||
(Color = M31.Color || (M31.Color = {}))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red";
|
||||
}(M3 || (M3 = {}));
|
||||
var m3 = M3, a3 = m3.Color, a3 = M3.Color;
|
||||
a3.Blue, M3.Color.Red, m3.Color.Blue;
|
||||
|
@ -2,14 +2,14 @@ import * as swcHelpers from "@swc/helpers";
|
||||
var A = function() {
|
||||
"use strict";
|
||||
function A() {
|
||||
swcHelpers.classCallCheck(this, A), (E = E || (E = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C";
|
||||
var E, E, C = function() {
|
||||
swcHelpers.classCallCheck(this, A), (E = E1 || (E1 = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C";
|
||||
var E, E1, C = function() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
};
|
||||
}
|
||||
return A.prototype.m = function() {
|
||||
(E = E || (E = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C";
|
||||
var E, E, C = function() {
|
||||
(E = E2 || (E2 = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C";
|
||||
var E, E2, C = function() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
};
|
||||
return new C();
|
||||
@ -17,8 +17,8 @@ var A = function() {
|
||||
{
|
||||
key: "p",
|
||||
get: function() {
|
||||
(E = E || (E = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C";
|
||||
var E, E, C = function() {
|
||||
(E = E3 || (E3 = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C";
|
||||
var E, E3, C = function() {
|
||||
swcHelpers.classCallCheck(this, C);
|
||||
};
|
||||
return new C();
|
||||
|
@ -1,8 +1,8 @@
|
||||
var A, Y;
|
||||
!function(A) {
|
||||
var Color;
|
||||
let Color;
|
||||
(Color = Color || (Color = {}))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red";
|
||||
let Color1;
|
||||
(Color = Color1 || (Color1 = {}))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red";
|
||||
}(A || (A = {})), function(Y1) {
|
||||
var Color;
|
||||
class A1 {
|
||||
@ -12,9 +12,7 @@ var A, Y;
|
||||
}
|
||||
Y1.AA = AA, Y1.B = class extends AA {
|
||||
}, Y1.BB = class extends A1 {
|
||||
};
|
||||
let Color;
|
||||
(Color = Color = Y1.Color || (Y1.Color = {}))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red", Y1.x = 12, Y1.F = function(s) {
|
||||
}, (Color = Y1.Color || (Y1.Color = {}))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red", Y1.x = 12, Y1.F = function(s) {
|
||||
return 2;
|
||||
}, Y1.array = null, Y1.fn = (s)=>'hello ' + s
|
||||
, Y1.ol = {
|
||||
|
@ -1,7 +1,7 @@
|
||||
var A, Y;
|
||||
import * as swcHelpers from "@swc/helpers";
|
||||
!function(A3) {
|
||||
var Module, Color, A1, Color, A2 = function() {
|
||||
var Module, Color, A1, Color1, A2 = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, A2);
|
||||
}, AA1 = function() {
|
||||
@ -27,9 +27,9 @@ import * as swcHelpers from "@swc/helpers";
|
||||
Module || (Module = {}), A1 = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, A1);
|
||||
}, (Color = Color || (Color = {}))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red";
|
||||
}, (Color1 = Color || (Color = {}))[Color1.Blue = 0] = "Blue", Color1[Color1.Red = 1] = "Red";
|
||||
}(A || (A = {})), function(Y1) {
|
||||
var Color, A6 = function() {
|
||||
var A6 = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, A6);
|
||||
};
|
||||
@ -61,7 +61,7 @@ import * as swcHelpers from "@swc/helpers";
|
||||
Y1.BB = BB, Y1.Module || (Y1.Module = {}), A5 = function() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, A5);
|
||||
}, (Color = Color = Y1.Color || (Y1.Color = {}))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red", Y1.x = 12, Y1.F = function(s) {
|
||||
}, (Color = Y1.Color || (Y1.Color = {}))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red", Y1.x = 12, Y1.F = function(s) {
|
||||
return 2;
|
||||
}, Y1.array = null, Y1.fn = function(s) {
|
||||
return "hello " + s;
|
||||
|
@ -3,6 +3,5 @@ var X, Y, D;
|
||||
X1.Y || (X1.Y = {});
|
||||
}(X || (X = {})), function(Y3) {
|
||||
var Y1, Y2;
|
||||
let Y2, Y2;
|
||||
(Y2 = Y2 = (Y1 = Y2 = Y3.Y || (Y3.Y = {})).Y || (Y1.Y = {}))[Y2.Red = 0] = "Red", Y2[Y2.Blue = 1] = "Blue";
|
||||
(Y2 = (Y1 = Y3.Y || (Y3.Y = {})).Y || (Y1.Y = {}))[Y2.Red = 0] = "Red", Y2[Y2.Blue = 1] = "Blue";
|
||||
}(Y || (Y = {})), (D || (D = {})).E = 'hello';
|
||||
|
@ -8,6 +8,6 @@ import * as swcHelpers from "@swc/helpers";
|
||||
}(B || (B = {})), function(X1) {
|
||||
X1.Y || (X1.Y = {});
|
||||
}(X || (X = {})), function(Y2) {
|
||||
var _$Y, Y1, _$Y, _$Y;
|
||||
(_$Y = _$Y = (Y1 = _$Y = Y2.Y || (Y2.Y = {})).Y || (Y1.Y = {}))[_$Y.Red = 0] = "Red", _$Y[_$Y.Blue = 1] = "Blue";
|
||||
var Y1, _$Y;
|
||||
(_$Y = (Y1 = Y2.Y || (Y2.Y = {})).Y || (Y1.Y = {}))[_$Y.Red = 0] = "Red", _$Y[_$Y.Blue = 1] = "Blue";
|
||||
}(Y || (Y = {})), (D || (D = {})).E = "hello";
|
||||
|
@ -217,8 +217,8 @@ var TypeScript;
|
||||
}
|
||||
}
|
||||
TypeScript1.AstPathContext = AstPathContext;
|
||||
let GetAstPathOptions;
|
||||
(GetAstPathOptions = GetAstPathOptions = TypeScript1.GetAstPathOptions || (TypeScript1.GetAstPathOptions = {}))[GetAstPathOptions.Default = 0] = "Default", GetAstPathOptions[GetAstPathOptions.EdgeInclusive = 1] = "EdgeInclusive", GetAstPathOptions[GetAstPathOptions.DontPruneSearchBasedOnPosition = 2] = "DontPruneSearchBasedOnPosition", TypeScript1.getAstPathToPosition = function(script, pos, options = GetAstPathOptions.Default) {
|
||||
let GetAstPathOptions1;
|
||||
(GetAstPathOptions = GetAstPathOptions1 = TypeScript1.GetAstPathOptions || (TypeScript1.GetAstPathOptions = {}))[GetAstPathOptions.Default = 0] = "Default", GetAstPathOptions[GetAstPathOptions.EdgeInclusive = 1] = "EdgeInclusive", GetAstPathOptions[GetAstPathOptions.DontPruneSearchBasedOnPosition = 2] = "DontPruneSearchBasedOnPosition", TypeScript1.getAstPathToPosition = function(script, pos, options = GetAstPathOptions1.Default) {
|
||||
var lookInComments = (comments)=>{
|
||||
if (comments && comments.length > 0) for(var i = 0; i < comments.length; i++){
|
||||
var minChar = comments[i].minChar, limChar = comments[i].limChar;
|
||||
@ -226,12 +226,12 @@ var TypeScript;
|
||||
}
|
||||
}, pre = function(cur, parent, walker) {
|
||||
if (isValidAstNode(cur)) {
|
||||
var inclusive = hasFlag(options, GetAstPathOptions.EdgeInclusive) || cur.nodeType === TypeScript.NodeType.Name || pos === script.limChar, minChar = cur.minChar, limChar = cur.limChar + (inclusive ? 1 : 0);
|
||||
var inclusive = hasFlag(options, GetAstPathOptions1.EdgeInclusive) || cur.nodeType === TypeScript.NodeType.Name || pos === script.limChar, minChar = cur.minChar, limChar = cur.limChar + (inclusive ? 1 : 0);
|
||||
if (pos >= minChar && pos < limChar) {
|
||||
var previous = ctx.path.ast();
|
||||
(null == previous || cur.minChar >= previous.minChar && cur.limChar <= previous.limChar) && ctx.path.push(cur);
|
||||
}
|
||||
pos < limChar && lookInComments(cur.preComments), pos >= minChar && lookInComments(cur.postComments), hasFlag(options, GetAstPathOptions.DontPruneSearchBasedOnPosition) || (walker.options.goChildren = minChar <= pos && pos <= limChar);
|
||||
pos < limChar && lookInComments(cur.preComments), pos >= minChar && lookInComments(cur.postComments), hasFlag(options, GetAstPathOptions1.DontPruneSearchBasedOnPosition) || (walker.options.goChildren = minChar <= pos && pos <= limChar);
|
||||
}
|
||||
return cur;
|
||||
}, ctx = new AstPathContext();
|
||||
|
@ -184,9 +184,9 @@ import * as swcHelpers from "@swc/helpers";
|
||||
}, AstPath;
|
||||
}();
|
||||
TypeScript1.AstPath = AstPath, TypeScript1.isValidAstNode = isValidAstNode;
|
||||
var GetAstPathOptions, AstPathContext = function AstPathContext() {
|
||||
var GetAstPathOptions1, AstPathContext = function AstPathContext() {
|
||||
"use strict";
|
||||
swcHelpers.classCallCheck(this, AstPathContext), this.path = new TypeScript.AstPath();
|
||||
};
|
||||
TypeScript1.AstPathContext = AstPathContext, (GetAstPathOptions = GetAstPathOptions = TypeScript1.GetAstPathOptions || (TypeScript1.GetAstPathOptions = {}))[GetAstPathOptions.Default = 0] = "Default", GetAstPathOptions[GetAstPathOptions.EdgeInclusive = 1] = "EdgeInclusive", GetAstPathOptions[GetAstPathOptions.DontPruneSearchBasedOnPosition = 2] = "DontPruneSearchBasedOnPosition", TypeScript1.getAstPathToPosition = getAstPathToPosition, TypeScript1.getTokenizationOffset = getTokenizationOffset, TypeScript1.walkAST = walkAST;
|
||||
TypeScript1.AstPathContext = AstPathContext, (GetAstPathOptions1 = GetAstPathOptions = TypeScript1.GetAstPathOptions || (TypeScript1.GetAstPathOptions = {}))[GetAstPathOptions1.Default = 0] = "Default", GetAstPathOptions1[GetAstPathOptions1.EdgeInclusive = 1] = "EdgeInclusive", GetAstPathOptions1[GetAstPathOptions1.DontPruneSearchBasedOnPosition = 2] = "DontPruneSearchBasedOnPosition", TypeScript1.getAstPathToPosition = getAstPathToPosition, TypeScript1.getTokenizationOffset = getTokenizationOffset, TypeScript1.walkAST = walkAST;
|
||||
}(TypeScript || (TypeScript = {}));
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,6 +1,5 @@
|
||||
var TypeScript;
|
||||
!function(TypeScript1) {
|
||||
var NodeType;
|
||||
let NodeType;
|
||||
(NodeType = NodeType = TypeScript1.NodeType || (TypeScript1.NodeType = {}))[NodeType.None = 0] = "None", NodeType[NodeType.Empty = 1] = "Empty", NodeType[NodeType.EmptyExpr = 2] = "EmptyExpr", NodeType[NodeType.True = 3] = "True", NodeType[NodeType.False = 4] = "False", NodeType[NodeType.This = 5] = "This", NodeType[NodeType.Super = 6] = "Super", NodeType[NodeType.QString = 7] = "QString", NodeType[NodeType.Regex = 8] = "Regex", NodeType[NodeType.Null = 9] = "Null", NodeType[NodeType.ArrayLit = 10] = "ArrayLit", NodeType[NodeType.ObjectLit = 11] = "ObjectLit", NodeType[NodeType.Void = 12] = "Void", NodeType[NodeType.Comma = 13] = "Comma", NodeType[NodeType.Pos = 14] = "Pos", NodeType[NodeType.Neg = 15] = "Neg", NodeType[NodeType.Delete = 16] = "Delete", NodeType[NodeType.Await = 17] = "Await", NodeType[NodeType.In = 18] = "In", NodeType[NodeType.Dot = 19] = "Dot", NodeType[NodeType.From = 20] = "From", NodeType[NodeType.Is = 21] = "Is", NodeType[NodeType.InstOf = 22] = "InstOf", NodeType[NodeType.Typeof = 23] = "Typeof", NodeType[NodeType.NumberLit = 24] = "NumberLit", NodeType[NodeType.Name = 25] = "Name", NodeType[NodeType.TypeRef = 26] = "TypeRef", NodeType[NodeType.Index = 27] = "Index", NodeType[NodeType.Call = 28] = "Call", NodeType[NodeType.New = 29] = "New", NodeType[NodeType.Asg = 30] = "Asg", NodeType[NodeType.AsgAdd = 31] = "AsgAdd", NodeType[NodeType.AsgSub = 32] = "AsgSub", NodeType[NodeType.AsgDiv = 33] = "AsgDiv", NodeType[NodeType.AsgMul = 34] = "AsgMul", NodeType[NodeType.AsgMod = 35] = "AsgMod", NodeType[NodeType.AsgAnd = 36] = "AsgAnd", NodeType[NodeType.AsgXor = 37] = "AsgXor", NodeType[NodeType.AsgOr = 38] = "AsgOr", NodeType[NodeType.AsgLsh = 39] = "AsgLsh", NodeType[NodeType.AsgRsh = 40] = "AsgRsh", NodeType[NodeType.AsgRs2 = 41] = "AsgRs2", NodeType[NodeType.ConditionalExpression = 42] = "ConditionalExpression", NodeType[NodeType.LogOr = 43] = "LogOr", NodeType[NodeType.LogAnd = 44] = "LogAnd", NodeType[NodeType.Or = 45] = "Or", NodeType[NodeType.Xor = 46] = "Xor", NodeType[NodeType.And = 47] = "And", NodeType[NodeType.Eq = 48] = "Eq", NodeType[NodeType.Ne = 49] = "Ne", NodeType[NodeType.Eqv = 50] = "Eqv", NodeType[NodeType.NEqv = 51] = "NEqv", NodeType[NodeType.Lt = 52] = "Lt", NodeType[NodeType.Le = 53] = "Le", NodeType[NodeType.Gt = 54] = "Gt", NodeType[NodeType.Ge = 55] = "Ge", NodeType[NodeType.Add = 56] = "Add", NodeType[NodeType.Sub = 57] = "Sub", NodeType[NodeType.Mul = 58] = "Mul", NodeType[NodeType.Div = 59] = "Div", NodeType[NodeType.Mod = 60] = "Mod", NodeType[NodeType.Lsh = 61] = "Lsh", NodeType[NodeType.Rsh = 62] = "Rsh", NodeType[NodeType.Rs2 = 63] = "Rs2", NodeType[NodeType.Not = 64] = "Not", NodeType[NodeType.LogNot = 65] = "LogNot", NodeType[NodeType.IncPre = 66] = "IncPre", NodeType[NodeType.DecPre = 67] = "DecPre", NodeType[NodeType.IncPost = 68] = "IncPost", NodeType[NodeType.DecPost = 69] = "DecPost", NodeType[NodeType.TypeAssertion = 70] = "TypeAssertion", NodeType[NodeType.FuncDecl = 71] = "FuncDecl", NodeType[NodeType.Member = 72] = "Member", NodeType[NodeType.VarDecl = 73] = "VarDecl", NodeType[NodeType.ArgDecl = 74] = "ArgDecl", NodeType[NodeType.Return = 75] = "Return", NodeType[NodeType.Break = 76] = "Break", NodeType[NodeType.Continue = 77] = "Continue", NodeType[NodeType.Throw = 78] = "Throw", NodeType[NodeType.For = 79] = "For", NodeType[NodeType.ForIn = 80] = "ForIn", NodeType[NodeType.If = 81] = "If", NodeType[NodeType.While = 82] = "While", NodeType[NodeType.DoWhile = 83] = "DoWhile", NodeType[NodeType.Block = 84] = "Block", NodeType[NodeType.Case = 85] = "Case", NodeType[NodeType.Switch = 86] = "Switch", NodeType[NodeType.Try = 87] = "Try", NodeType[NodeType.TryCatch = 88] = "TryCatch", NodeType[NodeType.TryFinally = 89] = "TryFinally", NodeType[NodeType.Finally = 90] = "Finally", NodeType[NodeType.Catch = 91] = "Catch", NodeType[NodeType.List = 92] = "List", NodeType[NodeType.Script = 93] = "Script", NodeType[NodeType.ClassDeclaration = 94] = "ClassDeclaration", NodeType[NodeType.InterfaceDeclaration = 95] = "InterfaceDeclaration", NodeType[NodeType.ModuleDeclaration = 96] = "ModuleDeclaration", NodeType[NodeType.ImportDeclaration = 97] = "ImportDeclaration", NodeType[NodeType.With = 98] = "With", NodeType[NodeType.Label = 99] = "Label", NodeType[NodeType.LabeledStatement = 100] = "LabeledStatement", NodeType[NodeType.EBStart = 101] = "EBStart", NodeType[NodeType.GotoEB = 102] = "GotoEB", NodeType[NodeType.EndCode = 103] = "EndCode", NodeType[NodeType.Error = 104] = "Error", NodeType[NodeType.Comment = 105] = "Comment", NodeType[NodeType.Debugger = 106] = "Debugger", NodeType[NodeType.GeneralNode = 71] = "GeneralNode", NodeType[NodeType.LastAsg = 41] = "LastAsg";
|
||||
(NodeType = TypeScript1.NodeType || (TypeScript1.NodeType = {}))[NodeType.None = 0] = "None", NodeType[NodeType.Empty = 1] = "Empty", NodeType[NodeType.EmptyExpr = 2] = "EmptyExpr", NodeType[NodeType.True = 3] = "True", NodeType[NodeType.False = 4] = "False", NodeType[NodeType.This = 5] = "This", NodeType[NodeType.Super = 6] = "Super", NodeType[NodeType.QString = 7] = "QString", NodeType[NodeType.Regex = 8] = "Regex", NodeType[NodeType.Null = 9] = "Null", NodeType[NodeType.ArrayLit = 10] = "ArrayLit", NodeType[NodeType.ObjectLit = 11] = "ObjectLit", NodeType[NodeType.Void = 12] = "Void", NodeType[NodeType.Comma = 13] = "Comma", NodeType[NodeType.Pos = 14] = "Pos", NodeType[NodeType.Neg = 15] = "Neg", NodeType[NodeType.Delete = 16] = "Delete", NodeType[NodeType.Await = 17] = "Await", NodeType[NodeType.In = 18] = "In", NodeType[NodeType.Dot = 19] = "Dot", NodeType[NodeType.From = 20] = "From", NodeType[NodeType.Is = 21] = "Is", NodeType[NodeType.InstOf = 22] = "InstOf", NodeType[NodeType.Typeof = 23] = "Typeof", NodeType[NodeType.NumberLit = 24] = "NumberLit", NodeType[NodeType.Name = 25] = "Name", NodeType[NodeType.TypeRef = 26] = "TypeRef", NodeType[NodeType.Index = 27] = "Index", NodeType[NodeType.Call = 28] = "Call", NodeType[NodeType.New = 29] = "New", NodeType[NodeType.Asg = 30] = "Asg", NodeType[NodeType.AsgAdd = 31] = "AsgAdd", NodeType[NodeType.AsgSub = 32] = "AsgSub", NodeType[NodeType.AsgDiv = 33] = "AsgDiv", NodeType[NodeType.AsgMul = 34] = "AsgMul", NodeType[NodeType.AsgMod = 35] = "AsgMod", NodeType[NodeType.AsgAnd = 36] = "AsgAnd", NodeType[NodeType.AsgXor = 37] = "AsgXor", NodeType[NodeType.AsgOr = 38] = "AsgOr", NodeType[NodeType.AsgLsh = 39] = "AsgLsh", NodeType[NodeType.AsgRsh = 40] = "AsgRsh", NodeType[NodeType.AsgRs2 = 41] = "AsgRs2", NodeType[NodeType.ConditionalExpression = 42] = "ConditionalExpression", NodeType[NodeType.LogOr = 43] = "LogOr", NodeType[NodeType.LogAnd = 44] = "LogAnd", NodeType[NodeType.Or = 45] = "Or", NodeType[NodeType.Xor = 46] = "Xor", NodeType[NodeType.And = 47] = "And", NodeType[NodeType.Eq = 48] = "Eq", NodeType[NodeType.Ne = 49] = "Ne", NodeType[NodeType.Eqv = 50] = "Eqv", NodeType[NodeType.NEqv = 51] = "NEqv", NodeType[NodeType.Lt = 52] = "Lt", NodeType[NodeType.Le = 53] = "Le", NodeType[NodeType.Gt = 54] = "Gt", NodeType[NodeType.Ge = 55] = "Ge", NodeType[NodeType.Add = 56] = "Add", NodeType[NodeType.Sub = 57] = "Sub", NodeType[NodeType.Mul = 58] = "Mul", NodeType[NodeType.Div = 59] = "Div", NodeType[NodeType.Mod = 60] = "Mod", NodeType[NodeType.Lsh = 61] = "Lsh", NodeType[NodeType.Rsh = 62] = "Rsh", NodeType[NodeType.Rs2 = 63] = "Rs2", NodeType[NodeType.Not = 64] = "Not", NodeType[NodeType.LogNot = 65] = "LogNot", NodeType[NodeType.IncPre = 66] = "IncPre", NodeType[NodeType.DecPre = 67] = "DecPre", NodeType[NodeType.IncPost = 68] = "IncPost", NodeType[NodeType.DecPost = 69] = "DecPost", NodeType[NodeType.TypeAssertion = 70] = "TypeAssertion", NodeType[NodeType.FuncDecl = 71] = "FuncDecl", NodeType[NodeType.Member = 72] = "Member", NodeType[NodeType.VarDecl = 73] = "VarDecl", NodeType[NodeType.ArgDecl = 74] = "ArgDecl", NodeType[NodeType.Return = 75] = "Return", NodeType[NodeType.Break = 76] = "Break", NodeType[NodeType.Continue = 77] = "Continue", NodeType[NodeType.Throw = 78] = "Throw", NodeType[NodeType.For = 79] = "For", NodeType[NodeType.ForIn = 80] = "ForIn", NodeType[NodeType.If = 81] = "If", NodeType[NodeType.While = 82] = "While", NodeType[NodeType.DoWhile = 83] = "DoWhile", NodeType[NodeType.Block = 84] = "Block", NodeType[NodeType.Case = 85] = "Case", NodeType[NodeType.Switch = 86] = "Switch", NodeType[NodeType.Try = 87] = "Try", NodeType[NodeType.TryCatch = 88] = "TryCatch", NodeType[NodeType.TryFinally = 89] = "TryFinally", NodeType[NodeType.Finally = 90] = "Finally", NodeType[NodeType.Catch = 91] = "Catch", NodeType[NodeType.List = 92] = "List", NodeType[NodeType.Script = 93] = "Script", NodeType[NodeType.ClassDeclaration = 94] = "ClassDeclaration", NodeType[NodeType.InterfaceDeclaration = 95] = "InterfaceDeclaration", NodeType[NodeType.ModuleDeclaration = 96] = "ModuleDeclaration", NodeType[NodeType.ImportDeclaration = 97] = "ImportDeclaration", NodeType[NodeType.With = 98] = "With", NodeType[NodeType.Label = 99] = "Label", NodeType[NodeType.LabeledStatement = 100] = "LabeledStatement", NodeType[NodeType.EBStart = 101] = "EBStart", NodeType[NodeType.GotoEB = 102] = "GotoEB", NodeType[NodeType.EndCode = 103] = "EndCode", NodeType[NodeType.Error = 104] = "Error", NodeType[NodeType.Comment = 105] = "Comment", NodeType[NodeType.Debugger = 106] = "Debugger", NodeType[NodeType.GeneralNode = 71] = "GeneralNode", NodeType[NodeType.LastAsg = 41] = "LastAsg";
|
||||
}(TypeScript || (TypeScript = {}));
|
||||
|
@ -1,5 +1,5 @@
|
||||
var TypeScript;
|
||||
!function(TypeScript1) {
|
||||
var NodeType, NodeType;
|
||||
(NodeType = NodeType = TypeScript1.NodeType || (TypeScript1.NodeType = {}))[NodeType.None = 0] = "None", NodeType[NodeType.Empty = 1] = "Empty", NodeType[NodeType.EmptyExpr = 2] = "EmptyExpr", NodeType[NodeType.True = 3] = "True", NodeType[NodeType.False = 4] = "False", NodeType[NodeType.This = 5] = "This", NodeType[NodeType.Super = 6] = "Super", NodeType[NodeType.QString = 7] = "QString", NodeType[NodeType.Regex = 8] = "Regex", NodeType[NodeType.Null = 9] = "Null", NodeType[NodeType.ArrayLit = 10] = "ArrayLit", NodeType[NodeType.ObjectLit = 11] = "ObjectLit", NodeType[NodeType.Void = 12] = "Void", NodeType[NodeType.Comma = 13] = "Comma", NodeType[NodeType.Pos = 14] = "Pos", NodeType[NodeType.Neg = 15] = "Neg", NodeType[NodeType.Delete = 16] = "Delete", NodeType[NodeType.Await = 17] = "Await", NodeType[NodeType.In = 18] = "In", NodeType[NodeType.Dot = 19] = "Dot", NodeType[NodeType.From = 20] = "From", NodeType[NodeType.Is = 21] = "Is", NodeType[NodeType.InstOf = 22] = "InstOf", NodeType[NodeType.Typeof = 23] = "Typeof", NodeType[NodeType.NumberLit = 24] = "NumberLit", NodeType[NodeType.Name = 25] = "Name", NodeType[NodeType.TypeRef = 26] = "TypeRef", NodeType[NodeType.Index = 27] = "Index", NodeType[NodeType.Call = 28] = "Call", NodeType[NodeType.New = 29] = "New", NodeType[NodeType.Asg = 30] = "Asg", NodeType[NodeType.AsgAdd = 31] = "AsgAdd", NodeType[NodeType.AsgSub = 32] = "AsgSub", NodeType[NodeType.AsgDiv = 33] = "AsgDiv", NodeType[NodeType.AsgMul = 34] = "AsgMul", NodeType[NodeType.AsgMod = 35] = "AsgMod", NodeType[NodeType.AsgAnd = 36] = "AsgAnd", NodeType[NodeType.AsgXor = 37] = "AsgXor", NodeType[NodeType.AsgOr = 38] = "AsgOr", NodeType[NodeType.AsgLsh = 39] = "AsgLsh", NodeType[NodeType.AsgRsh = 40] = "AsgRsh", NodeType[NodeType.AsgRs2 = 41] = "AsgRs2", NodeType[NodeType.ConditionalExpression = 42] = "ConditionalExpression", NodeType[NodeType.LogOr = 43] = "LogOr", NodeType[NodeType.LogAnd = 44] = "LogAnd", NodeType[NodeType.Or = 45] = "Or", NodeType[NodeType.Xor = 46] = "Xor", NodeType[NodeType.And = 47] = "And", NodeType[NodeType.Eq = 48] = "Eq", NodeType[NodeType.Ne = 49] = "Ne", NodeType[NodeType.Eqv = 50] = "Eqv", NodeType[NodeType.NEqv = 51] = "NEqv", NodeType[NodeType.Lt = 52] = "Lt", NodeType[NodeType.Le = 53] = "Le", NodeType[NodeType.Gt = 54] = "Gt", NodeType[NodeType.Ge = 55] = "Ge", NodeType[NodeType.Add = 56] = "Add", NodeType[NodeType.Sub = 57] = "Sub", NodeType[NodeType.Mul = 58] = "Mul", NodeType[NodeType.Div = 59] = "Div", NodeType[NodeType.Mod = 60] = "Mod", NodeType[NodeType.Lsh = 61] = "Lsh", NodeType[NodeType.Rsh = 62] = "Rsh", NodeType[NodeType.Rs2 = 63] = "Rs2", NodeType[NodeType.Not = 64] = "Not", NodeType[NodeType.LogNot = 65] = "LogNot", NodeType[NodeType.IncPre = 66] = "IncPre", NodeType[NodeType.DecPre = 67] = "DecPre", NodeType[NodeType.IncPost = 68] = "IncPost", NodeType[NodeType.DecPost = 69] = "DecPost", NodeType[NodeType.TypeAssertion = 70] = "TypeAssertion", NodeType[NodeType.FuncDecl = 71] = "FuncDecl", NodeType[NodeType.Member = 72] = "Member", NodeType[NodeType.VarDecl = 73] = "VarDecl", NodeType[NodeType.ArgDecl = 74] = "ArgDecl", NodeType[NodeType.Return = 75] = "Return", NodeType[NodeType.Break = 76] = "Break", NodeType[NodeType.Continue = 77] = "Continue", NodeType[NodeType.Throw = 78] = "Throw", NodeType[NodeType.For = 79] = "For", NodeType[NodeType.ForIn = 80] = "ForIn", NodeType[NodeType.If = 81] = "If", NodeType[NodeType.While = 82] = "While", NodeType[NodeType.DoWhile = 83] = "DoWhile", NodeType[NodeType.Block = 84] = "Block", NodeType[NodeType.Case = 85] = "Case", NodeType[NodeType.Switch = 86] = "Switch", NodeType[NodeType.Try = 87] = "Try", NodeType[NodeType.TryCatch = 88] = "TryCatch", NodeType[NodeType.TryFinally = 89] = "TryFinally", NodeType[NodeType.Finally = 90] = "Finally", NodeType[NodeType.Catch = 91] = "Catch", NodeType[NodeType.List = 92] = "List", NodeType[NodeType.Script = 93] = "Script", NodeType[NodeType.ClassDeclaration = 94] = "ClassDeclaration", NodeType[NodeType.InterfaceDeclaration = 95] = "InterfaceDeclaration", NodeType[NodeType.ModuleDeclaration = 96] = "ModuleDeclaration", NodeType[NodeType.ImportDeclaration = 97] = "ImportDeclaration", NodeType[NodeType.With = 98] = "With", NodeType[NodeType.Label = 99] = "Label", NodeType[NodeType.LabeledStatement = 100] = "LabeledStatement", NodeType[NodeType.EBStart = 101] = "EBStart", NodeType[NodeType.GotoEB = 102] = "GotoEB", NodeType[NodeType.EndCode = 103] = "EndCode", NodeType[NodeType.Error = 104] = "Error", NodeType[NodeType.Comment = 105] = "Comment", NodeType[NodeType.Debugger = 106] = "Debugger", NodeType[NodeType.GeneralNode = 71] = "GeneralNode", NodeType[NodeType.LastAsg = 41] = "LastAsg";
|
||||
var NodeType;
|
||||
(NodeType = TypeScript1.NodeType || (TypeScript1.NodeType = {}))[NodeType.None = 0] = "None", NodeType[NodeType.Empty = 1] = "Empty", NodeType[NodeType.EmptyExpr = 2] = "EmptyExpr", NodeType[NodeType.True = 3] = "True", NodeType[NodeType.False = 4] = "False", NodeType[NodeType.This = 5] = "This", NodeType[NodeType.Super = 6] = "Super", NodeType[NodeType.QString = 7] = "QString", NodeType[NodeType.Regex = 8] = "Regex", NodeType[NodeType.Null = 9] = "Null", NodeType[NodeType.ArrayLit = 10] = "ArrayLit", NodeType[NodeType.ObjectLit = 11] = "ObjectLit", NodeType[NodeType.Void = 12] = "Void", NodeType[NodeType.Comma = 13] = "Comma", NodeType[NodeType.Pos = 14] = "Pos", NodeType[NodeType.Neg = 15] = "Neg", NodeType[NodeType.Delete = 16] = "Delete", NodeType[NodeType.Await = 17] = "Await", NodeType[NodeType.In = 18] = "In", NodeType[NodeType.Dot = 19] = "Dot", NodeType[NodeType.From = 20] = "From", NodeType[NodeType.Is = 21] = "Is", NodeType[NodeType.InstOf = 22] = "InstOf", NodeType[NodeType.Typeof = 23] = "Typeof", NodeType[NodeType.NumberLit = 24] = "NumberLit", NodeType[NodeType.Name = 25] = "Name", NodeType[NodeType.TypeRef = 26] = "TypeRef", NodeType[NodeType.Index = 27] = "Index", NodeType[NodeType.Call = 28] = "Call", NodeType[NodeType.New = 29] = "New", NodeType[NodeType.Asg = 30] = "Asg", NodeType[NodeType.AsgAdd = 31] = "AsgAdd", NodeType[NodeType.AsgSub = 32] = "AsgSub", NodeType[NodeType.AsgDiv = 33] = "AsgDiv", NodeType[NodeType.AsgMul = 34] = "AsgMul", NodeType[NodeType.AsgMod = 35] = "AsgMod", NodeType[NodeType.AsgAnd = 36] = "AsgAnd", NodeType[NodeType.AsgXor = 37] = "AsgXor", NodeType[NodeType.AsgOr = 38] = "AsgOr", NodeType[NodeType.AsgLsh = 39] = "AsgLsh", NodeType[NodeType.AsgRsh = 40] = "AsgRsh", NodeType[NodeType.AsgRs2 = 41] = "AsgRs2", NodeType[NodeType.ConditionalExpression = 42] = "ConditionalExpression", NodeType[NodeType.LogOr = 43] = "LogOr", NodeType[NodeType.LogAnd = 44] = "LogAnd", NodeType[NodeType.Or = 45] = "Or", NodeType[NodeType.Xor = 46] = "Xor", NodeType[NodeType.And = 47] = "And", NodeType[NodeType.Eq = 48] = "Eq", NodeType[NodeType.Ne = 49] = "Ne", NodeType[NodeType.Eqv = 50] = "Eqv", NodeType[NodeType.NEqv = 51] = "NEqv", NodeType[NodeType.Lt = 52] = "Lt", NodeType[NodeType.Le = 53] = "Le", NodeType[NodeType.Gt = 54] = "Gt", NodeType[NodeType.Ge = 55] = "Ge", NodeType[NodeType.Add = 56] = "Add", NodeType[NodeType.Sub = 57] = "Sub", NodeType[NodeType.Mul = 58] = "Mul", NodeType[NodeType.Div = 59] = "Div", NodeType[NodeType.Mod = 60] = "Mod", NodeType[NodeType.Lsh = 61] = "Lsh", NodeType[NodeType.Rsh = 62] = "Rsh", NodeType[NodeType.Rs2 = 63] = "Rs2", NodeType[NodeType.Not = 64] = "Not", NodeType[NodeType.LogNot = 65] = "LogNot", NodeType[NodeType.IncPre = 66] = "IncPre", NodeType[NodeType.DecPre = 67] = "DecPre", NodeType[NodeType.IncPost = 68] = "IncPost", NodeType[NodeType.DecPost = 69] = "DecPost", NodeType[NodeType.TypeAssertion = 70] = "TypeAssertion", NodeType[NodeType.FuncDecl = 71] = "FuncDecl", NodeType[NodeType.Member = 72] = "Member", NodeType[NodeType.VarDecl = 73] = "VarDecl", NodeType[NodeType.ArgDecl = 74] = "ArgDecl", NodeType[NodeType.Return = 75] = "Return", NodeType[NodeType.Break = 76] = "Break", NodeType[NodeType.Continue = 77] = "Continue", NodeType[NodeType.Throw = 78] = "Throw", NodeType[NodeType.For = 79] = "For", NodeType[NodeType.ForIn = 80] = "ForIn", NodeType[NodeType.If = 81] = "If", NodeType[NodeType.While = 82] = "While", NodeType[NodeType.DoWhile = 83] = "DoWhile", NodeType[NodeType.Block = 84] = "Block", NodeType[NodeType.Case = 85] = "Case", NodeType[NodeType.Switch = 86] = "Switch", NodeType[NodeType.Try = 87] = "Try", NodeType[NodeType.TryCatch = 88] = "TryCatch", NodeType[NodeType.TryFinally = 89] = "TryFinally", NodeType[NodeType.Finally = 90] = "Finally", NodeType[NodeType.Catch = 91] = "Catch", NodeType[NodeType.List = 92] = "List", NodeType[NodeType.Script = 93] = "Script", NodeType[NodeType.ClassDeclaration = 94] = "ClassDeclaration", NodeType[NodeType.InterfaceDeclaration = 95] = "InterfaceDeclaration", NodeType[NodeType.ModuleDeclaration = 96] = "ModuleDeclaration", NodeType[NodeType.ImportDeclaration = 97] = "ImportDeclaration", NodeType[NodeType.With = 98] = "With", NodeType[NodeType.Label = 99] = "Label", NodeType[NodeType.LabeledStatement = 100] = "LabeledStatement", NodeType[NodeType.EBStart = 101] = "EBStart", NodeType[NodeType.GotoEB = 102] = "GotoEB", NodeType[NodeType.EndCode = 103] = "EndCode", NodeType[NodeType.Error = 104] = "Error", NodeType[NodeType.Comment = 105] = "Comment", NodeType[NodeType.Debugger = 106] = "Debugger", NodeType[NodeType.GeneralNode = 71] = "GeneralNode", NodeType[NodeType.LastAsg = 41] = "LastAsg";
|
||||
}(TypeScript || (TypeScript = {}));
|
||||
|
@ -487,6 +487,15 @@ where
|
||||
n.visit_children_with(self);
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "debug", tracing::instrument(skip(self, n)))]
|
||||
fn visit_class_expr(&mut self, n: &ClassExpr) {
|
||||
n.visit_children_with(self);
|
||||
|
||||
if let Some(id) = &n.ident {
|
||||
self.declare_decl(id, true, None, false);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "debug", tracing::instrument(skip(self, n)))]
|
||||
fn visit_cond_expr(&mut self, n: &CondExpr) {
|
||||
n.test.visit_with(self);
|
||||
|
@ -5,13 +5,14 @@ use swc_atoms::js_word;
|
||||
use swc_common::{pass::Either, util::take::Take, Mark, Spanned, SyntaxContext, DUMMY_SP};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_utils::{
|
||||
contains_arguments, contains_this_expr, ident::IdentLike, undefined, ExprFactory, Id,
|
||||
contains_arguments, contains_this_expr, find_ids, ident::IdentLike, undefined, ExprFactory, Id,
|
||||
};
|
||||
use swc_ecma_visit::VisitMutWith;
|
||||
|
||||
use super::{util::MultiReplacer, Optimizer};
|
||||
use crate::{
|
||||
compress::optimize::Ctx,
|
||||
compress::optimize::{util::Remapper, Ctx},
|
||||
debug::dump,
|
||||
mode::Mode,
|
||||
util::{idents_captured_by, idents_used_by, make_number},
|
||||
};
|
||||
@ -250,18 +251,17 @@ where
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "debug", tracing::instrument(skip_all))]
|
||||
pub(super) fn inline_vars_in_node<N>(&mut self, n: &mut N, vars: FxHashMap<Id, Box<Expr>>)
|
||||
pub(super) fn inline_vars_in_node<N>(&mut self, n: &mut N, mut vars: FxHashMap<Id, Box<Expr>>)
|
||||
where
|
||||
N: VisitMutWith<MultiReplacer>,
|
||||
N: for<'aa> VisitMutWith<MultiReplacer<'aa>>,
|
||||
{
|
||||
if cfg!(feature = "debug") {
|
||||
tracing::trace!("inline: inline_vars_in_node");
|
||||
}
|
||||
|
||||
n.visit_mut_with(&mut MultiReplacer {
|
||||
vars,
|
||||
vars: &mut vars,
|
||||
changed: false,
|
||||
clone: false,
|
||||
});
|
||||
}
|
||||
|
||||
@ -384,8 +384,7 @@ where
|
||||
let new_ctxt = SyntaxContext::empty().apply_mark(Mark::fresh(Mark::root()));
|
||||
|
||||
for p in param_ids.iter() {
|
||||
let new = Ident::new(p.sym.clone(), p.span.with_ctxt(new_ctxt));
|
||||
remap.insert(p.to_id(), Box::new(Expr::Ident(new)));
|
||||
remap.insert(p.to_id(), new_ctxt);
|
||||
}
|
||||
|
||||
{
|
||||
@ -437,10 +436,10 @@ where
|
||||
}
|
||||
}
|
||||
body.visit_mut_with(&mut MultiReplacer {
|
||||
vars: remap,
|
||||
vars: &mut self.vars_for_inlining,
|
||||
changed: false,
|
||||
clone: true,
|
||||
});
|
||||
body.visit_mut_with(&mut Remapper { vars: remap });
|
||||
exprs.push(body.take());
|
||||
|
||||
tracing::debug!("inline: Inlining a call to an arrow function");
|
||||
@ -527,6 +526,10 @@ where
|
||||
self.changed = true;
|
||||
tracing::debug!("inline: Inlining a function call");
|
||||
|
||||
if cfg!(feature = "debug") {
|
||||
tracing::debug!("[Change]: {}", dump(&new, false));
|
||||
}
|
||||
|
||||
*e = new;
|
||||
}
|
||||
|
||||
@ -536,6 +539,10 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn has_pending_inline_for(&self, id: &Id) -> bool {
|
||||
self.lits.contains_key(id) || self.vars_for_inlining.contains_key(id)
|
||||
}
|
||||
|
||||
fn can_inline_fn_like(&self, param_ids: &[Ident], body: &BlockStmt) -> bool {
|
||||
// Don't create top-level variables.
|
||||
if !param_ids.is_empty() && self.ctx.in_top_level() {
|
||||
@ -566,7 +573,7 @@ where
|
||||
decls,
|
||||
..
|
||||
})) => {
|
||||
if decls.iter().any(|decl| match decl.name {
|
||||
if decls.iter().any(|decl| match &decl.name {
|
||||
Pat::Ident(BindingIdent {
|
||||
id:
|
||||
Ident {
|
||||
@ -575,7 +582,14 @@ where
|
||||
},
|
||||
..
|
||||
}) => true,
|
||||
Pat::Ident(..) => false,
|
||||
Pat::Ident(id) => {
|
||||
if self.has_pending_inline_for(&id.to_id()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
_ => true,
|
||||
}) {
|
||||
return false;
|
||||
@ -637,6 +651,45 @@ where
|
||||
|
||||
let mut exprs = vec![];
|
||||
|
||||
// We remap variables.
|
||||
let mut remap = HashMap::default();
|
||||
let new_ctxt = SyntaxContext::empty().apply_mark(Mark::fresh(Mark::root()));
|
||||
|
||||
let params = params
|
||||
.iter()
|
||||
.map(|i| {
|
||||
// As the result of this function comes from `params` and `body`, we only need
|
||||
// to remap those.
|
||||
|
||||
let new = Ident::new(i.sym.clone(), i.span.with_ctxt(new_ctxt));
|
||||
remap.insert(i.to_id(), new_ctxt);
|
||||
new
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
{
|
||||
for stmt in &body.stmts {
|
||||
if let Stmt::Decl(Decl::Var(var)) = stmt {
|
||||
for decl in &var.decls {
|
||||
let ids: Vec<Id> = find_ids(&decl.name);
|
||||
|
||||
remap.extend(ids.into_iter().map(|id| {
|
||||
(
|
||||
id,
|
||||
SyntaxContext::empty().apply_mark(Mark::fresh(Mark::root())),
|
||||
)
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
body.visit_mut_with(&mut MultiReplacer {
|
||||
vars: &mut self.vars_for_inlining,
|
||||
changed: false,
|
||||
});
|
||||
body.visit_mut_with(&mut Remapper { vars: remap });
|
||||
|
||||
{
|
||||
let vars = params
|
||||
.iter()
|
||||
|
@ -2202,9 +2202,8 @@ where
|
||||
self.with_ctx(ctx).handle_stmt_likes(stmts);
|
||||
|
||||
stmts.visit_mut_with(&mut MultiReplacer {
|
||||
vars: take(&mut self.vars_for_inlining),
|
||||
vars: &mut self.vars_for_inlining,
|
||||
changed: false,
|
||||
clone: false,
|
||||
});
|
||||
|
||||
drop_invalid_stmts(stmts);
|
||||
|
@ -705,7 +705,7 @@ where
|
||||
.vars
|
||||
.get(&i.to_id())
|
||||
.map(|v| (v.ref_count == 0 && v.usage_count == 0) || v.var_kind.is_some())
|
||||
.unwrap_or(true);
|
||||
.unwrap_or(false);
|
||||
|
||||
if can_remove_ident {
|
||||
self.changed = true;
|
||||
|
@ -2,7 +2,7 @@ use std::ops::{Deref, DerefMut};
|
||||
|
||||
use rustc_hash::FxHashMap;
|
||||
use swc_atoms::JsWord;
|
||||
use swc_common::Span;
|
||||
use swc_common::{Span, SyntaxContext};
|
||||
use swc_ecma_ast::*;
|
||||
use swc_ecma_utils::{ident::IdentLike, prop_name_eq, ExprExt, Id};
|
||||
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};
|
||||
@ -168,23 +168,36 @@ pub(crate) fn is_valid_for_lhs(e: &Expr) -> bool {
|
||||
!matches!(e, Expr::Lit(..) | Expr::Unary(..))
|
||||
}
|
||||
|
||||
pub(crate) struct MultiReplacer {
|
||||
pub vars: FxHashMap<Id, Box<Expr>>,
|
||||
pub changed: bool,
|
||||
pub clone: bool,
|
||||
/// Variable remapper
|
||||
///
|
||||
/// - Used for evaluating IIFEs
|
||||
|
||||
pub(crate) struct Remapper {
|
||||
pub vars: FxHashMap<Id, SyntaxContext>,
|
||||
}
|
||||
|
||||
impl MultiReplacer {
|
||||
fn var(&mut self, i: &Id) -> Option<Box<Expr>> {
|
||||
if self.clone {
|
||||
self.vars.get(i).cloned()
|
||||
} else {
|
||||
self.vars.remove(i)
|
||||
impl VisitMut for Remapper {
|
||||
noop_visit_mut_type!();
|
||||
|
||||
fn visit_mut_ident(&mut self, i: &mut Ident) {
|
||||
if let Some(new_ctxt) = self.vars.get(&i.to_id()).copied() {
|
||||
i.span.ctxt = new_ctxt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl VisitMut for MultiReplacer {
|
||||
pub(crate) struct MultiReplacer<'a> {
|
||||
pub vars: &'a mut FxHashMap<Id, Box<Expr>>,
|
||||
pub changed: bool,
|
||||
}
|
||||
|
||||
impl MultiReplacer<'_> {
|
||||
fn var(&mut self, i: &Id) -> Option<Box<Expr>> {
|
||||
self.vars.remove(i)
|
||||
}
|
||||
}
|
||||
|
||||
impl VisitMut for MultiReplacer<'_> {
|
||||
noop_visit_mut_type!();
|
||||
|
||||
fn visit_mut_expr(&mut self, e: &mut Expr) {
|
||||
|
@ -47,8 +47,8 @@ TestSnapshot {
|
||||
inline_prevented: false,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
@ -62,7 +62,7 @@ TestSnapshot {
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: true,
|
||||
is_fn_local: true,
|
||||
is_fn_local: false,
|
||||
used_by_nested_fn: true,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
|
@ -116,6 +116,44 @@ TestSnapshot {
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('dummy' type=inline),
|
||||
#3,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 0,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: true,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('global' type=static),
|
||||
|
@ -76,6 +76,44 @@ TestSnapshot {
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('c' type=inline),
|
||||
#2,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 0,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('f' type=inline),
|
||||
|
@ -76,6 +76,44 @@ TestSnapshot {
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('c' type=inline),
|
||||
#2,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 0,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('f' type=inline),
|
||||
|
@ -76,6 +76,44 @@ TestSnapshot {
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('c' type=inline),
|
||||
#2,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 0,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('f' type=inline),
|
||||
|
@ -76,6 +76,44 @@ TestSnapshot {
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('c' type=inline),
|
||||
#2,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 0,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('f' type=inline),
|
||||
|
@ -76,6 +76,44 @@ TestSnapshot {
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('c' type=inline),
|
||||
#2,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 0,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('f' type=inline),
|
||||
|
@ -123,8 +123,8 @@ TestSnapshot {
|
||||
inline_prevented: true,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
@ -138,12 +138,12 @@ TestSnapshot {
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
|
@ -123,8 +123,8 @@ TestSnapshot {
|
||||
inline_prevented: true,
|
||||
ref_count: 1,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
@ -138,12 +138,12 @@ TestSnapshot {
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
|
@ -9,8 +9,8 @@ TestSnapshot {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
@ -24,12 +24,12 @@ TestSnapshot {
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
@ -76,6 +76,44 @@ TestSnapshot {
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('NamedClassExpr' type=dynamic),
|
||||
#2,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 0,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('expr' type=inline),
|
||||
|
@ -9,8 +9,8 @@ TestSnapshot {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
@ -24,12 +24,12 @@ TestSnapshot {
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
@ -76,6 +76,44 @@ TestSnapshot {
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('NamedClassExpr' type=dynamic),
|
||||
#2,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 0,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('expr' type=inline),
|
||||
|
@ -9,8 +9,8 @@ TestSnapshot {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
@ -24,12 +24,12 @@ TestSnapshot {
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
@ -76,6 +76,44 @@ TestSnapshot {
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('NamedClassExpr' type=dynamic),
|
||||
#2,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 0,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('expr' type=inline),
|
||||
|
@ -38,6 +38,44 @@ TestSnapshot {
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('base' type=inline),
|
||||
#2,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 0,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('named' type=inline),
|
||||
|
@ -9,8 +9,8 @@ TestSnapshot {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
@ -24,12 +24,12 @@ TestSnapshot {
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: true,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
|
@ -1,5 +1,43 @@
|
||||
TestSnapshot {
|
||||
vars: [
|
||||
(
|
||||
(
|
||||
Atom('Baz' type=inline),
|
||||
#3,
|
||||
),
|
||||
VarUsageInfo {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
mutation_by_call_count: 0,
|
||||
usage_count: 0,
|
||||
reassigned_with_assignment: false,
|
||||
reassigned_with_var_decl: false,
|
||||
mutated: false,
|
||||
has_property_access: false,
|
||||
has_property_mutation: false,
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: true,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
used_as_arg: false,
|
||||
pure_fn: false,
|
||||
infects: [],
|
||||
},
|
||||
),
|
||||
(
|
||||
(
|
||||
Atom('Foo' type=inline),
|
||||
|
@ -87,8 +87,8 @@ TestSnapshot {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
@ -102,12 +102,12 @@ TestSnapshot {
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: true,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
@ -203,8 +203,8 @@ TestSnapshot {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
@ -218,12 +218,12 @@ TestSnapshot {
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: true,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
|
@ -9,8 +9,8 @@ TestSnapshot {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
@ -24,12 +24,12 @@ TestSnapshot {
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
|
@ -47,8 +47,8 @@ TestSnapshot {
|
||||
inline_prevented: true,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
@ -62,12 +62,12 @@ TestSnapshot {
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
|
@ -9,8 +9,8 @@ TestSnapshot {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
@ -24,12 +24,12 @@ TestSnapshot {
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
|
@ -9,8 +9,8 @@ TestSnapshot {
|
||||
inline_prevented: false,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
@ -24,12 +24,12 @@ TestSnapshot {
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
|
@ -9,8 +9,8 @@ TestSnapshot {
|
||||
inline_prevented: true,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
@ -24,12 +24,12 @@ TestSnapshot {
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
|
@ -9,8 +9,8 @@ TestSnapshot {
|
||||
inline_prevented: true,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
@ -24,12 +24,12 @@ TestSnapshot {
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
|
@ -9,8 +9,8 @@ TestSnapshot {
|
||||
inline_prevented: true,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
@ -24,12 +24,12 @@ TestSnapshot {
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
|
@ -9,8 +9,8 @@ TestSnapshot {
|
||||
inline_prevented: true,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
@ -24,12 +24,12 @@ TestSnapshot {
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
|
@ -85,8 +85,8 @@ TestSnapshot {
|
||||
inline_prevented: true,
|
||||
ref_count: 0,
|
||||
cond_init: false,
|
||||
declared: false,
|
||||
declared_count: 0,
|
||||
declared: true,
|
||||
declared_count: 1,
|
||||
declared_as_fn_param: false,
|
||||
declared_as_fn_expr: false,
|
||||
assign_count: 0,
|
||||
@ -100,12 +100,12 @@ TestSnapshot {
|
||||
accessed_props: {},
|
||||
exported: false,
|
||||
used_above_decl: false,
|
||||
is_fn_local: false,
|
||||
is_fn_local: true,
|
||||
used_by_nested_fn: false,
|
||||
executed_multiple_time: false,
|
||||
used_in_cond: false,
|
||||
var_kind: None,
|
||||
var_initialized: false,
|
||||
var_initialized: true,
|
||||
declared_as_catch_param: false,
|
||||
no_side_effect_for_member_access: false,
|
||||
used_as_callee: false,
|
||||
|
Loading…
Reference in New Issue
Block a user