File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -1153,19 +1153,20 @@ class VMArray extends REPR {
1153
1153
}
1154
1154
1155
1155
$$splice ( source , offset , count ) {
1156
+ const removing = this . array . length - offset > count ? count : this . array . length - offset ;
1156
1157
// TODO think about the case when the source is not VMArray
1157
- if ( count < source . array . length ) {
1158
- this . array . length = this . array . length + source . array . length - count ;
1158
+ if ( removing < source . array . length ) {
1159
+ this . array . length = this . array . length + source . array . length - removing ;
1159
1160
}
1160
1161
1161
- this . array . copyWithin ( offset + source . array . length , offset + count ) ;
1162
+ this . array . copyWithin ( offset + source . array . length , offset + removing ) ;
1162
1163
1163
1164
for ( let i = 0 ; i < source . array . length ; i ++ ) {
1164
1165
this . array [ offset + i ] = source . array [ i ] ;
1165
1166
}
1166
1167
1167
- if ( count > source . array . length ) {
1168
- this . array . length = this . array . length + source . array . length - count ;
1168
+ if ( removing > source . array . length ) {
1169
+ this . array . length = this . array . length + source . array . length - removing ;
1169
1170
}
1170
1171
1171
1172
return this ;
You can’t perform that action at this time.
0 commit comments