Skip to content

Commit be947d0

Browse files
♻️ refactor(Deep): Check all arguments in constructor.
1 parent 6b9fe93 commit be947d0

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/3-tree/implementations/2-Deep.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,34 @@ import {
88
CachedMeasure,
99
Split,
1010
} from '../../0-core/index.js';
11-
import {One, Two, Four} from '../../1-digit/index.js';
11+
import {One, Two, Three, Four} from '../../1-digit/index.js';
1212
import {delay, Lazy} from '../../4-lazy/index.js';
1313
import _prepend_small_list from '../../0-core/_fast/_prepend_small_list.js';
1414
import _fill_right from '../../0-core/_fast/_fill_right.js';
1515
import isSameMeasure from '../../_debug/isSameMeasure.js';
1616
import _append_small_list from '../../0-core/_fast/_append_small_list.js';
17-
import {Empty} from './index.js';
17+
import {Empty} from './0-Empty.js';
18+
import {Single} from './1-Single.js';
1819

1920
export function Deep(M, left, middle, right) {
21+
assert(
22+
left instanceof One ||
23+
left instanceof Two ||
24+
left instanceof Three ||
25+
left instanceof Four,
26+
);
27+
assert(
28+
middle instanceof Empty ||
29+
middle instanceof Single ||
30+
middle instanceof Deep ||
31+
middle instanceof Lazy,
32+
);
33+
assert(
34+
right instanceof One ||
35+
right instanceof Two ||
36+
right instanceof Three ||
37+
right instanceof Four,
38+
);
2039
assert(middle instanceof Lazy || middle.M instanceof CachedMeasure);
2140
this.M = M;
2241
this.left = left;

0 commit comments

Comments
 (0)