@@ -131,15 +131,10 @@ export function makeComputedDecorator(
131
131
boolean | undefined ,
132
132
] ;
133
133
134
- return makeDescriptor (
135
- desc ,
136
- args . length ,
137
- target ,
138
- key ,
139
- propertyDesc ,
140
- maybeMeta ,
141
- isClassicDecorator
142
- ) ;
134
+ let meta = args . length < 4 ? metaFor ( target ) : maybeMeta ;
135
+ desc . setup ( target , key , propertyDesc , meta ! ) ;
136
+
137
+ return makeDescriptor ( desc , key , propertyDesc , isClassicDecorator ) ;
143
138
} ;
144
139
145
140
setClassicDecorator ( decorator , desc ) ;
@@ -151,11 +146,8 @@ export function makeComputedDecorator(
151
146
152
147
function makeDescriptor (
153
148
desc : ComputedDescriptor ,
154
- argsLength : number ,
155
- target : object ,
156
149
key : string ,
157
150
propertyDesc ?: DecoratorPropertyDescriptor ,
158
- maybeMeta ?: Meta ,
159
151
isClassicDecorator ?: boolean
160
152
) : PropertyDescriptor {
161
153
assert (
@@ -166,9 +158,6 @@ function makeDescriptor(
166
158
! COMPUTED_GETTERS . has ( propertyDesc . get )
167
159
) ;
168
160
169
- let meta = argsLength < 4 ? metaFor ( target ) : maybeMeta ;
170
- desc . setup ( target , key , propertyDesc , meta ! ) ;
171
-
172
161
let computedDesc : PropertyDescriptor = {
173
162
enumerable : desc . enumerable ,
174
163
configurable : desc . configurable ,
@@ -183,32 +172,37 @@ function computedDecorator2023(args: Parameters<Decorator>, desc: ComputedDescri
183
172
switch ( dec . kind ) {
184
173
case 'field' :
185
174
dec . context . addInitializer ( function ( this : any ) {
175
+ desc . setup ( this , dec . context . name as string , undefined , metaFor ( this ) ) ;
186
176
Object . defineProperty (
187
177
this ,
188
178
dec . context . name ,
189
- makeDescriptor ( desc , 2 , this , dec . context . name as string )
179
+ makeDescriptor ( desc , dec . context . name as string )
190
180
) ;
191
181
} ) ;
192
182
break ;
193
183
case 'getter' :
194
184
dec . context . addInitializer ( function ( this : any ) {
185
+ let propDesc = {
186
+ get : dec . value as any ,
187
+ } ;
188
+ desc . setup ( this , dec . context . name as string , propDesc , metaFor ( this ) ) ;
195
189
Object . defineProperty (
196
190
this ,
197
191
dec . context . name ,
198
- makeDescriptor ( desc , 2 , this , dec . context . name as string , {
199
- get : dec . value as any ,
200
- } )
192
+ makeDescriptor ( desc , dec . context . name as string , propDesc )
201
193
) ;
202
194
} ) ;
203
195
break ;
204
196
case 'setter' :
205
197
dec . context . addInitializer ( function ( this : any ) {
198
+ let propDesc = {
199
+ set : dec . value as any ,
200
+ } ;
201
+ desc . setup ( this , dec . context . name as string , propDesc , metaFor ( this ) ) ;
206
202
Object . defineProperty (
207
203
this ,
208
204
dec . context . name ,
209
- makeDescriptor ( desc , 2 , this , dec . context . name as string , {
210
- set : dec . value as any ,
211
- } )
205
+ makeDescriptor ( desc , dec . context . name as string , propDesc )
212
206
) ;
213
207
} ) ;
214
208
break ;
0 commit comments