mirror of
https://github.com/swc-project/swc.git
synced 2024-11-26 20:36:17 +03:00
perf(es/lints): Avoid needless allocations in no-dupe-args
(#9041)
**Description:** I introduced a zero-allocation variant for `swc_ecma_utils::DestructuringFinder` that does not allocate anything.
This commit is contained in:
parent
931f752d54
commit
e5601989a1
@ -0,0 +1,10 @@
|
|||||||
|
function foo(
|
||||||
|
[a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
[c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
[e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
[g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
[a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
[i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
[a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,680 @@
|
|||||||
|
|
||||||
|
x the name `a0` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a1` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a2` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a3` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a4` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a5` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a6` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a7` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a8` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a9` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b0` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b1` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b2` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b3` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b4` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b5` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b6` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b7` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b8` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b9` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a0` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a1` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a2` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a3` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a4` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a5` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a6` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a7` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a8` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `a9` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b0` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b1` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b2` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b3` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b4` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b5` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b6` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b7` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b8` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
||||||
|
|
||||||
|
x the name `b9` is bound more than once in this parameter list
|
||||||
|
,-[1:1]
|
||||||
|
1 | function foo(
|
||||||
|
2 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
: ^|
|
||||||
|
: `-- previous definition here
|
||||||
|
3 | [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9], [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9],
|
||||||
|
4 | [e0, e1, e2, e3, e4, e5, e6, e7, e8, e9], [f0, f1, f2, f3, f4, f5, f6, f7, f8, f9],
|
||||||
|
5 | [g0, g1, g2, g3, g4, g5, g6, g7, g8, g9], [h0, h1, h2, h3, h4, h5, h6, h7, h8, h9],
|
||||||
|
6 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],
|
||||||
|
7 | [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9], [j0, j1, j2, j3, j4, j5, j6, j7, j8, j9],
|
||||||
|
8 | [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9], [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9],) {
|
||||||
|
: ^|
|
||||||
|
: `-- used as parameter more than once
|
||||||
|
9 |
|
||||||
|
10 | }
|
||||||
|
`----
|
@ -1,7 +1,8 @@
|
|||||||
use swc_atoms::JsWord;
|
use std::collections::hash_map::Entry;
|
||||||
use swc_common::{collections::AHashMap, errors::HANDLER, Span};
|
|
||||||
|
use swc_common::{collections::AHashMap, errors::HANDLER};
|
||||||
use swc_ecma_ast::*;
|
use swc_ecma_ast::*;
|
||||||
use swc_ecma_utils::find_pat_ids;
|
use swc_ecma_utils::for_each_binding_ident;
|
||||||
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
|
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
|
||||||
|
|
||||||
use crate::rule::{visitor_rule, Rule};
|
use crate::rule::{visitor_rule, Rule};
|
||||||
@ -13,54 +14,100 @@ pub fn no_dupe_args() -> Box<dyn Rule> {
|
|||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
struct NoDupeArgs {}
|
struct NoDupeArgs {}
|
||||||
|
|
||||||
impl NoDupeArgs {
|
fn error(first: &Ident, second: &Ident) {
|
||||||
fn check(&self, param_list: Vec<(JsWord, Span)>) {
|
HANDLER.with(|handler| {
|
||||||
let mut variables_map = AHashMap::<JsWord, Span>::default();
|
handler
|
||||||
|
.struct_span_err(
|
||||||
|
second.span,
|
||||||
|
&format!(
|
||||||
|
"the name `{}` is bound more than once in this parameter list",
|
||||||
|
first.sym
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.span_label(first.span, "previous definition here".to_string())
|
||||||
|
.span_label(second.span, &"used as parameter more than once".to_string())
|
||||||
|
.emit();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
param_list.into_iter().for_each(|(js_word, span)| {
|
/// This has time complexity of O(n^2), but it's fine as the number of paramters
|
||||||
if let Some(old_span) = variables_map.insert(js_word.clone(), span) {
|
/// is usually small.
|
||||||
HANDLER.with(|handler| {
|
macro_rules! check {
|
||||||
handler
|
($node:expr) => {{
|
||||||
.struct_span_err(
|
// This vector allocates only if there are duplicate parameters.
|
||||||
span,
|
// This is used to handle the case where the same parameter is used 3 or more
|
||||||
&format!(
|
// times.
|
||||||
"the name `{}` is bound more than once in this parameter list",
|
let mut done = vec![];
|
||||||
js_word
|
|
||||||
),
|
let mut hash_mode = false;
|
||||||
)
|
|
||||||
.span_label(old_span, "previous definition here".to_string())
|
let mut i1 = 0;
|
||||||
.span_label(span, &"used as parameter more than once".to_string())
|
for_each_binding_ident($node, |id1| {
|
||||||
.emit();
|
i1 += 1;
|
||||||
|
|
||||||
|
if !hash_mode {
|
||||||
|
let mut i2 = 0;
|
||||||
|
for_each_binding_ident($node, |id2| {
|
||||||
|
i2 += 1;
|
||||||
|
|
||||||
|
if hash_mode {
|
||||||
|
return;
|
||||||
|
} else if i2 >= 100 {
|
||||||
|
// While iterating for the first `id1`, we detect that there are more than
|
||||||
|
// 100 identifiers. We switch to hash mode.
|
||||||
|
hash_mode = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if i1 >= i2 || done.contains(&i1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if id1.span.ctxt == id2.span.ctxt && id1.sym == id2.sym {
|
||||||
|
done.push(i1);
|
||||||
|
|
||||||
|
error(id1, id2);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
if hash_mode {
|
||||||
|
let mut map = AHashMap::default();
|
||||||
|
|
||||||
|
for_each_binding_ident($node, |id| {
|
||||||
|
//
|
||||||
|
match map.entry((id.sym.clone(), id.span.ctxt)) {
|
||||||
|
Entry::Occupied(v) => {
|
||||||
|
error(v.get(), id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Entry::Vacant(v) => {
|
||||||
|
v.insert(id.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Visit for NoDupeArgs {
|
impl Visit for NoDupeArgs {
|
||||||
noop_visit_type!();
|
noop_visit_type!();
|
||||||
|
|
||||||
fn visit_function(&mut self, f: &Function) {
|
fn visit_function(&mut self, f: &Function) {
|
||||||
let variables: Vec<(JsWord, Span)> = find_pat_ids(&f.params);
|
check!(&f.params);
|
||||||
|
|
||||||
self.check(variables);
|
|
||||||
|
|
||||||
f.visit_children_with(self);
|
f.visit_children_with(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_arrow_expr(&mut self, arrow_fn: &ArrowExpr) {
|
fn visit_arrow_expr(&mut self, f: &ArrowExpr) {
|
||||||
let variables: Vec<(JsWord, Span)> = find_pat_ids(&arrow_fn.params);
|
check!(&f.params);
|
||||||
|
|
||||||
self.check(variables);
|
f.visit_children_with(self);
|
||||||
|
|
||||||
arrow_fn.visit_children_with(self);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_constructor(&mut self, n: &Constructor) {
|
fn visit_constructor(&mut self, f: &Constructor) {
|
||||||
let variables: Vec<(JsWord, Span)> = find_pat_ids(&n.params);
|
check!(&f.params);
|
||||||
|
|
||||||
self.check(variables);
|
f.visit_children_with(self);
|
||||||
|
|
||||||
n.visit_children_with(self);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2373,6 +2373,8 @@ pub struct DestructuringFinder<I: IdentLike> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Finds all **binding** idents of `node`.
|
/// Finds all **binding** idents of `node`.
|
||||||
|
///
|
||||||
|
/// If you want to avoid allocation, use [`for_each_binding_ident`] instead.
|
||||||
pub fn find_pat_ids<T, I: IdentLike>(node: &T) -> Vec<I>
|
pub fn find_pat_ids<T, I: IdentLike>(node: &T) -> Vec<I>
|
||||||
where
|
where
|
||||||
T: VisitWith<DestructuringFinder<I>>,
|
T: VisitWith<DestructuringFinder<I>>,
|
||||||
@ -2397,6 +2399,39 @@ impl<I: IdentLike> Visit for DestructuringFinder<I> {
|
|||||||
fn visit_prop_name(&mut self, _: &PropName) {}
|
fn visit_prop_name(&mut self, _: &PropName) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Finds all **binding** idents of variables.
|
||||||
|
pub struct BindingIdentifierVisitor<F>
|
||||||
|
where
|
||||||
|
F: for<'a> FnMut(&'a Ident),
|
||||||
|
{
|
||||||
|
op: F,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Finds all **binding** idents of `node`. **Any nested identifiers in
|
||||||
|
/// expressions are ignored**.
|
||||||
|
pub fn for_each_binding_ident<T, F>(node: &T, op: F)
|
||||||
|
where
|
||||||
|
T: VisitWith<BindingIdentifierVisitor<F>>,
|
||||||
|
F: for<'a> FnMut(&'a Ident),
|
||||||
|
{
|
||||||
|
let mut v = BindingIdentifierVisitor { op };
|
||||||
|
node.visit_with(&mut v);
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<F> Visit for BindingIdentifierVisitor<F>
|
||||||
|
where
|
||||||
|
F: for<'a> FnMut(&'a Ident),
|
||||||
|
{
|
||||||
|
noop_visit_type!();
|
||||||
|
|
||||||
|
/// No-op (we don't care about expressions)
|
||||||
|
fn visit_expr(&mut self, _: &Expr) {}
|
||||||
|
|
||||||
|
fn visit_binding_ident(&mut self, i: &BindingIdent) {
|
||||||
|
(self.op)(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_valid_ident(s: &JsWord) -> bool {
|
pub fn is_valid_ident(s: &JsWord) -> bool {
|
||||||
if s.len() == 0 {
|
if s.len() == 0 {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user