@jsenv/core 30.4.0 → 30.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,191 +18,171 @@
18
18
  CLASS = 10; // only used in assertValidReturnValue
19
19
  */
20
20
 
21
- function createAddInitializerMethod(initializers, decoratorFinishedRef) {
22
- return function addInitializer(initializer) {
23
- assertNotFinished(decoratorFinishedRef, "addInitializer");
24
- assertCallable(initializer, "An initializer");
25
- initializers.push(initializer);
26
- };
27
- }
28
- function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, value) {
29
- var kindStr;
30
- switch (kind) {
31
- case 1 /* ACCESSOR */:
32
- kindStr = "accessor";
33
- break;
34
- case 2 /* METHOD */:
35
- kindStr = "method";
36
- break;
37
- case 3 /* GETTER */:
38
- kindStr = "getter";
39
- break;
40
- case 4 /* SETTER */:
41
- kindStr = "setter";
42
- break;
43
- default:
44
- kindStr = "field";
45
- }
46
- var ctx = {
47
- kind: kindStr,
48
- name: isPrivate ? "#" + name : name,
49
- static: isStatic,
50
- private: isPrivate
51
- };
52
- var decoratorFinishedRef = {
53
- v: false
54
- };
55
- if (kind !== 0 /* FIELD */) {
56
- ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
21
+ function applyDecs2203RFactory() {
22
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
23
+ return function addInitializer(initializer) {
24
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
25
+ assertCallable(initializer, "An initializer");
26
+ initializers.push(initializer);
27
+ };
57
28
  }
58
- var get, set;
59
- if (kind === 0 /* FIELD */) {
60
- if (isPrivate) {
61
- get = desc.get;
62
- set = desc.set;
63
- } else {
64
- get = function () {
65
- return this[name];
66
- };
67
- set = function (v) {
68
- this[name] = v;
69
- };
29
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, value) {
30
+ var kindStr;
31
+ switch (kind) {
32
+ case 1 /* ACCESSOR */:
33
+ kindStr = "accessor";
34
+ break;
35
+ case 2 /* METHOD */:
36
+ kindStr = "method";
37
+ break;
38
+ case 3 /* GETTER */:
39
+ kindStr = "getter";
40
+ break;
41
+ case 4 /* SETTER */:
42
+ kindStr = "setter";
43
+ break;
44
+ default:
45
+ kindStr = "field";
70
46
  }
71
- } else if (kind === 2 /* METHOD */) {
72
- get = function () {
73
- return desc.value;
47
+ var ctx = {
48
+ kind: kindStr,
49
+ name: isPrivate ? "#" + name : name,
50
+ static: isStatic,
51
+ private: isPrivate
52
+ };
53
+ var decoratorFinishedRef = {
54
+ v: false
74
55
  };
75
- } else {
76
- // replace with values that will go through the final getter and setter
77
- if (kind === 1 /* ACCESSOR */ || kind === 3 /* GETTER */) {
56
+ if (kind !== 0 /* FIELD */) {
57
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
58
+ }
59
+ var get, set;
60
+ if (kind === 0 /* FIELD */) {
61
+ if (isPrivate) {
62
+ get = desc.get;
63
+ set = desc.set;
64
+ } else {
65
+ get = function () {
66
+ return this[name];
67
+ };
68
+ set = function (v) {
69
+ this[name] = v;
70
+ };
71
+ }
72
+ } else if (kind === 2 /* METHOD */) {
78
73
  get = function () {
79
- return desc.get.call(this);
74
+ return desc.value;
80
75
  };
76
+ } else {
77
+ // replace with values that will go through the final getter and setter
78
+ if (kind === 1 /* ACCESSOR */ || kind === 3 /* GETTER */) {
79
+ get = function () {
80
+ return desc.get.call(this);
81
+ };
82
+ }
83
+ if (kind === 1 /* ACCESSOR */ || kind === 4 /* SETTER */) {
84
+ set = function (v) {
85
+ desc.set.call(this, v);
86
+ };
87
+ }
81
88
  }
82
- if (kind === 1 /* ACCESSOR */ || kind === 4 /* SETTER */) {
83
- set = function (v) {
84
- desc.set.call(this, v);
85
- };
89
+ ctx.access = get && set ? {
90
+ get: get,
91
+ set: set
92
+ } : get ? {
93
+ get: get
94
+ } : {
95
+ set: set
96
+ };
97
+ try {
98
+ return dec(value, ctx);
99
+ } finally {
100
+ decoratorFinishedRef.v = true;
86
101
  }
87
102
  }
88
- ctx.access = get && set ? {
89
- get: get,
90
- set: set
91
- } : get ? {
92
- get: get
93
- } : {
94
- set: set
95
- };
96
- try {
97
- return dec(value, ctx);
98
- } finally {
99
- decoratorFinishedRef.v = true;
100
- }
101
- }
102
- function assertNotFinished(decoratorFinishedRef, fnName) {
103
- if (decoratorFinishedRef.v) {
104
- throw new Error("attempted to call " + fnName + " after decoration was finished");
105
- }
106
- }
107
- function assertCallable(fn, hint) {
108
- if (typeof fn !== "function") {
109
- throw new TypeError(hint + " must be a function");
110
- }
111
- }
112
- function assertValidReturnValue(kind, value) {
113
- var type = typeof value;
114
- if (kind === 1 /* ACCESSOR */) {
115
- if (type !== "object" || value === null) {
116
- throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
117
- }
118
- if (value.get !== undefined) {
119
- assertCallable(value.get, "accessor.get");
103
+ function assertNotFinished(decoratorFinishedRef, fnName) {
104
+ if (decoratorFinishedRef.v) {
105
+ throw new Error("attempted to call " + fnName + " after decoration was finished");
120
106
  }
121
- if (value.set !== undefined) {
122
- assertCallable(value.set, "accessor.set");
123
- }
124
- if (value.init !== undefined) {
125
- assertCallable(value.init, "accessor.init");
126
- }
127
- } else if (type !== "function") {
128
- var hint;
129
- if (kind === 0 /* FIELD */) {
130
- hint = "field";
131
- } else if (kind === 10 /* CLASS */) {
132
- hint = "class";
133
- } else {
134
- hint = "method";
135
- }
136
- throw new TypeError(hint + " decorators must return a function or void 0");
137
107
  }
138
- }
139
- function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers) {
140
- var decs = decInfo[0];
141
- var desc, init, value;
142
- if (isPrivate) {
143
- if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) {
144
- desc = {
145
- get: decInfo[3],
146
- set: decInfo[4]
147
- };
148
- } else if (kind === 3 /* GETTER */) {
149
- desc = {
150
- get: decInfo[3]
151
- };
152
- } else if (kind === 4 /* SETTER */) {
153
- desc = {
154
- set: decInfo[3]
155
- };
156
- } else {
157
- desc = {
158
- value: decInfo[3]
159
- };
108
+ function assertCallable(fn, hint) {
109
+ if (typeof fn !== "function") {
110
+ throw new TypeError(hint + " must be a function");
160
111
  }
161
- } else if (kind !== 0 /* FIELD */) {
162
- desc = Object.getOwnPropertyDescriptor(base, name);
163
112
  }
164
- if (kind === 1 /* ACCESSOR */) {
165
- value = {
166
- get: desc.get,
167
- set: desc.set
168
- };
169
- } else if (kind === 2 /* METHOD */) {
170
- value = desc.value;
171
- } else if (kind === 3 /* GETTER */) {
172
- value = desc.get;
173
- } else if (kind === 4 /* SETTER */) {
174
- value = desc.set;
175
- }
176
- var newValue, get, set;
177
- if (typeof decs === "function") {
178
- newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, value);
179
- if (newValue !== void 0) {
180
- assertValidReturnValue(kind, newValue);
113
+ function assertValidReturnValue(kind, value) {
114
+ var type = typeof value;
115
+ if (kind === 1 /* ACCESSOR */) {
116
+ if (type !== "object" || value === null) {
117
+ throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
118
+ }
119
+ if (value.get !== undefined) {
120
+ assertCallable(value.get, "accessor.get");
121
+ }
122
+ if (value.set !== undefined) {
123
+ assertCallable(value.set, "accessor.set");
124
+ }
125
+ if (value.init !== undefined) {
126
+ assertCallable(value.init, "accessor.init");
127
+ }
128
+ } else if (type !== "function") {
129
+ var hint;
181
130
  if (kind === 0 /* FIELD */) {
182
- init = newValue;
183
- } else if (kind === 1 /* ACCESSOR */) {
184
- init = newValue.init;
185
- get = newValue.get || value.get;
186
- set = newValue.set || value.set;
187
- value = {
188
- get: get,
189
- set: set
131
+ hint = "field";
132
+ } else if (kind === 10 /* CLASS */) {
133
+ hint = "class";
134
+ } else {
135
+ hint = "method";
136
+ }
137
+ throw new TypeError(hint + " decorators must return a function or void 0");
138
+ }
139
+ }
140
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers) {
141
+ var decs = decInfo[0];
142
+ var desc, init, value;
143
+ if (isPrivate) {
144
+ if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) {
145
+ desc = {
146
+ get: decInfo[3],
147
+ set: decInfo[4]
148
+ };
149
+ } else if (kind === 3 /* GETTER */) {
150
+ desc = {
151
+ get: decInfo[3]
152
+ };
153
+ } else if (kind === 4 /* SETTER */) {
154
+ desc = {
155
+ set: decInfo[3]
190
156
  };
191
157
  } else {
192
- value = newValue;
158
+ desc = {
159
+ value: decInfo[3]
160
+ };
193
161
  }
162
+ } else if (kind !== 0 /* FIELD */) {
163
+ desc = Object.getOwnPropertyDescriptor(base, name);
164
+ }
165
+ if (kind === 1 /* ACCESSOR */) {
166
+ value = {
167
+ get: desc.get,
168
+ set: desc.set
169
+ };
170
+ } else if (kind === 2 /* METHOD */) {
171
+ value = desc.value;
172
+ } else if (kind === 3 /* GETTER */) {
173
+ value = desc.get;
174
+ } else if (kind === 4 /* SETTER */) {
175
+ value = desc.set;
194
176
  }
195
- } else {
196
- for (var i = decs.length - 1; i >= 0; i--) {
197
- var dec = decs[i];
198
- newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, value);
177
+ var newValue, get, set;
178
+ if (typeof decs === "function") {
179
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, value);
199
180
  if (newValue !== void 0) {
200
181
  assertValidReturnValue(kind, newValue);
201
- var newInit;
202
182
  if (kind === 0 /* FIELD */) {
203
- newInit = newValue;
183
+ init = newValue;
204
184
  } else if (kind === 1 /* ACCESSOR */) {
205
- newInit = newValue.init;
185
+ init = newValue.init;
206
186
  get = newValue.get || value.get;
207
187
  set = newValue.set || value.set;
208
188
  value = {
@@ -212,169 +192,189 @@ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, ini
212
192
  } else {
213
193
  value = newValue;
214
194
  }
215
- if (newInit !== void 0) {
216
- if (init === void 0) {
217
- init = newInit;
218
- } else if (typeof init === "function") {
219
- init = [init, newInit];
195
+ }
196
+ } else {
197
+ for (var i = decs.length - 1; i >= 0; i--) {
198
+ var dec = decs[i];
199
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, value);
200
+ if (newValue !== void 0) {
201
+ assertValidReturnValue(kind, newValue);
202
+ var newInit;
203
+ if (kind === 0 /* FIELD */) {
204
+ newInit = newValue;
205
+ } else if (kind === 1 /* ACCESSOR */) {
206
+ newInit = newValue.init;
207
+ get = newValue.get || value.get;
208
+ set = newValue.set || value.set;
209
+ value = {
210
+ get: get,
211
+ set: set
212
+ };
220
213
  } else {
221
- init.push(newInit);
214
+ value = newValue;
215
+ }
216
+ if (newInit !== void 0) {
217
+ if (init === void 0) {
218
+ init = newInit;
219
+ } else if (typeof init === "function") {
220
+ init = [init, newInit];
221
+ } else {
222
+ init.push(newInit);
223
+ }
222
224
  }
223
225
  }
224
226
  }
225
227
  }
226
- }
227
- if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) {
228
- if (init === void 0) {
229
- // If the initializer was void 0, sub in a dummy initializer
230
- init = function (instance, init) {
231
- return init;
232
- };
233
- } else if (typeof init !== "function") {
234
- var ownInitializers = init;
235
- init = function (instance, init) {
236
- var value = init;
237
- for (var i = 0; i < ownInitializers.length; i++) {
238
- value = ownInitializers[i].call(instance, value);
239
- }
240
- return value;
241
- };
242
- } else {
243
- var originalInitializer = init;
244
- init = function (instance, init) {
245
- return originalInitializer.call(instance, init);
246
- };
247
- }
248
- ret.push(init);
249
- }
250
- if (kind !== 0 /* FIELD */) {
251
- if (kind === 1 /* ACCESSOR */) {
252
- desc.get = value.get;
253
- desc.set = value.set;
254
- } else if (kind === 2 /* METHOD */) {
255
- desc.value = value;
256
- } else if (kind === 3 /* GETTER */) {
257
- desc.get = value;
258
- } else if (kind === 4 /* SETTER */) {
259
- desc.set = value;
228
+ if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) {
229
+ if (init === void 0) {
230
+ // If the initializer was void 0, sub in a dummy initializer
231
+ init = function (instance, init) {
232
+ return init;
233
+ };
234
+ } else if (typeof init !== "function") {
235
+ var ownInitializers = init;
236
+ init = function (instance, init) {
237
+ var value = init;
238
+ for (var i = 0; i < ownInitializers.length; i++) {
239
+ value = ownInitializers[i].call(instance, value);
240
+ }
241
+ return value;
242
+ };
243
+ } else {
244
+ var originalInitializer = init;
245
+ init = function (instance, init) {
246
+ return originalInitializer.call(instance, init);
247
+ };
248
+ }
249
+ ret.push(init);
260
250
  }
261
- if (isPrivate) {
251
+ if (kind !== 0 /* FIELD */) {
262
252
  if (kind === 1 /* ACCESSOR */) {
263
- ret.push(function (instance, args) {
264
- return value.get.call(instance, args);
265
- });
266
- ret.push(function (instance, args) {
267
- return value.set.call(instance, args);
268
- });
253
+ desc.get = value.get;
254
+ desc.set = value.set;
269
255
  } else if (kind === 2 /* METHOD */) {
270
- ret.push(value);
256
+ desc.value = value;
257
+ } else if (kind === 3 /* GETTER */) {
258
+ desc.get = value;
259
+ } else if (kind === 4 /* SETTER */) {
260
+ desc.set = value;
261
+ }
262
+ if (isPrivate) {
263
+ if (kind === 1 /* ACCESSOR */) {
264
+ ret.push(function (instance, args) {
265
+ return value.get.call(instance, args);
266
+ });
267
+ ret.push(function (instance, args) {
268
+ return value.set.call(instance, args);
269
+ });
270
+ } else if (kind === 2 /* METHOD */) {
271
+ ret.push(value);
272
+ } else {
273
+ ret.push(function (instance, args) {
274
+ return value.call(instance, args);
275
+ });
276
+ }
271
277
  } else {
272
- ret.push(function (instance, args) {
273
- return value.call(instance, args);
274
- });
278
+ Object.defineProperty(base, name, desc);
275
279
  }
276
- } else {
277
- Object.defineProperty(base, name, desc);
278
280
  }
279
281
  }
280
- }
281
- function applyMemberDecs(Class, decInfos) {
282
- var ret = [];
283
- var protoInitializers;
284
- var staticInitializers;
285
- var existingProtoNonFields = new Map();
286
- var existingStaticNonFields = new Map();
287
- for (var i = 0; i < decInfos.length; i++) {
288
- var decInfo = decInfos[i];
289
-
290
- // skip computed property names
291
- if (!Array.isArray(decInfo)) continue;
292
- var kind = decInfo[1];
293
- var name = decInfo[2];
294
- var isPrivate = decInfo.length > 3;
295
- var isStatic = kind >= 5; /* STATIC */
296
- var base;
297
- var initializers;
298
- if (isStatic) {
299
- base = Class;
300
- kind = kind - 5 /* STATIC */;
301
- // initialize staticInitializers when we see a non-field static member
302
- if (kind !== 0 /* FIELD */) {
303
- staticInitializers = staticInitializers || [];
304
- initializers = staticInitializers;
305
- }
306
- } else {
307
- base = Class.prototype;
308
- // initialize protoInitializers when we see a non-field member
309
- if (kind !== 0 /* FIELD */) {
310
- protoInitializers = protoInitializers || [];
311
- initializers = protoInitializers;
312
- }
313
- }
314
- if (kind !== 0 /* FIELD */ && !isPrivate) {
315
- var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
316
- var existingKind = existingNonFields.get(name) || 0;
317
- if (existingKind === true || existingKind === 3 /* GETTER */ && kind !== 4 /* SETTER */ || existingKind === 4 /* SETTER */ && kind !== 3 /* GETTER */) {
318
- throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
319
- } else if (!existingKind && kind > 2 /* METHOD */) {
320
- existingNonFields.set(name, kind);
282
+ function applyMemberDecs(Class, decInfos) {
283
+ var ret = [];
284
+ var protoInitializers;
285
+ var staticInitializers;
286
+ var existingProtoNonFields = new Map();
287
+ var existingStaticNonFields = new Map();
288
+ for (var i = 0; i < decInfos.length; i++) {
289
+ var decInfo = decInfos[i];
290
+
291
+ // skip computed property names
292
+ if (!Array.isArray(decInfo)) continue;
293
+ var kind = decInfo[1];
294
+ var name = decInfo[2];
295
+ var isPrivate = decInfo.length > 3;
296
+ var isStatic = kind >= 5; /* STATIC */
297
+ var base;
298
+ var initializers;
299
+ if (isStatic) {
300
+ base = Class;
301
+ kind = kind - 5 /* STATIC */;
302
+ // initialize staticInitializers when we see a non-field static member
303
+ if (kind !== 0 /* FIELD */) {
304
+ staticInitializers = staticInitializers || [];
305
+ initializers = staticInitializers;
306
+ }
321
307
  } else {
322
- existingNonFields.set(name, true);
308
+ base = Class.prototype;
309
+ // initialize protoInitializers when we see a non-field member
310
+ if (kind !== 0 /* FIELD */) {
311
+ protoInitializers = protoInitializers || [];
312
+ initializers = protoInitializers;
313
+ }
314
+ }
315
+ if (kind !== 0 /* FIELD */ && !isPrivate) {
316
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
317
+ var existingKind = existingNonFields.get(name) || 0;
318
+ if (existingKind === true || existingKind === 3 /* GETTER */ && kind !== 4 /* SETTER */ || existingKind === 4 /* SETTER */ && kind !== 3 /* GETTER */) {
319
+ throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
320
+ } else if (!existingKind && kind > 2 /* METHOD */) {
321
+ existingNonFields.set(name, kind);
322
+ } else {
323
+ existingNonFields.set(name, true);
324
+ }
323
325
  }
326
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers);
324
327
  }
325
- applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers);
328
+ pushInitializers(ret, protoInitializers);
329
+ pushInitializers(ret, staticInitializers);
330
+ return ret;
326
331
  }
327
- pushInitializers(ret, protoInitializers);
328
- pushInitializers(ret, staticInitializers);
329
- return ret;
330
- }
331
- function pushInitializers(ret, initializers) {
332
- if (initializers) {
333
- ret.push(function (instance) {
334
- for (var i = 0; i < initializers.length; i++) {
335
- initializers[i].call(instance);
336
- }
337
- return instance;
338
- });
332
+ function pushInitializers(ret, initializers) {
333
+ if (initializers) {
334
+ ret.push(function (instance) {
335
+ for (var i = 0; i < initializers.length; i++) {
336
+ initializers[i].call(instance);
337
+ }
338
+ return instance;
339
+ });
340
+ }
339
341
  }
340
- }
341
- function applyClassDecs(targetClass, classDecs) {
342
- if (classDecs.length > 0) {
343
- var initializers = [];
344
- var newClass = targetClass;
345
- var name = targetClass.name;
346
- for (var i = classDecs.length - 1; i >= 0; i--) {
347
- var decoratorFinishedRef = {
348
- v: false
349
- };
350
- try {
351
- var nextNewClass = classDecs[i](newClass, {
352
- kind: "class",
353
- name: name,
354
- addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef)
355
- });
356
- } finally {
357
- decoratorFinishedRef.v = true;
358
- }
359
- if (nextNewClass !== undefined) {
360
- assertValidReturnValue(10 /* CLASS */, nextNewClass);
361
- newClass = nextNewClass;
342
+ function applyClassDecs(targetClass, classDecs) {
343
+ if (classDecs.length > 0) {
344
+ var initializers = [];
345
+ var newClass = targetClass;
346
+ var name = targetClass.name;
347
+ for (var i = classDecs.length - 1; i >= 0; i--) {
348
+ var decoratorFinishedRef = {
349
+ v: false
350
+ };
351
+ try {
352
+ var nextNewClass = classDecs[i](newClass, {
353
+ kind: "class",
354
+ name: name,
355
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef)
356
+ });
357
+ } finally {
358
+ decoratorFinishedRef.v = true;
359
+ }
360
+ if (nextNewClass !== undefined) {
361
+ assertValidReturnValue(10 /* CLASS */, nextNewClass);
362
+ newClass = nextNewClass;
363
+ }
362
364
  }
365
+ return [newClass, function () {
366
+ for (var i = 0; i < initializers.length; i++) {
367
+ initializers[i].call(newClass);
368
+ }
369
+ }];
363
370
  }
364
- return [newClass, function () {
365
- for (var i = 0; i < initializers.length; i++) {
366
- initializers[i].call(newClass);
367
- }
368
- }];
371
+ // The transformer will not emit assignment when there are no class decorators,
372
+ // so we don't have to return an empty array here.
369
373
  }
370
- // The transformer will not emit assignment when there are no class decorators,
371
- // so we don't have to return an empty array here.
372
- }
373
374
 
374
- /**
375
+ /**
375
376
  Basic usage:
376
-
377
- applyDecs(
377
+ applyDecs(
378
378
  Class,
379
379
  [
380
380
  // member decorators
@@ -391,60 +391,43 @@ function applyClassDecs(targetClass, classDecs) {
391
391
  ]
392
392
  )
393
393
  ```
394
-
395
- Fully transpiled example:
396
-
397
- ```js
394
+ Fully transpiled example:
395
+ ```js
398
396
  @dec
399
397
  class Class {
400
398
  @dec
401
399
  a = 123;
402
-
403
- @dec
400
+ @dec
404
401
  #a = 123;
405
-
406
- @dec
402
+ @dec
407
403
  @dec2
408
404
  accessor b = 123;
409
-
410
- @dec
405
+ @dec
411
406
  accessor #b = 123;
412
-
413
- @dec
407
+ @dec
414
408
  c() { console.log('c'); }
415
-
416
- @dec
409
+ @dec
417
410
  #c() { console.log('privC'); }
418
-
419
- @dec
411
+ @dec
420
412
  get d() { console.log('d'); }
421
-
422
- @dec
413
+ @dec
423
414
  get #d() { console.log('privD'); }
424
-
425
- @dec
415
+ @dec
426
416
  set e(v) { console.log('e'); }
427
-
428
- @dec
417
+ @dec
429
418
  set #e(v) { console.log('privE'); }
430
419
  }
431
-
432
-
433
- // becomes
420
+ // becomes
434
421
  let initializeInstance;
435
422
  let initializeClass;
436
-
437
- let initA;
423
+ let initA;
438
424
  let initPrivA;
439
-
440
- let initB;
425
+ let initB;
441
426
  let initPrivB, getPrivB, setPrivB;
442
-
443
- let privC;
427
+ let privC;
444
428
  let privD;
445
429
  let privE;
446
-
447
- let Class;
430
+ let Class;
448
431
  class _Class {
449
432
  static {
450
433
  let ret = applyDecs(
@@ -465,63 +448,47 @@ function applyClassDecs(targetClass, classDecs) {
465
448
  dec
466
449
  ]
467
450
  )
468
-
469
- initA = ret[0];
470
-
471
- initPrivA = ret[1];
472
-
473
- initB = ret[2];
474
-
475
- initPrivB = ret[3];
451
+ initA = ret[0];
452
+ initPrivA = ret[1];
453
+ initB = ret[2];
454
+ initPrivB = ret[3];
476
455
  getPrivB = ret[4];
477
456
  setPrivB = ret[5];
478
-
479
- privC = ret[6];
480
-
481
- privD = ret[7];
482
-
483
- privE = ret[8];
484
-
485
- initializeInstance = ret[9];
486
-
487
- Class = ret[10]
488
-
489
- initializeClass = ret[11];
457
+ privC = ret[6];
458
+ privD = ret[7];
459
+ privE = ret[8];
460
+ initializeInstance = ret[9];
461
+ Class = ret[10]
462
+ initializeClass = ret[11];
490
463
  }
491
-
492
- a = (initializeInstance(this), initA(this, 123));
493
-
494
- #a = initPrivA(this, 123);
495
-
496
- #bData = initB(this, 123);
464
+ a = (initializeInstance(this), initA(this, 123));
465
+ #a = initPrivA(this, 123);
466
+ #bData = initB(this, 123);
497
467
  get b() { return this.#bData }
498
468
  set b(v) { this.#bData = v }
499
-
500
- #privBData = initPrivB(this, 123);
469
+ #privBData = initPrivB(this, 123);
501
470
  get #b() { return getPrivB(this); }
502
471
  set #b(v) { setPrivB(this, v); }
503
-
504
- c() { console.log('c'); }
505
-
506
- #c(...args) { return privC(this, ...args) }
507
-
508
- get d() { console.log('d'); }
509
-
510
- get #d() { return privD(this); }
511
-
512
- set e(v) { console.log('e'); }
513
-
514
- set #e(v) { privE(this, v); }
472
+ c() { console.log('c'); }
473
+ #c(...args) { return privC(this, ...args) }
474
+ get d() { console.log('d'); }
475
+ get #d() { return privD(this); }
476
+ set e(v) { console.log('e'); }
477
+ set #e(v) { privE(this, v); }
515
478
  }
516
-
517
- initializeClass(Class);
518
- */
519
- export default function applyDecs2203R(targetClass, memberDecs, classDecs) {
520
- return {
521
- e: applyMemberDecs(targetClass, memberDecs),
522
- // Lazily apply class decorations so that member init locals can be properly bound.
523
- get c() {
524
- return applyClassDecs(targetClass, classDecs);
525
- }
479
+ initializeClass(Class);
480
+ */
481
+
482
+ return function applyDecs2203R(targetClass, memberDecs, classDecs) {
483
+ return {
484
+ e: applyMemberDecs(targetClass, memberDecs),
485
+ // Lazily apply class decorations so that member init locals can be properly bound.
486
+ get c() {
487
+ return applyClassDecs(targetClass, classDecs);
488
+ }
489
+ };
526
490
  };
491
+ }
492
+ export default function applyDecs2203R(targetClass, memberDecs, classDecs) {
493
+ return (applyDecs2203R = applyDecs2203RFactory())(targetClass, memberDecs, classDecs);
527
494
  }