This repository was archived by the owner on Aug 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 239
Expand file tree
/
Copy pathJSIL.ArrayEnumerator.js
More file actions
73 lines (62 loc) · 2.22 KB
/
JSIL.ArrayEnumerator.js
File metadata and controls
73 lines (62 loc) · 2.22 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
JSIL.MakeClass("System.Object", "JSIL.ArrayEnumerator", true, ["T"], function ($) {
var T = new JSIL.GenericParameter("T", "JSIL.ArrayEnumerator");
$.RawMethod(false, "__CopyMembers__",
function ArrayEnumerator_CopyMembers(source, target) {
target._array = source._array;
target._length = source._length;
target._index = source._index;
}
);
$.Method({ Public: true, Static: false }, ".ctor",
new JSIL.MethodSignature(null, [$jsilcore.TypeRef("System.Array", ["!!0"]), $.Int32]),
function (array, startPosition) {
this._array = array;
this._length = array.length;
if (typeof (startPosition) !== "number")
JSIL.RuntimeError("ArrayEnumerator ctor second argument must be number");
this._index = startPosition;
}
);
$.Method({ Public: true, Static: false, Virtual: true }, "Reset",
new JSIL.MethodSignature(null, []),
function () {
if (this._array === null)
JSIL.RuntimeError("Enumerator is disposed or not initialized");
this._index = -1;
}
);
$.Method({ Public: true, Static: false, Virtual: true }, "MoveNext",
new JSIL.MethodSignature(System.Boolean, []),
function () {
return (++this._index < this._length);
}
);
$.Method({ Public: true, Static: false, Virtual: true }, "Dispose",
new JSIL.MethodSignature(null, []),
function () {
this._array = null;
this._index = 0;
this._length = -1;
}
);
$.Method({ Public: false, Static: false }, null,
new JSIL.MethodSignature(System.Object, []),
function () {
return this._array[this._index];
}
)
.Overrides("System.Collections.IEnumerator", "get_Current");
$.Method({ Public: true, Static: false, Virtual: true }, "get_Current",
new JSIL.MethodSignature(T, []),
function () {
return this._array[this._index];
}
)
.Overrides("System.Collections.Generic.IEnumerator`1", "get_Current");
$.Property({ Public: true, Static: false, Virtual: true }, "Current");
$.ImplementInterfaces(
/* 0 */ System.IDisposable,
/* 1 */ System.Collections.IEnumerator,
/* 2 */ $jsilcore.TypeRef("System.Collections.Generic.IEnumerator`1", [new JSIL.GenericParameter("T", "JSIL.ArrayEnumerator")])
);
});