@jsenv/core 38.3.10 → 38.4.0
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.
- package/README.md +17 -18
- package/dist/babel_helpers/AsyncGenerator/AsyncGenerator.js +3 -3
- package/dist/babel_helpers/AwaitValue/AwaitValue.js +2 -2
- package/dist/babel_helpers/{overloadYield/overloadYield.js → OverloadYield/OverloadYield.js} +1 -1
- package/dist/babel_helpers/applyDecoratedDescriptor/applyDecoratedDescriptor.js +23 -14
- package/dist/babel_helpers/applyDecs/applyDecs.js +32 -21
- package/dist/babel_helpers/applyDecs2203/applyDecs2203.js +549 -549
- package/dist/babel_helpers/applyDecs2203R/applyDecs2203R.js +27 -15
- package/dist/babel_helpers/applyDecs2301/applyDecs2301.js +29 -18
- package/dist/babel_helpers/applyDecs2305/applyDecs2305.js +362 -541
- package/dist/babel_helpers/arrayLikeToArray/arrayLikeToArray.js +4 -4
- package/dist/babel_helpers/arrayWithHoles/arrayWithHoles.js +2 -2
- package/dist/babel_helpers/arrayWithoutHoles/arrayWithoutHoles.js +3 -3
- package/dist/babel_helpers/assertThisInitialized/assertThisInitialized.js +5 -3
- package/dist/babel_helpers/asyncGeneratorDelegate/asyncGeneratorDelegate.js +2 -2
- package/dist/babel_helpers/asyncIterator/asyncIterator.js +1 -1
- package/dist/babel_helpers/asyncToGenerator/asyncToGenerator.js +17 -17
- package/dist/babel_helpers/awaitAsyncGenerator/awaitAsyncGenerator.js +2 -2
- package/dist/babel_helpers/callSuper/callSuper.js +25 -0
- package/dist/babel_helpers/checkInRHS/checkInRHS.js +10 -8
- package/dist/babel_helpers/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js +9 -6
- package/dist/babel_helpers/classApplyDescriptorGet/classApplyDescriptorGet.js +2 -2
- package/dist/babel_helpers/classApplyDescriptorSet/classApplyDescriptorSet.js +3 -3
- package/dist/babel_helpers/classCallCheck/classCallCheck.js +1 -1
- package/dist/babel_helpers/classCheckPrivateStaticAccess/classCheckPrivateStaticAccess.js +5 -2
- package/dist/babel_helpers/classCheckPrivateStaticFieldDescriptor/classCheckPrivateStaticFieldDescriptor.js +7 -2
- package/dist/babel_helpers/classExtractFieldDescriptor/classExtractFieldDescriptor.js +9 -3
- package/dist/babel_helpers/classNameTDZError/classNameTDZError.js +3 -1
- package/dist/babel_helpers/classPrivateFieldDestructureSet/classPrivateFieldDestructureSet.js +4 -4
- package/dist/babel_helpers/classPrivateFieldGet/classPrivateFieldGet.js +4 -4
- package/dist/babel_helpers/classPrivateFieldLooseBase/classPrivateFieldLooseBase.js +2 -2
- package/dist/babel_helpers/classPrivateFieldLooseKey/classPrivateFieldLooseKey.js +2 -2
- package/dist/babel_helpers/classPrivateFieldSet/classPrivateFieldSet.js +5 -5
- package/dist/babel_helpers/classPrivateMethodGet/classPrivateMethodGet.js +2 -2
- package/dist/babel_helpers/classPrivateMethodSet/classPrivateMethodSet.js +1 -1
- package/dist/babel_helpers/classStaticPrivateFieldSpecGet/classStaticPrivateFieldSpecGet.js +11 -7
- package/dist/babel_helpers/classStaticPrivateFieldSpecSet/classStaticPrivateFieldSpecSet.js +7 -7
- package/dist/babel_helpers/classStaticPrivateMethodGet/classStaticPrivateMethodGet.js +8 -4
- package/dist/babel_helpers/classStaticPrivateMethodSet/classStaticPrivateMethodSet.js +1 -1
- package/dist/babel_helpers/construct/construct.js +18 -14
- package/dist/babel_helpers/createClass/createClass.js +1 -1
- package/dist/babel_helpers/createForOfIteratorHelper/createForOfIteratorHelper.js +21 -20
- package/dist/babel_helpers/createForOfIteratorHelperLoose/createForOfIteratorHelperLoose.js +10 -9
- package/dist/babel_helpers/createRawReactElement/createRawReactElement.js +11 -11
- package/dist/babel_helpers/createSuper/createSuper.js +11 -11
- package/dist/babel_helpers/decorate/decorate.js +255 -170
- package/dist/babel_helpers/defaults/defaults.js +5 -5
- package/dist/babel_helpers/defineAccessor/defineAccessor.js +1 -1
- package/dist/babel_helpers/defineEnumerableProperties/defineEnumerableProperties.js +11 -11
- package/dist/babel_helpers/defineProperty/defineProperty.js +4 -4
- package/dist/babel_helpers/dispose/dispose.js +39 -39
- package/dist/babel_helpers/extends/extends.js +4 -4
- package/dist/babel_helpers/get/get.js +2 -2
- package/dist/babel_helpers/getPrototypeOf/getPrototypeOf.js +1 -1
- package/dist/babel_helpers/identity/identity.js +1 -1
- package/dist/babel_helpers/importDeferProxy/importDeferProxy.js +27 -27
- package/dist/babel_helpers/inherits/inherits.js +4 -4
- package/dist/babel_helpers/inheritsLoose/inheritsLoose.js +4 -4
- package/dist/babel_helpers/initializerDefineProperty/initializerDefineProperty.js +5 -3
- package/dist/babel_helpers/initializerWarningHelper/initializerWarningHelper.js +1 -1
- package/dist/babel_helpers/instanceof/instanceof.js +7 -3
- package/dist/babel_helpers/interopRequireDefault/interopRequireDefault.js +1 -1
- package/dist/babel_helpers/interopRequireWildcard/interopRequireWildcard.js +3 -1
- package/dist/babel_helpers/isNativeFunction/isNativeFunction.js +1 -1
- package/dist/babel_helpers/isNativeReflectConstruct/isNativeReflectConstruct.js +12 -14
- package/dist/babel_helpers/iterableToArray/iterableToArray.js +1 -1
- package/dist/babel_helpers/iterableToArrayLimit/iterableToArrayLimit.js +1 -1
- package/dist/babel_helpers/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +1 -1
- package/dist/babel_helpers/jsx/jsx.js +1 -1
- package/dist/babel_helpers/maybeArrayLike/maybeArrayLike.js +4 -4
- package/dist/babel_helpers/newArrowCheck/newArrowCheck.js +1 -1
- package/dist/babel_helpers/nonIterableRest/nonIterableRest.js +2 -2
- package/dist/babel_helpers/nonIterableSpread/nonIterableSpread.js +2 -2
- package/dist/babel_helpers/nullishReceiverError/nullishReceiverError.js +1 -1
- package/dist/babel_helpers/objectDestructuringEmpty/objectDestructuringEmpty.js +1 -1
- package/dist/babel_helpers/objectSpread/objectSpread.js +8 -8
- package/dist/babel_helpers/objectSpread2/objectSpread2.js +5 -3
- package/dist/babel_helpers/objectWithoutProperties/objectWithoutProperties.js +12 -12
- package/dist/babel_helpers/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +10 -10
- package/dist/babel_helpers/possibleConstructorReturn/possibleConstructorReturn.js +7 -5
- package/dist/babel_helpers/readOnlyError/readOnlyError.js +1 -1
- package/dist/babel_helpers/regeneratorRuntime/regeneratorRuntime.js +1 -1
- package/dist/babel_helpers/set/set.js +22 -19
- package/dist/babel_helpers/setFunctionName/setFunctionName.js +18 -0
- package/dist/babel_helpers/setPrototypeOf/setPrototypeOf.js +7 -6
- package/dist/babel_helpers/skipFirstGeneratorNext/skipFirstGeneratorNext.js +4 -4
- package/dist/babel_helpers/slicedToArray/slicedToArray.js +5 -5
- package/dist/babel_helpers/slicedToArrayLoose/slicedToArrayLoose.js +5 -5
- package/dist/babel_helpers/superPropBase/superPropBase.js +4 -4
- package/dist/babel_helpers/taggedTemplateLiteral/taggedTemplateLiteral.js +2 -2
- package/dist/babel_helpers/taggedTemplateLiteralLoose/taggedTemplateLiteralLoose.js +3 -3
- package/dist/babel_helpers/tdz/tdz.js +1 -1
- package/dist/babel_helpers/temporalRef/temporalRef.js +3 -3
- package/dist/babel_helpers/toArray/toArray.js +5 -5
- package/dist/babel_helpers/toConsumableArray/toConsumableArray.js +5 -5
- package/dist/babel_helpers/toPrimitive/toPrimitive.js +11 -7
- package/dist/babel_helpers/toPropertyKey/toPropertyKey.js +8 -4
- package/dist/babel_helpers/typeof/typeof.js +6 -5
- package/dist/babel_helpers/unsupportedIterableToArray/unsupportedIterableToArray.js +7 -7
- package/dist/babel_helpers/using/using.js +20 -20
- package/dist/babel_helpers/wrapAsyncGenerator/wrapAsyncGenerator.js +3 -3
- package/dist/babel_helpers/wrapNativeSuper/wrapNativeSuper.js +12 -12
- package/dist/babel_helpers/wrapRegExp/wrapRegExp.js +5 -3
- package/dist/babel_helpers/writeOnlyError/writeOnlyError.js +1 -1
- package/dist/js/ribbon.js +1 -1
- package/dist/js/ws.js +234 -146
- package/dist/jsenv_core.js +1365 -1211
- package/package.json +26 -22
- package/src/build/build.js +22 -14
- package/src/dev/start_dev_server.js +8 -21
- package/src/kitchen/errors.js +29 -24
- package/src/kitchen/kitchen.js +1 -1
- package/src/kitchen/url_graph/references.js +8 -0
- package/src/kitchen/url_graph/url_graph_report.js +5 -3
- package/src/plugins/plugins.js +2 -2
- package/src/plugins/protocol_file/jsenv_plugin_protocol_file.js +17 -7
- package/src/plugins/reference_analysis/js/jsenv_plugin_js_reference_analysis.js +10 -12
- package/src/plugins/ribbon/client/ribbon.js +1 -1
|
@@ -23,613 +23,613 @@
|
|
|
23
23
|
CLASS = 10; // only used in assertValidReturnValue
|
|
24
24
|
*/
|
|
25
25
|
function applyDecs2203Factory() {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
27
|
+
return function addInitializer(initializer) {
|
|
28
|
+
assertNotFinished(decoratorFinishedRef, "addInitializer");
|
|
29
|
+
assertCallable(initializer, "An initializer");
|
|
30
|
+
initializers.push(initializer);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function memberDec(
|
|
35
|
+
dec,
|
|
36
|
+
name,
|
|
37
|
+
desc,
|
|
38
|
+
initializers,
|
|
39
|
+
kind,
|
|
40
|
+
isStatic,
|
|
41
|
+
isPrivate,
|
|
42
|
+
value,
|
|
43
|
+
) {
|
|
44
|
+
var kindStr;
|
|
45
|
+
|
|
46
|
+
switch (kind) {
|
|
47
|
+
case 1 /* ACCESSOR */:
|
|
48
|
+
kindStr = "accessor";
|
|
49
|
+
break;
|
|
50
|
+
case 2 /* METHOD */:
|
|
51
|
+
kindStr = "method";
|
|
52
|
+
break;
|
|
53
|
+
case 3 /* GETTER */:
|
|
54
|
+
kindStr = "getter";
|
|
55
|
+
break;
|
|
56
|
+
case 4 /* SETTER */:
|
|
57
|
+
kindStr = "setter";
|
|
58
|
+
break;
|
|
59
|
+
default:
|
|
60
|
+
kindStr = "field";
|
|
32
61
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
name,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
|
|
63
|
+
var ctx = {
|
|
64
|
+
kind: kindStr,
|
|
65
|
+
name: isPrivate ? "#" + name : name,
|
|
66
|
+
static: isStatic,
|
|
67
|
+
private: isPrivate,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
var decoratorFinishedRef = { v: false };
|
|
71
|
+
|
|
72
|
+
if (kind !== 0 /* FIELD */) {
|
|
73
|
+
ctx.addInitializer = createAddInitializerMethod(
|
|
74
|
+
initializers,
|
|
75
|
+
decoratorFinishedRef,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
var get, set;
|
|
80
|
+
if (kind === 0 /* FIELD */) {
|
|
81
|
+
if (isPrivate) {
|
|
82
|
+
get = desc.get;
|
|
83
|
+
set = desc.set;
|
|
84
|
+
} else {
|
|
85
|
+
get = function () {
|
|
86
|
+
return this[name];
|
|
87
|
+
};
|
|
88
|
+
set = function (v) {
|
|
89
|
+
this[name] = v;
|
|
90
|
+
};
|
|
61
91
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
name: isPrivate ? "#" + name : name,
|
|
66
|
-
static: isStatic,
|
|
67
|
-
private: isPrivate,
|
|
92
|
+
} else if (kind === 2 /* METHOD */) {
|
|
93
|
+
get = function () {
|
|
94
|
+
return desc.value;
|
|
68
95
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (kind !== 0 /* FIELD */) {
|
|
73
|
-
ctx.addInitializer = createAddInitializerMethod(
|
|
74
|
-
initializers,
|
|
75
|
-
decoratorFinishedRef
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
var get, set;
|
|
80
|
-
if (kind === 0 /* FIELD */) {
|
|
81
|
-
if (isPrivate) {
|
|
82
|
-
get = desc.get;
|
|
83
|
-
set = desc.set;
|
|
84
|
-
} else {
|
|
85
|
-
get = function () {
|
|
86
|
-
return this[name];
|
|
87
|
-
};
|
|
88
|
-
set = function (v) {
|
|
89
|
-
this[name] = v;
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
} else if (kind === 2 /* METHOD */) {
|
|
96
|
+
} else {
|
|
97
|
+
// replace with values that will go through the final getter and setter
|
|
98
|
+
if (kind === 1 /* ACCESSOR */ || kind === 3 /* GETTER */) {
|
|
93
99
|
get = function () {
|
|
94
|
-
return desc.
|
|
100
|
+
return desc.get.call(this);
|
|
95
101
|
};
|
|
96
|
-
} else {
|
|
97
|
-
// replace with values that will go through the final getter and setter
|
|
98
|
-
if (kind === 1 /* ACCESSOR */ || kind === 3 /* GETTER */) {
|
|
99
|
-
get = function () {
|
|
100
|
-
return desc.get.call(this);
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (kind === 1 /* ACCESSOR */ || kind === 4 /* SETTER */) {
|
|
105
|
-
set = function (v) {
|
|
106
|
-
desc.set.call(this, v);
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
102
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
} finally {
|
|
116
|
-
decoratorFinishedRef.v = true;
|
|
103
|
+
|
|
104
|
+
if (kind === 1 /* ACCESSOR */ || kind === 4 /* SETTER */) {
|
|
105
|
+
set = function (v) {
|
|
106
|
+
desc.set.call(this, v);
|
|
107
|
+
};
|
|
117
108
|
}
|
|
118
109
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
110
|
+
ctx.access =
|
|
111
|
+
get && set ? { get: get, set: set } : get ? { get: get } : { set: set };
|
|
112
|
+
|
|
113
|
+
try {
|
|
114
|
+
return dec(value, ctx);
|
|
115
|
+
} finally {
|
|
116
|
+
decoratorFinishedRef.v = true;
|
|
126
117
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function assertNotFinished(decoratorFinishedRef, fnName) {
|
|
121
|
+
if (decoratorFinishedRef.v) {
|
|
122
|
+
throw new Error(
|
|
123
|
+
"attempted to call " + fnName + " after decoration was finished",
|
|
124
|
+
);
|
|
132
125
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (value.set !== undefined) {
|
|
147
|
-
assertCallable(value.set, "accessor.set");
|
|
148
|
-
}
|
|
149
|
-
if (value.init !== undefined) {
|
|
150
|
-
assertCallable(value.init, "accessor.init");
|
|
151
|
-
}
|
|
152
|
-
} else if (type !== "function") {
|
|
153
|
-
var hint;
|
|
154
|
-
if (kind === 0 /* FIELD */) {
|
|
155
|
-
hint = "field";
|
|
156
|
-
} else if (kind === 10 /* CLASS */) {
|
|
157
|
-
hint = "class";
|
|
158
|
-
} else {
|
|
159
|
-
hint = "method";
|
|
160
|
-
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function assertCallable(fn, hint) {
|
|
129
|
+
if (typeof fn !== "function") {
|
|
130
|
+
throw new TypeError(hint + " must be a function");
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function assertValidReturnValue(kind, value) {
|
|
135
|
+
var type = typeof value;
|
|
136
|
+
|
|
137
|
+
if (kind === 1 /* ACCESSOR */) {
|
|
138
|
+
if (type !== "object" || value === null) {
|
|
161
139
|
throw new TypeError(
|
|
162
|
-
|
|
140
|
+
"accessor decorators must return an object with get, set, or init properties or void 0",
|
|
163
141
|
);
|
|
164
142
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
function applyMemberDec(
|
|
168
|
-
ret,
|
|
169
|
-
base,
|
|
170
|
-
decInfo,
|
|
171
|
-
name,
|
|
172
|
-
kind,
|
|
173
|
-
isStatic,
|
|
174
|
-
isPrivate,
|
|
175
|
-
initializers
|
|
176
|
-
) {
|
|
177
|
-
var decs = decInfo[0];
|
|
178
|
-
|
|
179
|
-
var desc, init, value;
|
|
180
|
-
|
|
181
|
-
if (isPrivate) {
|
|
182
|
-
if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) {
|
|
183
|
-
desc = {
|
|
184
|
-
get: decInfo[3],
|
|
185
|
-
set: decInfo[4],
|
|
186
|
-
};
|
|
187
|
-
} else if (kind === 3 /* GETTER */) {
|
|
188
|
-
desc = {
|
|
189
|
-
get: decInfo[3],
|
|
190
|
-
};
|
|
191
|
-
} else if (kind === 4 /* SETTER */) {
|
|
192
|
-
desc = {
|
|
193
|
-
set: decInfo[3],
|
|
194
|
-
};
|
|
195
|
-
} else {
|
|
196
|
-
desc = {
|
|
197
|
-
value: decInfo[3],
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
} else if (kind !== 0 /* FIELD */) {
|
|
201
|
-
desc = Object.getOwnPropertyDescriptor(base, name);
|
|
143
|
+
if (value.get !== undefined) {
|
|
144
|
+
assertCallable(value.get, "accessor.get");
|
|
202
145
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
146
|
+
if (value.set !== undefined) {
|
|
147
|
+
assertCallable(value.set, "accessor.set");
|
|
148
|
+
}
|
|
149
|
+
if (value.init !== undefined) {
|
|
150
|
+
assertCallable(value.init, "accessor.init");
|
|
151
|
+
}
|
|
152
|
+
} else if (type !== "function") {
|
|
153
|
+
var hint;
|
|
154
|
+
if (kind === 0 /* FIELD */) {
|
|
155
|
+
hint = "field";
|
|
156
|
+
} else if (kind === 10 /* CLASS */) {
|
|
157
|
+
hint = "class";
|
|
158
|
+
} else {
|
|
159
|
+
hint = "method";
|
|
160
|
+
}
|
|
161
|
+
throw new TypeError(
|
|
162
|
+
hint + " decorators must return a function or void 0",
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function applyMemberDec(
|
|
168
|
+
ret,
|
|
169
|
+
base,
|
|
170
|
+
decInfo,
|
|
171
|
+
name,
|
|
172
|
+
kind,
|
|
173
|
+
isStatic,
|
|
174
|
+
isPrivate,
|
|
175
|
+
initializers,
|
|
176
|
+
) {
|
|
177
|
+
var decs = decInfo[0];
|
|
178
|
+
|
|
179
|
+
var desc, init, value;
|
|
180
|
+
|
|
181
|
+
if (isPrivate) {
|
|
182
|
+
if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) {
|
|
183
|
+
desc = {
|
|
184
|
+
get: decInfo[3],
|
|
185
|
+
set: decInfo[4],
|
|
208
186
|
};
|
|
209
|
-
} else if (kind === 2 /* METHOD */) {
|
|
210
|
-
value = desc.value;
|
|
211
187
|
} else if (kind === 3 /* GETTER */) {
|
|
212
|
-
|
|
188
|
+
desc = {
|
|
189
|
+
get: decInfo[3],
|
|
190
|
+
};
|
|
213
191
|
} else if (kind === 4 /* SETTER */) {
|
|
214
|
-
|
|
192
|
+
desc = {
|
|
193
|
+
set: decInfo[3],
|
|
194
|
+
};
|
|
195
|
+
} else {
|
|
196
|
+
desc = {
|
|
197
|
+
value: decInfo[3],
|
|
198
|
+
};
|
|
215
199
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
200
|
+
} else if (kind !== 0 /* FIELD */) {
|
|
201
|
+
desc = Object.getOwnPropertyDescriptor(base, name);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (kind === 1 /* ACCESSOR */) {
|
|
205
|
+
value = {
|
|
206
|
+
get: desc.get,
|
|
207
|
+
set: desc.set,
|
|
208
|
+
};
|
|
209
|
+
} else if (kind === 2 /* METHOD */) {
|
|
210
|
+
value = desc.value;
|
|
211
|
+
} else if (kind === 3 /* GETTER */) {
|
|
212
|
+
value = desc.get;
|
|
213
|
+
} else if (kind === 4 /* SETTER */) {
|
|
214
|
+
value = desc.set;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
var newValue, get, set;
|
|
218
|
+
|
|
219
|
+
if (typeof decs === "function") {
|
|
220
|
+
newValue = memberDec(
|
|
221
|
+
decs,
|
|
222
|
+
name,
|
|
223
|
+
desc,
|
|
224
|
+
initializers,
|
|
225
|
+
kind,
|
|
226
|
+
isStatic,
|
|
227
|
+
isPrivate,
|
|
228
|
+
value,
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
if (newValue !== void 0) {
|
|
232
|
+
assertValidReturnValue(kind, newValue);
|
|
233
|
+
|
|
234
|
+
if (kind === 0 /* FIELD */) {
|
|
235
|
+
init = newValue;
|
|
236
|
+
} else if (kind === 1 /* ACCESSOR */) {
|
|
237
|
+
init = newValue.init;
|
|
238
|
+
get = newValue.get || value.get;
|
|
239
|
+
set = newValue.set || value.set;
|
|
240
|
+
|
|
241
|
+
value = { get: get, set: set };
|
|
242
|
+
} else {
|
|
243
|
+
value = newValue;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
} else {
|
|
247
|
+
for (var i = decs.length - 1; i >= 0; i--) {
|
|
248
|
+
var dec = decs[i];
|
|
249
|
+
|
|
220
250
|
newValue = memberDec(
|
|
221
|
-
|
|
251
|
+
dec,
|
|
222
252
|
name,
|
|
223
253
|
desc,
|
|
224
254
|
initializers,
|
|
225
255
|
kind,
|
|
226
256
|
isStatic,
|
|
227
257
|
isPrivate,
|
|
228
|
-
value
|
|
258
|
+
value,
|
|
229
259
|
);
|
|
230
|
-
|
|
260
|
+
|
|
231
261
|
if (newValue !== void 0) {
|
|
232
262
|
assertValidReturnValue(kind, newValue);
|
|
233
|
-
|
|
263
|
+
var newInit;
|
|
264
|
+
|
|
234
265
|
if (kind === 0 /* FIELD */) {
|
|
235
|
-
|
|
266
|
+
newInit = newValue;
|
|
236
267
|
} else if (kind === 1 /* ACCESSOR */) {
|
|
237
|
-
|
|
268
|
+
newInit = newValue.init;
|
|
238
269
|
get = newValue.get || value.get;
|
|
239
270
|
set = newValue.set || value.set;
|
|
240
|
-
|
|
271
|
+
|
|
241
272
|
value = { get: get, set: set };
|
|
242
273
|
} else {
|
|
243
274
|
value = newValue;
|
|
244
275
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
dec,
|
|
252
|
-
name,
|
|
253
|
-
desc,
|
|
254
|
-
initializers,
|
|
255
|
-
kind,
|
|
256
|
-
isStatic,
|
|
257
|
-
isPrivate,
|
|
258
|
-
value
|
|
259
|
-
);
|
|
260
|
-
|
|
261
|
-
if (newValue !== void 0) {
|
|
262
|
-
assertValidReturnValue(kind, newValue);
|
|
263
|
-
var newInit;
|
|
264
|
-
|
|
265
|
-
if (kind === 0 /* FIELD */) {
|
|
266
|
-
newInit = newValue;
|
|
267
|
-
} else if (kind === 1 /* ACCESSOR */) {
|
|
268
|
-
newInit = newValue.init;
|
|
269
|
-
get = newValue.get || value.get;
|
|
270
|
-
set = newValue.set || value.set;
|
|
271
|
-
|
|
272
|
-
value = { get: get, set: set };
|
|
276
|
+
|
|
277
|
+
if (newInit !== void 0) {
|
|
278
|
+
if (init === void 0) {
|
|
279
|
+
init = newInit;
|
|
280
|
+
} else if (typeof init === "function") {
|
|
281
|
+
init = [init, newInit];
|
|
273
282
|
} else {
|
|
274
|
-
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if (newInit !== void 0) {
|
|
278
|
-
if (init === void 0) {
|
|
279
|
-
init = newInit;
|
|
280
|
-
} else if (typeof init === "function") {
|
|
281
|
-
init = [init, newInit];
|
|
282
|
-
} else {
|
|
283
|
-
init.push(newInit);
|
|
284
|
-
}
|
|
283
|
+
init.push(newInit);
|
|
285
284
|
}
|
|
286
285
|
}
|
|
287
286
|
}
|
|
288
287
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (kind === 0 /* FIELD */ || kind === 1 /* ACCESSOR */) {
|
|
291
|
+
if (init === void 0) {
|
|
292
|
+
// If the initializer was void 0, sub in a dummy initializer
|
|
293
|
+
init = function (instance, init) {
|
|
294
|
+
return init;
|
|
295
|
+
};
|
|
296
|
+
} else if (typeof init !== "function") {
|
|
297
|
+
var ownInitializers = init;
|
|
298
|
+
|
|
299
|
+
init = function (instance, init) {
|
|
300
|
+
var value = init;
|
|
301
|
+
|
|
302
|
+
for (var i = 0; i < ownInitializers.length; i++) {
|
|
303
|
+
value = ownInitializers[i].call(instance, value);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return value;
|
|
307
|
+
};
|
|
308
|
+
} else {
|
|
309
|
+
var originalInitializer = init;
|
|
310
|
+
|
|
311
|
+
init = function (instance, init) {
|
|
312
|
+
return originalInitializer.call(instance, init);
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
ret.push(init);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (kind !== 0 /* FIELD */) {
|
|
320
|
+
if (kind === 1 /* ACCESSOR */) {
|
|
321
|
+
desc.get = value.get;
|
|
322
|
+
desc.set = value.set;
|
|
323
|
+
} else if (kind === 2 /* METHOD */) {
|
|
324
|
+
desc.value = value;
|
|
325
|
+
} else if (kind === 3 /* GETTER */) {
|
|
326
|
+
desc.get = value;
|
|
327
|
+
} else if (kind === 4 /* SETTER */) {
|
|
328
|
+
desc.set = value;
|
|
317
329
|
}
|
|
318
|
-
|
|
319
|
-
if (
|
|
330
|
+
|
|
331
|
+
if (isPrivate) {
|
|
320
332
|
if (kind === 1 /* ACCESSOR */) {
|
|
321
|
-
|
|
322
|
-
|
|
333
|
+
ret.push(function (instance, args) {
|
|
334
|
+
return value.get.call(instance, args);
|
|
335
|
+
});
|
|
336
|
+
ret.push(function (instance, args) {
|
|
337
|
+
return value.set.call(instance, args);
|
|
338
|
+
});
|
|
323
339
|
} else if (kind === 2 /* METHOD */) {
|
|
324
|
-
|
|
325
|
-
} else if (kind === 3 /* GETTER */) {
|
|
326
|
-
desc.get = value;
|
|
327
|
-
} else if (kind === 4 /* SETTER */) {
|
|
328
|
-
desc.set = value;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
if (isPrivate) {
|
|
332
|
-
if (kind === 1 /* ACCESSOR */) {
|
|
333
|
-
ret.push(function (instance, args) {
|
|
334
|
-
return value.get.call(instance, args);
|
|
335
|
-
});
|
|
336
|
-
ret.push(function (instance, args) {
|
|
337
|
-
return value.set.call(instance, args);
|
|
338
|
-
});
|
|
339
|
-
} else if (kind === 2 /* METHOD */) {
|
|
340
|
-
ret.push(value);
|
|
341
|
-
} else {
|
|
342
|
-
ret.push(function (instance, args) {
|
|
343
|
-
return value.call(instance, args);
|
|
344
|
-
});
|
|
345
|
-
}
|
|
340
|
+
ret.push(value);
|
|
346
341
|
} else {
|
|
347
|
-
|
|
342
|
+
ret.push(function (instance, args) {
|
|
343
|
+
return value.call(instance, args);
|
|
344
|
+
});
|
|
348
345
|
}
|
|
346
|
+
} else {
|
|
347
|
+
Object.defineProperty(base, name, desc);
|
|
349
348
|
}
|
|
350
349
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
} else {
|
|
382
|
-
base = Class.prototype;
|
|
383
|
-
// initialize protoInitializers when we see a non-field member
|
|
384
|
-
if (kind !== 0 /* FIELD */) {
|
|
385
|
-
protoInitializers = protoInitializers || [];
|
|
386
|
-
initializers = protoInitializers;
|
|
387
|
-
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function applyMemberDecs(ret, Class, decInfos) {
|
|
353
|
+
var protoInitializers;
|
|
354
|
+
var staticInitializers;
|
|
355
|
+
|
|
356
|
+
var existingProtoNonFields = new Map();
|
|
357
|
+
var existingStaticNonFields = new Map();
|
|
358
|
+
|
|
359
|
+
for (var i = 0; i < decInfos.length; i++) {
|
|
360
|
+
var decInfo = decInfos[i];
|
|
361
|
+
|
|
362
|
+
// skip computed property names
|
|
363
|
+
if (!Array.isArray(decInfo)) continue;
|
|
364
|
+
|
|
365
|
+
var kind = decInfo[1];
|
|
366
|
+
var name = decInfo[2];
|
|
367
|
+
var isPrivate = decInfo.length > 3;
|
|
368
|
+
|
|
369
|
+
var isStatic = kind >= 5; /* STATIC */
|
|
370
|
+
var base;
|
|
371
|
+
var initializers;
|
|
372
|
+
|
|
373
|
+
if (isStatic) {
|
|
374
|
+
base = Class;
|
|
375
|
+
kind = kind - 5 /* STATIC */;
|
|
376
|
+
// initialize staticInitializers when we see a non-field static member
|
|
377
|
+
if (kind !== 0 /* FIELD */) {
|
|
378
|
+
staticInitializers = staticInitializers || [];
|
|
379
|
+
initializers = staticInitializers;
|
|
388
380
|
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
var existingKind = existingNonFields.get(name) || 0;
|
|
396
|
-
|
|
397
|
-
if (
|
|
398
|
-
existingKind === true ||
|
|
399
|
-
(existingKind === 3 /* GETTER */ && kind !== 4) /* SETTER */ ||
|
|
400
|
-
(existingKind === 4 /* SETTER */ && kind !== 3) /* GETTER */
|
|
401
|
-
) {
|
|
402
|
-
throw new Error(
|
|
403
|
-
"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: " +
|
|
404
|
-
name
|
|
405
|
-
);
|
|
406
|
-
} else if (!existingKind && kind > 2 /* METHOD */) {
|
|
407
|
-
existingNonFields.set(name, kind);
|
|
408
|
-
} else {
|
|
409
|
-
existingNonFields.set(name, true);
|
|
410
|
-
}
|
|
381
|
+
} else {
|
|
382
|
+
base = Class.prototype;
|
|
383
|
+
// initialize protoInitializers when we see a non-field member
|
|
384
|
+
if (kind !== 0 /* FIELD */) {
|
|
385
|
+
protoInitializers = protoInitializers || [];
|
|
386
|
+
initializers = protoInitializers;
|
|
411
387
|
}
|
|
412
|
-
|
|
413
|
-
applyMemberDec(
|
|
414
|
-
ret,
|
|
415
|
-
base,
|
|
416
|
-
decInfo,
|
|
417
|
-
name,
|
|
418
|
-
kind,
|
|
419
|
-
isStatic,
|
|
420
|
-
isPrivate,
|
|
421
|
-
initializers
|
|
422
|
-
);
|
|
423
388
|
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
389
|
+
|
|
390
|
+
if (kind !== 0 /* FIELD */ && !isPrivate) {
|
|
391
|
+
var existingNonFields = isStatic
|
|
392
|
+
? existingStaticNonFields
|
|
393
|
+
: existingProtoNonFields;
|
|
394
|
+
|
|
395
|
+
var existingKind = existingNonFields.get(name) || 0;
|
|
396
|
+
|
|
397
|
+
if (
|
|
398
|
+
existingKind === true ||
|
|
399
|
+
(existingKind === 3 /* GETTER */ && kind !== 4) /* SETTER */ ||
|
|
400
|
+
(existingKind === 4 /* SETTER */ && kind !== 3) /* GETTER */
|
|
401
|
+
) {
|
|
402
|
+
throw new Error(
|
|
403
|
+
"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: " +
|
|
404
|
+
name,
|
|
405
|
+
);
|
|
406
|
+
} else if (!existingKind && kind > 2 /* METHOD */) {
|
|
407
|
+
existingNonFields.set(name, kind);
|
|
408
|
+
} else {
|
|
409
|
+
existingNonFields.set(name, true);
|
|
410
|
+
}
|
|
437
411
|
}
|
|
412
|
+
|
|
413
|
+
applyMemberDec(
|
|
414
|
+
ret,
|
|
415
|
+
base,
|
|
416
|
+
decInfo,
|
|
417
|
+
name,
|
|
418
|
+
kind,
|
|
419
|
+
isStatic,
|
|
420
|
+
isPrivate,
|
|
421
|
+
initializers,
|
|
422
|
+
);
|
|
438
423
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
424
|
+
|
|
425
|
+
pushInitializers(ret, protoInitializers);
|
|
426
|
+
pushInitializers(ret, staticInitializers);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
function pushInitializers(ret, initializers) {
|
|
430
|
+
if (initializers) {
|
|
431
|
+
ret.push(function (instance) {
|
|
432
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
433
|
+
initializers[i].call(instance);
|
|
434
|
+
}
|
|
435
|
+
return instance;
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function applyClassDecs(ret, targetClass, classDecs) {
|
|
441
|
+
if (classDecs.length > 0) {
|
|
442
|
+
var initializers = [];
|
|
443
|
+
var newClass = targetClass;
|
|
444
|
+
var name = targetClass.name;
|
|
445
|
+
|
|
446
|
+
for (var i = classDecs.length - 1; i >= 0; i--) {
|
|
447
|
+
var decoratorFinishedRef = { v: false };
|
|
448
|
+
|
|
449
|
+
try {
|
|
450
|
+
var nextNewClass = classDecs[i](newClass, {
|
|
451
|
+
kind: "class",
|
|
452
|
+
name: name,
|
|
453
|
+
addInitializer: createAddInitializerMethod(
|
|
454
|
+
initializers,
|
|
455
|
+
decoratorFinishedRef,
|
|
456
|
+
),
|
|
457
|
+
});
|
|
458
|
+
} finally {
|
|
459
|
+
decoratorFinishedRef.v = true;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
if (nextNewClass !== undefined) {
|
|
463
|
+
assertValidReturnValue(10 /* CLASS */, nextNewClass);
|
|
464
|
+
newClass = nextNewClass;
|
|
466
465
|
}
|
|
467
|
-
|
|
468
|
-
ret.push(newClass, function () {
|
|
469
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
470
|
-
initializers[i].call(newClass);
|
|
471
|
-
}
|
|
472
|
-
});
|
|
473
466
|
}
|
|
467
|
+
|
|
468
|
+
ret.push(newClass, function () {
|
|
469
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
470
|
+
initializers[i].call(newClass);
|
|
471
|
+
}
|
|
472
|
+
});
|
|
474
473
|
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
dec, // dec or array of decs
|
|
485
|
-
0, // kind of value being decorated
|
|
486
|
-
'prop', // name of public prop on class containing the value being decorated,
|
|
487
|
-
'#p', // the name of the private property (if is private, void 0 otherwise),
|
|
488
|
-
]
|
|
489
|
-
],
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
Basic usage:
|
|
478
|
+
|
|
479
|
+
applyDecs(
|
|
480
|
+
Class,
|
|
481
|
+
[
|
|
482
|
+
// member decorators
|
|
490
483
|
[
|
|
491
|
-
//
|
|
492
|
-
|
|
484
|
+
dec, // dec or array of decs
|
|
485
|
+
0, // kind of value being decorated
|
|
486
|
+
'prop', // name of public prop on class containing the value being decorated,
|
|
487
|
+
'#p', // the name of the private property (if is private, void 0 otherwise),
|
|
493
488
|
]
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
489
|
+
],
|
|
490
|
+
[
|
|
491
|
+
// class decorators
|
|
492
|
+
dec1, dec2
|
|
493
|
+
]
|
|
494
|
+
)
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
Fully transpiled example:
|
|
498
|
+
|
|
499
|
+
```js
|
|
500
|
+
@dec
|
|
501
|
+
class Class {
|
|
500
502
|
@dec
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
[
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
initializeClass = ret[11];
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
a = (initializeInstance(this), initA(this, 123));
|
|
595
|
-
|
|
596
|
-
#a = initPrivA(this, 123);
|
|
597
|
-
|
|
598
|
-
#bData = initB(this, 123);
|
|
599
|
-
get b() { return this.#bData }
|
|
600
|
-
set b(v) { this.#bData = v }
|
|
601
|
-
|
|
602
|
-
#privBData = initPrivB(this, 123);
|
|
603
|
-
get #b() { return getPrivB(this); }
|
|
604
|
-
set #b(v) { setPrivB(this, v); }
|
|
605
|
-
|
|
606
|
-
c() { console.log('c'); }
|
|
607
|
-
|
|
608
|
-
#c(...args) { return privC(this, ...args) }
|
|
609
|
-
|
|
610
|
-
get d() { console.log('d'); }
|
|
611
|
-
|
|
612
|
-
get #d() { return privD(this); }
|
|
613
|
-
|
|
614
|
-
set e(v) { console.log('e'); }
|
|
615
|
-
|
|
616
|
-
set #e(v) { privE(this, v); }
|
|
503
|
+
a = 123;
|
|
504
|
+
|
|
505
|
+
@dec
|
|
506
|
+
#a = 123;
|
|
507
|
+
|
|
508
|
+
@dec
|
|
509
|
+
@dec2
|
|
510
|
+
accessor b = 123;
|
|
511
|
+
|
|
512
|
+
@dec
|
|
513
|
+
accessor #b = 123;
|
|
514
|
+
|
|
515
|
+
@dec
|
|
516
|
+
c() { console.log('c'); }
|
|
517
|
+
|
|
518
|
+
@dec
|
|
519
|
+
#c() { console.log('privC'); }
|
|
520
|
+
|
|
521
|
+
@dec
|
|
522
|
+
get d() { console.log('d'); }
|
|
523
|
+
|
|
524
|
+
@dec
|
|
525
|
+
get #d() { console.log('privD'); }
|
|
526
|
+
|
|
527
|
+
@dec
|
|
528
|
+
set e(v) { console.log('e'); }
|
|
529
|
+
|
|
530
|
+
@dec
|
|
531
|
+
set #e(v) { console.log('privE'); }
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
// becomes
|
|
536
|
+
let initializeInstance;
|
|
537
|
+
let initializeClass;
|
|
538
|
+
|
|
539
|
+
let initA;
|
|
540
|
+
let initPrivA;
|
|
541
|
+
|
|
542
|
+
let initB;
|
|
543
|
+
let initPrivB, getPrivB, setPrivB;
|
|
544
|
+
|
|
545
|
+
let privC;
|
|
546
|
+
let privD;
|
|
547
|
+
let privE;
|
|
548
|
+
|
|
549
|
+
let Class;
|
|
550
|
+
class _Class {
|
|
551
|
+
static {
|
|
552
|
+
let ret = applyDecs(
|
|
553
|
+
this,
|
|
554
|
+
[
|
|
555
|
+
[dec, 0, 'a'],
|
|
556
|
+
[dec, 0, 'a', (i) => i.#a, (i, v) => i.#a = v],
|
|
557
|
+
[[dec, dec2], 1, 'b'],
|
|
558
|
+
[dec, 1, 'b', (i) => i.#privBData, (i, v) => i.#privBData = v],
|
|
559
|
+
[dec, 2, 'c'],
|
|
560
|
+
[dec, 2, 'c', () => console.log('privC')],
|
|
561
|
+
[dec, 3, 'd'],
|
|
562
|
+
[dec, 3, 'd', () => console.log('privD')],
|
|
563
|
+
[dec, 4, 'e'],
|
|
564
|
+
[dec, 4, 'e', () => console.log('privE')],
|
|
565
|
+
],
|
|
566
|
+
[
|
|
567
|
+
dec
|
|
568
|
+
]
|
|
569
|
+
)
|
|
570
|
+
|
|
571
|
+
initA = ret[0];
|
|
572
|
+
|
|
573
|
+
initPrivA = ret[1];
|
|
574
|
+
|
|
575
|
+
initB = ret[2];
|
|
576
|
+
|
|
577
|
+
initPrivB = ret[3];
|
|
578
|
+
getPrivB = ret[4];
|
|
579
|
+
setPrivB = ret[5];
|
|
580
|
+
|
|
581
|
+
privC = ret[6];
|
|
582
|
+
|
|
583
|
+
privD = ret[7];
|
|
584
|
+
|
|
585
|
+
privE = ret[8];
|
|
586
|
+
|
|
587
|
+
initializeInstance = ret[9];
|
|
588
|
+
|
|
589
|
+
Class = ret[10]
|
|
590
|
+
|
|
591
|
+
initializeClass = ret[11];
|
|
617
592
|
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
593
|
+
|
|
594
|
+
a = (initializeInstance(this), initA(this, 123));
|
|
595
|
+
|
|
596
|
+
#a = initPrivA(this, 123);
|
|
597
|
+
|
|
598
|
+
#bData = initB(this, 123);
|
|
599
|
+
get b() { return this.#bData }
|
|
600
|
+
set b(v) { this.#bData = v }
|
|
601
|
+
|
|
602
|
+
#privBData = initPrivB(this, 123);
|
|
603
|
+
get #b() { return getPrivB(this); }
|
|
604
|
+
set #b(v) { setPrivB(this, v); }
|
|
605
|
+
|
|
606
|
+
c() { console.log('c'); }
|
|
607
|
+
|
|
608
|
+
#c(...args) { return privC(this, ...args) }
|
|
609
|
+
|
|
610
|
+
get d() { console.log('d'); }
|
|
611
|
+
|
|
612
|
+
get #d() { return privD(this); }
|
|
613
|
+
|
|
614
|
+
set e(v) { console.log('e'); }
|
|
615
|
+
|
|
616
|
+
set #e(v) { privE(this, v); }
|
|
628
617
|
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
618
|
+
|
|
619
|
+
initializeClass(Class);
|
|
620
|
+
*/
|
|
621
|
+
|
|
622
|
+
return function applyDecs2203Impl(targetClass, memberDecs, classDecs) {
|
|
623
|
+
var ret = [];
|
|
624
|
+
applyMemberDecs(ret, targetClass, memberDecs);
|
|
625
|
+
applyClassDecs(ret, targetClass, classDecs);
|
|
626
|
+
return ret;
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
var applyDecs2203Impl;
|
|
631
|
+
|
|
632
|
+
export default function applyDecs2203(targetClass, memberDecs, classDecs) {
|
|
633
|
+
applyDecs2203Impl = applyDecs2203Impl || applyDecs2203Factory();
|
|
634
|
+
return applyDecs2203Impl(targetClass, memberDecs, classDecs);
|
|
635
|
+
}
|