diff --git a/src/runtime/internal/utils.ts b/src/runtime/internal/utils.ts
index fb2554ad78..b844f1dd4c 100644
--- a/src/runtime/internal/utils.ts
+++ b/src/runtime/internal/utils.ts
@@ -80,9 +80,17 @@ export function get_slot_changes(definition, $$scope, dirty, fn) {
if (definition[2] && fn) {
const lets = definition[2](fn(dirty));
- return typeof $$scope.dirty === 'object'
- ? $$scope.dirty.map((n, i) => n | lets[i])
- : $$scope.dirty | lets;
+ if (typeof $$scope.dirty === 'object') {
+ const merged = [];
+ const len = Math.max($$scope.dirty.length, lets.length);
+ for (let i = 0; i < len; i += 1) {
+ merged[i] = $$scope.dirty[i] | lets[i];
+ }
+
+ return merged;
+ }
+
+ return $$scope.dirty | lets;
}
return $$scope.dirty;
diff --git a/test/runtime/samples/bitmask-overflow-slot/Echo.svelte b/test/runtime/samples/bitmask-overflow-slot/Echo.svelte
new file mode 100644
index 0000000000..28eaa54060
--- /dev/null
+++ b/test/runtime/samples/bitmask-overflow-slot/Echo.svelte
@@ -0,0 +1,5 @@
+
+
+
0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+5:36
+6:37
+38
+0
+ `, + + test({ assert, component, target }) { + component.reads = {}; + + component._0 = 'a'; + component._30 = 'b'; + component._31 = 'c'; + component._32 = 'd'; + component._40 = 'e'; + + component._5 = 'f'; + component._6 = 'g'; + component._36 = 'h'; + component._37 = 'i'; + + assert.htmlEqual(target.innerHTML, ` +a
+1
+2
+3
+4
+f
+g
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+b
+c
+d
+33
+34
+35
+h
+i
+38
+39
+e
+f:h
+g:i
+38
+a
+ `); + + assert.deepEqual(component.reads, { + _0: 1, + _5: 3, + _6: 3, + _30: 1, + _31: 1, + _32: 1, + _36: 3, + _37: 3, + _40: 1 + }); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/bitmask-overflow-slot/main.svelte b/test/runtime/samples/bitmask-overflow-slot/main.svelte new file mode 100644 index 0000000000..89e60ce4b9 --- /dev/null +++ b/test/runtime/samples/bitmask-overflow-slot/main.svelte @@ -0,0 +1,107 @@ + + +{read(_0, '_0')}
+{read(_1, '_1')}
+{read(_2, '_2')}
+{read(_3, '_3')}
+{read(_4, '_4')}
+{read(_5, '_5')}
+{read(_6, '_6')}
+{read(_7, '_7')}
+{read(_8, '_8')}
+{read(_9, '_9')}
+{read(_10, '_10')}
+{read(_11, '_11')}
+{read(_12, '_12')}
+{read(_13, '_13')}
+{read(_14, '_14')}
+{read(_15, '_15')}
+{read(_16, '_16')}
+{read(_17, '_17')}
+{read(_18, '_18')}
+{read(_19, '_19')}
+{read(_20, '_20')}
+{read(_21, '_21')}
+{read(_22, '_22')}
+{read(_23, '_23')}
+{read(_24, '_24')}
+{read(_25, '_25')}
+{read(_26, '_26')}
+{read(_27, '_27')}
+{read(_28, '_28')}
+{read(_29, '_29')}
+{read(_30, '_30')}
+{read(_31, '_31')}
+{read(_32, '_32')}
+{read(_33, '_33')}
+{read(_34, '_34')}
+{read(_35, '_35')}
+{read(_36, '_36')}
+{read(_37, '_37')}
+{read(_38, '_38')}
+{read(_39, '_39')}
+{read(_40, '_40')}
+ +{read(_5, '_5') + ':' + read(_36, '_36')}
+{foo}
+{bar}
+ +{dummy}
+