Skip to content

Commit 47c9284

Browse files
committed
refactor: check for var prop after last spread
1 parent 8fa44f3 commit 47c9284

13 files changed

+170
-40
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 1144
3+
assertion_line: 1143
44
expression: output
5+
snapshot_kind: text
56
---
67
==INPUT==
78

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 516
3+
assertion_line: 515
44
expression: output
5+
snapshot_kind: text
56
---
67
==INPUT==
78

@@ -87,9 +88,9 @@ export const Works = /*#__PURE__*/ componentQrl(/*#__PURE__*/ inlinedQrl((_rawPr
8788
_rawProps
8889
], "{some:p0.some??1+2}"),
8990
class: _wrapProp(_rawProps, "count"),
90-
..._getVarProps(rest),
91-
..._getConstProps(rest)
91+
..._getVarProps(rest)
9292
}, {
93+
..._getConstProps(rest),
9394
override: true
9495
}, _wrapProp(_rawProps, "count"), 0, "u6_0");
9596
}, "Works_component_t45qL4vNGv0"));
@@ -121,7 +122,7 @@ export const NoWorks3 = /*#__PURE__*/ componentQrl(/*#__PURE__*/ inlinedQrl(({ c
121122
}, "NoWorks3_component_fc13h5yYn14"));
122123

123124

124-
Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;;;;;;AAGA,OAAO,MAAM,sBAAQ,sCAAW;;;;;;;;IAO/B,QAAQ,GAAG,WAHX,iBAFA,QAAO;IAMP,oCAAS,CAAC,EAAC,KAAK,EAAC;;QAChB,MAAM,cARP;QASC,QAAQ,GAAG,WATZ,OASoB,gBANpB,iBAFA,QAAO,aAGP,gBAAqB;;;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;IACZ,oCAAS,CAAC,EAAC,KAAK,EAAC;;QAChB,MAAM,IAAM;QACZ,QAAQ,GAAG,CAAC;;;;IAEb,qBACC,WAAC;QAAI,OAAO;aAAQ;AAEtB,sCAAG;AAEH,OAAO,MAAM,yBAAW,sCAAW,CAAC,EAAC,KAAK,EAAE,QAAQ,MAAM,EAAC;IAC1D,QAAQ,GAAG,CAAC;IACZ,oCAAS,CAAC,EAAC,KAAK,EAAC;;QAChB,MAAM,IAAM;QACZ,QAAQ,GAAG,CAAC;;;;IAEb,qBACC,WAAC;QAAI,OAAO;aAAQ;AAEtB,sCAAG\"}")
125126
== DIAGNOSTICS ==
126127

127128
[]

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 2367
3+
assertion_line: 2366
44
expression: output
5+
snapshot_kind: text
56
---
67
==INPUT==
78

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 3622
3+
assertion_line: 3621
44
expression: output
5+
snapshot_kind: text
56
---
67
==INPUT==
78

@@ -61,9 +62,8 @@ export const test_component_LUXeXe0DQrg = (_rawProps)=>{
6162
id: _wrapProp(_rawProps, "id")
6263
}, null, [
6364
/*#__PURE__*/ _jsxSplit("span", {
64-
..._getVarProps(rest),
65-
..._getConstProps(rest)
66-
}, null, [
65+
..._getVarProps(rest)
66+
}, _getConstProps(rest), [
6767
_wrapProp(_rawProps, "message"),
6868
" ",
6969
_wrapProp(_rawProps, "count")
@@ -75,7 +75,7 @@ export const test_component_LUXeXe0DQrg = (_rawProps)=>{
7575
};
7676

7777

78-
Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;0CAK4B;;;;;;IACzB,MAAM,UAAU,SAAS;QAAE,SAAS;IAAE,GAAG;QAAE,UAAU;IAAM;IAC3D,QAAQ,OAAO;IACf,MAAM,YAAY,QAAQ,OAAO,GAAG;IACpC,qBACC,WAAC;QAAI,EAAE;;sBACN,UAAC;4BAAS;8BAAA;;;YACD;;;sBAET,WAAC;YAAI,OAAM;WAAW;;AAGzB\"}")
78+
Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;;0CAK4B;;;;;;IACzB,MAAM,UAAU,SAAS;QAAE,SAAS;IAAE,GAAG;QAAE,UAAU;IAAM;IAC3D,QAAQ,OAAO;IACf,MAAM,YAAY,QAAQ,OAAO,GAAG;IACpC,qBACC,WAAC;QAAI,EAAE;;sBACN,UAAC;4BAAS;0BAAA;;YACD;;;sBAET,WAAC;YAAI,OAAM;WAAW;;AAGzB\"}")
7979
/*
8080
{
8181
"origin": "test.tsx",
File renamed without changes.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
source: packages/qwik/src/optimizer/core/src/test.rs
3+
assertion_line: 4617
4+
expression: output
5+
---
6+
==INPUT==
7+
8+
9+
import { component$ } from '@qwik.dev/core';
10+
11+
export default component$((props) => {
12+
return <div {...props} class={[props.class, 'component']} {...props} />;
13+
});
14+
15+
============================= test.js ==
16+
17+
import { componentQrl } from "@qwik.dev/core";
18+
import { qrl } from "@qwik.dev/core";
19+
const i_LUXeXe0DQrg = ()=>import("./test.tsx_test_component_LUXeXe0DQrg");
20+
export default /*#__PURE__*/ componentQrl(/*#__PURE__*/ qrl(i_LUXeXe0DQrg, "test_component_LUXeXe0DQrg"));
21+
22+
23+
Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;AAGE,6BAAe,6EAEZ\"}")
24+
============================= test.tsx_test_component_LUXeXe0DQrg.js (ENTRY POINT)==
25+
26+
import { _fnSignal } from "@qwik.dev/core";
27+
import { _getConstProps } from "@qwik.dev/core";
28+
import { _getVarProps } from "@qwik.dev/core";
29+
import { _jsxSplit } from "@qwik.dev/core";
30+
export const test_component_LUXeXe0DQrg = (props)=>{
31+
return /*#__PURE__*/ _jsxSplit("div", {
32+
..._getVarProps(props),
33+
..._getConstProps(props),
34+
class: _fnSignal((p0)=>[
35+
p0.class,
36+
'component'
37+
], [
38+
props
39+
], '[p0.class,"component"]'),
40+
..._getVarProps(props)
41+
}, _getConstProps(props), null, 0, "u6_0");
42+
};
43+
44+
45+
Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;0CAG4B,CAAC;IAC1B,qBAAO,UAAC;wBAAQ;0BAAA;QAAO,KAAK,kBAAE;gBAAC,GAAM,KAAK;gBAAE;aAAY;;;wBAAM;sBAAA;AAC/D\"}")
46+
/*
47+
{
48+
"origin": "test.tsx",
49+
"name": "test_component_LUXeXe0DQrg",
50+
"entry": null,
51+
"displayName": "test.tsx_test_component",
52+
"hash": "LUXeXe0DQrg",
53+
"canonicalFilename": "test.tsx_test_component_LUXeXe0DQrg",
54+
"path": "",
55+
"extension": "js",
56+
"parent": null,
57+
"ctxKind": "function",
58+
"ctxName": "component$",
59+
"captures": false,
60+
"loc": [
61+
78,
62+
170
63+
],
64+
"paramNames": [
65+
"props"
66+
]
67+
}
68+
*/
69+
== DIAGNOSTICS ==
70+
71+
[]

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 4435
3+
assertion_line: 4434
44
expression: output
5+
snapshot_kind: text
56
---
67
==INPUT==
78

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 4454
3+
assertion_line: 4453
44
expression: output
5+
snapshot_kind: text
56
---
67
==INPUT==
78

@@ -30,15 +31,15 @@ import { _getVarProps } from "@qwik.dev/core";
3031
import { _jsxSplit } from "@qwik.dev/core";
3132
export const test_component_LUXeXe0DQrg = (props)=>{
3233
return /*#__PURE__*/ _jsxSplit("div", {
33-
..._getVarProps(props),
34-
..._getConstProps(props)
34+
..._getVarProps(props)
3535
}, {
36+
..._getConstProps(props),
3637
test: "test"
3738
}, null, 0, "u6_0");
3839
};
3940

4041

41-
Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;0CAG4B,CAAC;IAC1B,qBACC,UAAC;wBAAQ;0BAAA;;QAAO,MAAK;;AAEvB\"}")
42+
Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;0CAG4B,CAAC;IAC1B,qBACC,UAAC;wBAAQ;;0BAAA;QAAO,MAAK;;AAEvB\"}")
4243
/*
4344
{
4445
"origin": "test.tsx",

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 4473
3+
assertion_line: 4472
44
expression: output
5+
snapshot_kind: text
56
---
67
==INPUT==
78

@@ -31,13 +32,12 @@ import { _jsxSplit } from "@qwik.dev/core";
3132
export const test_component_LUXeXe0DQrg = (props)=>{
3233
return /*#__PURE__*/ _jsxSplit("div", {
3334
test: "test",
34-
..._getVarProps(props),
35-
..._getConstProps(props)
36-
}, null, null, 0, "u6_0");
35+
..._getVarProps(props)
36+
}, _getConstProps(props), null, 0, "u6_0");
3737
};
3838

3939

40-
Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;0CAG4B,CAAC;IAC1B,qBACC,UAAC;QAAI,MAAK;wBAAW;0BAAA;;AAEvB\"}")
40+
Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;0CAG4B,CAAC;IAC1B,qBACC,UAAC;QAAI,MAAK;wBAAW;sBAAA;AAEvB\"}")
4141
/*
4242
{
4343
"origin": "test.tsx",

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
source: packages/qwik/src/optimizer/core/src/test.rs
3-
assertion_line: 4512
3+
assertion_line: 4511
44
expression: output
5+
snapshot_kind: text
56
---
67
==INPUT==
78

@@ -64,15 +65,14 @@ const i_DGk9xLyRokA = ()=>import("./test.tsx_test_component_button_onClick_DGk9x
6465
export const test_component_LUXeXe0DQrg = (props)=>{
6566
return /*#__PURE__*/ _jsxSplit("button", {
6667
..._getVarProps(props),
67-
..._getConstProps(props),
6868
onClick$: /*#__PURE__*/ qrl(i_DGk9xLyRokA, "test_component_button_onClick_DGk9xLyRokA", [
6969
props
7070
])
71-
}, null, null, 0, "u6_0");
71+
}, _getConstProps(props), null, 0, "u6_0");
7272
};
7373

7474

75-
Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;0CAG4B,CAAC;IAC1B,qBAAO,UAAC;wBAAW;0BAAA;QAAO,QAAQ;;;;AACnC\"}")
75+
Some("{\"version\":3,\"sources\":[\"/user/qwik/src/test.tsx\"],\"names\":[],\"mappings\":\";;;;;0CAG4B,CAAC;IAC1B,qBAAO,UAAC;wBAAW;QAAO,QAAQ;;;sBAAf;AACpB\"}")
7676
/*
7777
{
7878
"origin": "test.tsx",

0 commit comments

Comments
 (0)