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.AbstractEnumerator.js
More file actions
86 lines (74 loc) · 2.51 KB
/
JSIL.AbstractEnumerator.js
File metadata and controls
86 lines (74 loc) · 2.51 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
74
75
76
77
78
79
80
81
82
83
84
85
86
JSIL.MakeClass("System.Object", "JSIL.AbstractEnumerator", true, ["T"], function ($) {
var T = new JSIL.GenericParameter("T", "JSIL.AbstractEnumerator");
$.RawMethod(false, "__CopyMembers__",
function AbstractEnumerator_CopyMembers(source, target) {
target._getNextItem = source._getNextItem;
target._reset = source._reset;
target._dispose = source._dispose;
target._first = source._first;
target._needDispose = source._needDispose;
target._current = new JSIL.BoxedVariable(source._current.get());
target._state = source._state;
}
);
$.Method({ Static: false, Public: true }, ".ctor",
new JSIL.MethodSignature(null, [JSIL.AnyType, JSIL.AnyType, JSIL.AnyType]),
function (getNextItem, reset, dispose) {
this._getNextItem = getNextItem;
this._reset = reset;
this._dispose = dispose;
this._first = true;
this._needDispose = false;
this._current = new JSIL.BoxedVariable(null);
}
);
$.Method({ Static: false, Public: true, Virtual: true }, "Reset",
new JSIL.MethodSignature(null, []),
function () {
if (this._needDispose)
this._dispose();
this._first = false;
this._needDispose = true;
this._reset();
}
);
$.Method({ Static: false, Public: true, Virtual: true }, "MoveNext",
new JSIL.MethodSignature("System.Boolean", []),
function () {
if (this._first) {
this._reset();
this._needDispose = true;
this._first = false;
}
return this._getNextItem(this._current);
}
);
$.Method({ Static: false, Public: true, Virtual: true }, "Dispose",
new JSIL.MethodSignature(null, []),
function () {
if (this._needDispose)
this._dispose();
this._needDispose = false;
}
);
$.Method({ Static: false, Public: false }, null,
new JSIL.MethodSignature($.Object, []),
function () {
return this._current.get();
}
)
.Overrides("System.Collections.IEnumerator", "get_Current");
$.Method({ Static: false, Public: true }, "get_Current",
new JSIL.MethodSignature(T, []),
function () {
return this._current.get();
}
)
.Overrides("System.Collections.Generic.IEnumerator`1", "get_Current");
$.Property({ Static: false, Public: true, Virtual: true }, "Current");
$.ImplementInterfaces(
/* 0 */ $jsilcore.TypeRef("System.Collections.IEnumerator"),
/* 1 */ $jsilcore.TypeRef("System.Collections.Generic.IEnumerator`1", [T]),
/* 2 */ $jsilcore.TypeRef("System.IDisposable")
);
});