-
Notifications
You must be signed in to change notification settings - Fork 0
/
freezer.js
214 lines (193 loc) · 4.75 KB
/
freezer.js
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
// generatedy by JSX compiler 0.9.79 (2014-02-24 12:54:26 +0900; b5dd59d9f43bbf0e1136c6419bf44827e55702c8)
var JSX = {};
(function (JSX) {
/**
* extends the class
*/
function $__jsx_extend(derivations, base) {
var ctor = function () {};
ctor.prototype = base.prototype;
var proto = new ctor();
for (var i in derivations) {
derivations[i].prototype = proto;
}
}
/**
* copies the implementations from source interface to target
*/
function $__jsx_merge_interface(target, source) {
for (var k in source.prototype)
if (source.prototype.hasOwnProperty(k))
target.prototype[k] = source.prototype[k];
}
/**
* defers the initialization of the property
*/
function $__jsx_lazy_init(obj, prop, func) {
function reset(obj, prop, value) {
delete obj[prop];
obj[prop] = value;
return value;
}
Object.defineProperty(obj, prop, {
get: function () {
return reset(obj, prop, func());
},
set: function (v) {
reset(obj, prop, v);
},
enumerable: true,
configurable: true
});
}
var $__jsx_imul = Math.imul;
if (typeof $__jsx_imul === "undefined") {
$__jsx_imul = function (a, b) {
var ah = (a >>> 16) & 0xffff;
var al = a & 0xffff;
var bh = (b >>> 16) & 0xffff;
var bl = b & 0xffff;
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0);
};
}
/**
* fused int-ops with side-effects
*/
function $__jsx_ipadd(o, p, r) {
return o[p] = (o[p] + r) | 0;
}
function $__jsx_ipsub(o, p, r) {
return o[p] = (o[p] - r) | 0;
}
function $__jsx_ipmul(o, p, r) {
return o[p] = $__jsx_imul(o[p], r);
}
function $__jsx_ipdiv(o, p, r) {
return o[p] = (o[p] / r) | 0;
}
function $__jsx_ipmod(o, p, r) {
return o[p] = (o[p] % r) | 0;
}
function $__jsx_ippostinc(o, p) {
var v = o[p];
o[p] = (v + 1) | 0;
return v;
}
function $__jsx_ippostdec(o, p) {
var v = o[p];
o[p] = (v - 1) | 0;
return v;
}
/*
* global functions, renamed to avoid conflict with local variable names
*/
var $__jsx_parseInt = parseInt;
var $__jsx_parseFloat = parseFloat;
function $__jsx_isNaN(n) { return n !== n; }
var $__jsx_isFinite = isFinite;
var $__jsx_encodeURIComponent = encodeURIComponent;
var $__jsx_decodeURIComponent = decodeURIComponent;
var $__jsx_encodeURI = encodeURI;
var $__jsx_decodeURI = decodeURI;
var $__jsx_ObjectToString = Object.prototype.toString;
var $__jsx_ObjectHasOwnProperty = Object.prototype.hasOwnProperty;
/*
* profiler object, initialized afterwards
*/
function $__jsx_profiler() {
}
/*
* public interface to JSX code
*/
JSX.require = function (path) {
var m = $__jsx_classMap[path];
return m !== undefined ? m : null;
};
JSX.profilerIsRunning = function () {
return $__jsx_profiler.getResults != null;
};
JSX.getProfileResults = function () {
return ($__jsx_profiler.getResults || function () { return {}; })();
};
JSX.postProfileResults = function (url, cb) {
if ($__jsx_profiler.postResults == null)
throw new Error("profiler has not been turned on");
return $__jsx_profiler.postResults(url, cb);
};
JSX.resetProfileResults = function () {
if ($__jsx_profiler.resetResults == null)
throw new Error("profiler has not been turned on");
return $__jsx_profiler.resetResults();
};
JSX.DEBUG = true;
var GeneratorFunction$0 =
(function () {
try {
eval('import {GeneratorFunction} from "std:iteration"');
return GeneratorFunction;
} catch (e) {
return function GeneratorFunction () {};
}
})();
var __jsx_generator_object$0 =
(function () {
function __jsx_generator_object() {
this.__next = 0;
this.__loop = null;
this.__value = undefined;
this.__status = 0; // SUSPENDED: 0, ACTIVE: 1, DEAD: 2
}
__jsx_generator_object.prototype.next = function () {
switch (this.__status) {
case 0:
this.__status = 1;
// go next!
this.__loop(this.__next);
var done = false;
if (this.__next != -1) {
this.__status = 0;
} else {
this.__status = 2;
done = true;
}
return { value: this.__value, done: done };
case 1:
throw new Error("Generator is already running");
case 2:
throw new Error("Generator is already finished");
default:
throw new Error("Unexpected generator internal state");
}
};
return __jsx_generator_object;
}());
var Freezer$0 =
(function() {
var Freezer =
{
freeze: Object.freeze,
deepFreeze: function deepFreeze(o) {
var prop, propKey;
Object.freeze(o);
for (propKey in o) {
prop = o[propKey];
if (!o.hasOwnProperty(propKey) || !(typeof prop === "object") || Object.isFrozen(prop)) {
continue;
}
deepFreeze(prop);
}
return o;
},
isFrozen: Object.isFrozen
};
if (typeof module !== 'undefined' && module.exports) {
// Node.js
module.exports = Freezer;
} else {
window.Freezer = Freezer;
}
return Freezer;
}())
;
var $__jsx_classMap = {};
})(JSX);