Debian Codegraph @

src/subcommands/sample_diff.rs

raw symbols SCIP
1 pub const DIFFrust-analyzer cargo git-delta 0.19.2 subcommands/sample_diff/DIFF.: &[u8] = r#"
2 commit 7ec4627902020cccd7b3f4fbc63e1b0d6b9798cd
3 Author: Evan You <[email protected]>
4 Date: Thu Feb 21 08:52:15 2019 -0500
5
6 fix: ensure generated scoped slot code is compatible with 2.5
7
8 fix #9545
9
10 diff --git a/src/compiler/codegen/index.js b/src/compiler/codegen/index.js
11 index a64c3421..d433f756 100644
12 --- a/src/compiler/codegen/index.js
13 +++ b/src/compiler/codegen/index.js
14 @@ -409,9 +409,9 @@ function genScopedSlots (
15 .join(',')
16
17 return `scopedSlots:_u([${generatedSlots}]${
18 - needsForceUpdate ? `,true` : ``
19 + needsForceUpdate ? `,null,true` : ``
20 }${
21 - !needsForceUpdate && needsKey ? `,false,${hash(generatedSlots)}` : ``
22 + !needsForceUpdate && needsKey ? `,null,false,${hash(generatedSlots)}` : ``
23 })`
24 }
25
26 diff --git a/src/core/instance/render-helpers/resolve-scoped-slots.js b/src/core/instance/render-helpers/resolve-scoped-slots.js
27 index 6439324b..f11ca000 100644
28 --- a/src/core/instance/render-helpers/resolve-scoped-slots.js
29 +++ b/src/core/instance/render-helpers/resolve-scoped-slots.js
30 @@ -2,15 +2,16 @@
31
32 export function resolveScopedSlots (
33 fns: ScopedSlotsData, // see flow/vnode
34 - hasDynamicKeys: boolean,
35 - contentHashKey: number,
36 - res?: Object
37 + res?: Object,
38 + // the following are added in 2.6
39 + hasDynamicKeys?: boolean,
40 + contentHashKey?: number
41 ): { [key: string]: Function, $stable: boolean } {
42 res = res || { $stable: !hasDynamicKeys }
43 for (let i = 0; i < fns.length; i++) {
44 const slot = fns[i]
45 if (Array.isArray(slot)) {
46 - resolveScopedSlots(slot, hasDynamicKeys, null, res)
47 + resolveScopedSlots(slot, res, hasDynamicKeys)
48 } else if (slot) {
49 // marker for reverse proxying v-slot without scope on this.$slots
50 if (slot.proxy) {
51 @@ -20,7 +21,7 @@ export function resolveScopedSlots (
52 }
53 }
54 if (contentHashKey) {
55 - res.$key = contentHashKey
56 + (res: any).$key = contentHashKey
57 }
58 return res
59 }
60 diff --git a/test/unit/modules/compiler/codegen.spec.js b/test/unit/modules/compiler/codegen.spec.js
61 index 98c202dd..e56b2576 100644
62 --- a/test/unit/modules/compiler/codegen.spec.js
63 +++ b/test/unit/modules/compiler/codegen.spec.js
64 @@ -232,25 +232,25 @@ describe('codegen', () => {
65 it('generate dynamic scoped slot', () => {
66 assertCodegen(
67 '<foo><template :slot="foo" slot-scope="bar">{{ bar }}</template></foo>',
68 - `with(this){return _c('foo',{scopedSlots:_u([{key:foo,fn:function(bar){return [_v(_s(bar))]}}],true)})}`
69 + `with(this){return _c('foo',{scopedSlots:_u([{key:foo,fn:function(bar){return [_v(_s(bar))]}}],null,true)})}`
70 )
71 })
72
73 it('generate scoped slot with multiline v-if', () => {
74 assertCodegen(
75 '<foo><template v-if="\nshow\n" slot-scope="bar">{{ bar }}</template></foo>',
76 - `with(this){return _c('foo',{scopedSlots:_u([{key:"default",fn:function(bar){return (\nshow\n)?[_v(_s(bar))]:undefined}}],true)})}`
77 + `with(this){return _c('foo',{scopedSlots:_u([{key:"default",fn:function(bar){return (\nshow\n)?[_v(_s(bar))]:undefined}}],null,true)})}`
78 )
79 assertCodegen(
80 '<foo><div v-if="\nshow\n" slot="foo" slot-scope="bar">{{ bar }}</div></foo>',
81 - `with(this){return _c(\'foo\',{scopedSlots:_u([{key:"foo",fn:function(bar){return (\nshow\n)?_c(\'div\',{},[_v(_s(bar))]):_e()}}],true)})}`
82 + `with(this){return _c(\'foo\',{scopedSlots:_u([{key:"foo",fn:function(bar){return (\nshow\n)?_c(\'div\',{},[_v(_s(bar))]):_e()}}],null,true)})}`
83 )
84 })
85
86 it('generate scoped slot with new slot syntax', () => {
87 assertCodegen(
88 '<foo><template v-if="show" #default="bar">{{ bar }}</template></foo>',
89 - `with(this){return _c('foo',{scopedSlots:_u([(show)?{key:"default",fn:function(bar){return [_v(_s(bar))]}}:null],true)})}`
90 + `with(this){return _c('foo',{scopedSlots:_u([(show)?{key:"default",fn:function(bar){return [_v(_s(bar))]}}:null],null,true)})}`
91 )
92 })
93 "#.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().();