forked from AssemblyScript/assemblyscript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiterator.ts
More file actions
35 lines (29 loc) Β· 1.5 KB
/
iterator.ts
File metadata and controls
35 lines (29 loc) Β· 1.5 KB
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
export abstract class Iterable<T> {
// ?
}
@sealed
export abstract class Iterator<T> {
// private constructor(iterable: Iterable<T>) {
// }
// TODO: these need to evaluate the classId at the respective reference in order to obtain the
// next value, i.e. arrays work differently than maps. we'd then have:
//
// ββββββββββββββββββββ Iterator layout (32-bit) βββββββββββββββββββ
// 3 2 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 bits
// βββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ΄ββ€
// β index β
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ¬ββββ¬ββ€
// β reference β 0 βDβ
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ΄ββββ΄ββ
// D: Done flag
// get value(this: u64): T {
// ?
// }
// next(this: u64): Iterator<T> {
// ?
// }
done(this: u64): bool {
return <bool>(this & 1);
}
}