Skip to content

Commit d792b37

Browse files
committed
feat(optimizer): add parameterNames to function segments metadata
1 parent e49bf90 commit d792b37

File tree

41 files changed

+240
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+240
-0
lines changed

packages/qwik/src/optimizer/core/src/parse.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ pub struct SegmentAnalysis {
5151
pub ctx_name: JsWord,
5252
pub captures: bool,
5353
pub loc: (u32, u32),
54+
#[serde(skip_serializing_if = "Option::is_none")]
55+
pub param_names: Option<Vec<JsWord>>,
5456
}
5557

5658
#[derive(Debug, Serialize, Deserialize, Copy, Clone, PartialEq, Eq)]
@@ -461,6 +463,7 @@ pub fn transform_code(config: TransformCodeOptions) -> Result<TransformOutput, a
461463
display_name: h.data.display_name,
462464
hash: h.data.hash,
463465
loc: (h.span.lo.0, h.span.hi.0),
466+
param_names: h.param_names,
464467
}),
465468
});
466469
}

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__destructure_args_colon_props.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"ma
5353
"loc": [
5454
77,
5555
188
56+
],
57+
"paramNames": [
58+
"props"
5659
]
5760
}
5861
*/

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__destructure_args_colon_props2.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"ma
5656
"loc": [
5757
88,
5858
238
59+
],
60+
"paramNames": [
61+
"props"
5962
]
6063
}
6164
*/

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__destructure_args_colon_props3.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"ma
6262
"loc": [
6363
88,
6464
237
65+
],
66+
"paramNames": [
67+
"props"
6568
]
6669
}
6770
*/

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_1.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"ma
109109
"loc": [
110110
126,
111111
151
112+
],
113+
"paramNames": [
114+
"ctx"
112115
]
113116
}
114117
*/

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_10.snap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ Some("{\"version\":3,\"sources\":[\"/user/qwik/src/project/test.tsx\"],\"names\"
6969
"loc": [
7070
67,
7171
393
72+
],
73+
"paramNames": [
74+
"decl1",
75+
"{decl2}",
76+
"[decl3]"
7277
]
7378
}
7479
*/

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_11.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ Some("{\"version\":3,\"sources\":[\"/user/qwik/src/project/test.tsx\"],\"names\"
5050
"loc": [
5151
231,
5252
247
53+
],
54+
"paramNames": [
55+
"ev"
5356
]
5457
}
5558
*/

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_2.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"ma
7676
"loc": [
7777
142,
7878
167
79+
],
80+
"paramNames": [
81+
"ctx"
7982
]
8083
}
8184
*/

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_3.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"ma
7171
"loc": [
7272
166,
7373
191
74+
],
75+
"paramNames": [
76+
"ctx"
7477
]
7578
}
7679
*/

packages/qwik/src/optimizer/core/src/snapshots/qwik_core__test__example_4.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"ma
7171
"loc": [
7272
163,
7373
188
74+
],
75+
"paramNames": [
76+
"ctx"
7477
]
7578
}
7679
*/

0 commit comments

Comments
 (0)