1
1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
3
+ exports [` cache multiple access > dynamic key bindings with expressions 1` ] = `
4
+ "import { setDynamicProps as _setDynamicProps , renderEffect as _renderEffect , template as _template } from 'vue';
5
+ const t0 = _template("<div ></div >", true)
6
+
7
+ export function render(_ctx) {
8
+ const n0 = t0 ()
9
+ _renderEffect (() => {
10
+ const _key = _ctx .key
11
+ _setDynamicProps (n0 , [{ [_key + 1 ]: _ctx .foo [_key + 1 ]() }], true )
12
+ })
13
+ return n0
14
+ } "
15
+ ` ;
16
+
17
+ exports [` cache multiple access > dynamic property access 1` ] = `
18
+ "import { setProp as _setProp , renderEffect as _renderEffect , template as _template } from 'vue';
19
+ const t0 = _template("<div ></div >", true)
20
+
21
+ export function render(_ctx) {
22
+ const n0 = t0 ()
23
+ _renderEffect (() => {
24
+ const _obj = _ctx .obj
25
+ _setProp (n0 , " id" , _obj [1 ][_ctx .baz ] + _obj .bar )
26
+ })
27
+ return n0
28
+ } "
29
+ ` ;
30
+
31
+ exports [` cache multiple access > function calls with arguments 1` ] = `
32
+ "import { setProp as _setProp , renderEffect as _renderEffect , template as _template } from 'vue';
33
+ const t0 = _template("<div ></div >")
34
+
35
+ export function render(_ctx) {
36
+ const n0 = t0 ()
37
+ const n1 = t0 ()
38
+ const n2 = t0 ()
39
+ _renderEffect (() => {
40
+ const _foo = _ctx .foo
41
+ const _bar = _ctx .bar
42
+ const _foo_bar_baz = _foo [_bar (_ctx .baz )]
43
+
44
+ _setProp (n0 , " id" , _foo_bar_baz )
45
+ _setProp (n1 , " id" , _foo_bar_baz )
46
+ _setProp (n2 , " id" , _bar () + _foo )
47
+ })
48
+ return [n0 , n1 , n2 ]
49
+ } "
50
+ ` ;
51
+
52
+ exports [` cache multiple access > not cache variable and member expression with the same name 1` ] = `
53
+ "import { setProp as _setProp , renderEffect as _renderEffect , template as _template } from 'vue';
54
+ const t0 = _template("<div ></div >", true)
55
+
56
+ export function render(_ctx) {
57
+ const n0 = t0 ()
58
+ _renderEffect (() => _setProp (n0 , " id" , _ctx .bar + _ctx .obj .bar ))
59
+ return n0
60
+ } "
61
+ ` ;
62
+
63
+ exports [` cache multiple access > object property chain access 1` ] = `
64
+ "import { setProp as _setProp , renderEffect as _renderEffect , template as _template } from 'vue';
65
+ const t0 = _template("<div ></div >")
66
+
67
+ export function render(_ctx) {
68
+ const n0 = t0 ()
69
+ const n1 = t0 ()
70
+ _renderEffect (() => {
71
+ const _obj = _ctx .obj
72
+ const _obj_foo_baz_obj_bar = _obj [' foo' ][' baz' ] + _obj .bar
73
+
74
+ _setProp (n0 , " id" , _obj_foo_baz_obj_bar )
75
+ _setProp (n1 , " id" , _obj_foo_baz_obj_bar )
76
+ })
77
+ return [n0 , n1 ]
78
+ } "
79
+ ` ;
80
+
81
+ exports [` cache multiple access > repeated expression in expressions 1` ] = `
82
+ "import { setProp as _setProp , renderEffect as _renderEffect , template as _template } from 'vue';
83
+ const t0 = _template("<div ></div >")
84
+
85
+ export function render(_ctx) {
86
+ const n0 = t0 ()
87
+ const n1 = t0 ()
88
+ const n2 = t0 ()
89
+ _renderEffect (() => {
90
+ const _foo = _ctx .foo
91
+ const _foo_bar = _foo + _ctx .bar
92
+
93
+ _setProp (n0 , " id" , _foo_bar )
94
+ _setProp (n1 , " id" , _foo_bar )
95
+ _setProp (n2 , " id" , _foo + _foo_bar )
96
+ })
97
+ return [n0 , n1 , n2 ]
98
+ } "
99
+ ` ;
100
+
101
+ exports [` cache multiple access > repeated expressions 1` ] = `
102
+ "import { setProp as _setProp , renderEffect as _renderEffect , template as _template } from 'vue';
103
+ const t0 = _template("<div ></div >")
104
+
105
+ export function render(_ctx) {
106
+ const n0 = t0 ()
107
+ const n1 = t0 ()
108
+ _renderEffect (() => {
109
+ const _foo_bar = _ctx .foo + _ctx .bar
110
+
111
+ _setProp (n0 , " id" , _foo_bar )
112
+ _setProp (n1 , " id" , _foo_bar )
113
+ })
114
+ return [n0 , n1 ]
115
+ } "
116
+ ` ;
117
+
118
+ exports [` cache multiple access > repeated variable in expressions 1` ] = `
119
+ "import { setProp as _setProp , renderEffect as _renderEffect , template as _template } from 'vue';
120
+ const t0 = _template("<div ></div >")
121
+
122
+ export function render(_ctx) {
123
+ const n0 = t0 ()
124
+ const n1 = t0 ()
125
+ _renderEffect (() => {
126
+ const _foo = _ctx .foo
127
+ _setProp (n0 , " id" , _foo + _foo + _ctx .bar )
128
+ _setProp (n1 , " id" , _foo )
129
+ })
130
+ return [n0 , n1 ]
131
+ } "
132
+ ` ;
133
+
134
+ exports [` cache multiple access > repeated variables 1` ] = `
135
+ "import { setClass as _setClass , renderEffect as _renderEffect , template as _template } from 'vue';
136
+ const t0 = _template("<div ></div >")
137
+
138
+ export function render(_ctx) {
139
+ const n0 = t0 ()
140
+ const n1 = t0 ()
141
+ _renderEffect (() => {
142
+ const _foo = _ctx .foo
143
+
144
+ _setClass (n0 , _foo )
145
+ _setClass (n1 , _foo )
146
+ })
147
+ return [n0 , n1 ]
148
+ } "
149
+ ` ;
150
+
3
151
exports [` compiler v-bind > .attr modifier 1` ] = `
4
152
"import { setAttr as _setAttr , renderEffect as _renderEffect , template as _template } from 'vue';
5
153
const t0 = _template("<div ></div >", true)
@@ -305,22 +453,24 @@ export function render(_ctx) {
305
453
const n5 = t5 ()
306
454
const n6 = t6 ()
307
455
_renderEffect (() => {
456
+ const _width = _ctx .width
457
+ const _height = _ctx .height
308
458
_setAttr (n0 , " spellcheck" , _ctx .spellcheck )
309
459
_setAttr (n0 , " draggable" , _ctx .draggable )
310
460
_setAttr (n0 , " translate" , _ctx .translate )
311
461
_setAttr (n0 , " form" , _ctx .form )
312
462
_setAttr (n1 , " list" , _ctx .list )
313
463
_setAttr (n2 , " type" , _ctx .type )
314
464
315
- _setAttr (n3 , " width" , _ctx . width )
316
- _setAttr (n4 , " width" , _ctx . width )
317
- _setAttr (n5 , " width" , _ctx . width )
318
- _setAttr (n6 , " width" , _ctx . width )
465
+ _setAttr (n3 , " width" , _width )
466
+ _setAttr (n4 , " width" , _width )
467
+ _setAttr (n5 , " width" , _width )
468
+ _setAttr (n6 , " width" , _width )
319
469
320
- _setAttr (n3 , " height" , _ctx . height )
321
- _setAttr (n4 , " height" , _ctx . height )
322
- _setAttr (n5 , " height" , _ctx . height )
323
- _setAttr (n6 , " height" , _ctx . height )
470
+ _setAttr (n3 , " height" , _height )
471
+ _setAttr (n4 , " height" , _height )
472
+ _setAttr (n5 , " height" , _height )
473
+ _setAttr (n6 , " height" , _height )
324
474
})
325
475
return [n0 , n1 , n2 , n3 , n4 , n5 , n6 ]
326
476
} "
@@ -343,7 +493,11 @@ const t0 = _template("<div></div>", true)
343
493
344
494
export function render(_ctx) {
345
495
const n0 = t0 ()
346
- _renderEffect (() => _setDynamicProps (n0 , [{ [_ctx .id ]: _ctx .id , [_ctx .title ]: _ctx .title }], true ))
496
+ _renderEffect (() => {
497
+ const _id = _ctx .id
498
+ const _title = _ctx .title
499
+ _setDynamicProps (n0 , [{ [_id ]: _id , [_title ]: _title }], true )
500
+ })
347
501
return n0
348
502
} "
349
503
`;
@@ -354,7 +508,10 @@ const t0 = _template("<div></div>", true)
354
508
355
509
export function render(_ctx) {
356
510
const n0 = t0 ()
357
- _renderEffect (() => _setDynamicProps (n0 , [{ [_ctx .id ]: _ctx .id , foo: " bar" , checked: " " }], true ))
511
+ _renderEffect (() => {
512
+ const _id = _ctx .id
513
+ _setDynamicProps (n0 , [{ [_id ]: _id , foo: " bar" , checked: " " }], true )
514
+ })
358
515
return n0
359
516
} "
360
517
`;
0 commit comments