File tree Expand file tree Collapse file tree 3 files changed +57
-21
lines changed
test/converter/declaration Expand file tree Collapse file tree 3 files changed +57
-21
lines changed Original file line number Diff line number Diff line change @@ -243,14 +243,13 @@ function convertFunctionOrMethod(
243
243
}
244
244
245
245
const parentSymbol = context . project . getSymbolFromReflection ( context . scope ) ;
246
- assert ( parentSymbol , "Missing parent symbol when converting function" ) ;
247
246
248
247
const locationDeclaration =
249
248
parentSymbol
250
249
?. getDeclarations ( )
251
250
?. find (
252
251
( d ) => ts . isClassDeclaration ( d ) || ts . isInterfaceDeclaration ( d )
253
- ) ?? parentSymbol . getDeclarations ( ) ?. [ 0 ] ?. getSourceFile ( ) ;
252
+ ) ?? symbol . getDeclarations ( ) ?. [ 0 ] ?. getSourceFile ( ) ;
254
253
assert ( locationDeclaration , "Missing declaration context" ) ;
255
254
256
255
const type = context . checker . getTypeOfSymbolAtLocation (
@@ -269,9 +268,6 @@ function convertFunctionOrMethod(
269
268
// All method signatures must have the same modifier flags.
270
269
setModifiers ( declarations [ 0 ] , reflection ) ;
271
270
272
- const parentSymbol = context . project . getSymbolFromReflection (
273
- context . scope
274
- ) ;
275
271
assert ( parentSymbol , "Tried to convert a method without a parent." ) ;
276
272
if (
277
273
parentSymbol
Original file line number Diff line number Diff line change
1
+ declare function gh1436 ( ) : void ;
Original file line number Diff line number Diff line change 198
198
},
199
199
{
200
200
"id" : 14 ,
201
+ "name" : " global-fn" ,
202
+ "kind" : 1 ,
203
+ "kindString" : " Module" ,
204
+ "flags" : {},
205
+ "children" : [
206
+ {
207
+ "id" : 15 ,
208
+ "name" : " gh1436" ,
209
+ "kind" : 64 ,
210
+ "kindString" : " Function" ,
211
+ "flags" : {},
212
+ "signatures" : [
213
+ {
214
+ "id" : 16 ,
215
+ "name" : " gh1436" ,
216
+ "kind" : 4096 ,
217
+ "kindString" : " Call signature" ,
218
+ "flags" : {},
219
+ "type" : {
220
+ "type" : " intrinsic" ,
221
+ "name" : " void"
222
+ }
223
+ }
224
+ ]
225
+ }
226
+ ],
227
+ "groups" : [
228
+ {
229
+ "title" : " Functions" ,
230
+ "kind" : 64 ,
231
+ "children" : [
232
+ 15
233
+ ]
234
+ }
235
+ ]
236
+ },
237
+ {
238
+ "id" : 17 ,
201
239
"name" : " namespaces" ,
202
240
"kind" : 1 ,
203
241
"kindString" : " Module" ,
204
242
"flags" : {},
205
243
"children" : [
206
244
{
207
- "id" : 19 ,
245
+ "id" : 22 ,
208
246
"name" : " GH1124" ,
209
247
"kind" : 2 ,
210
248
"kindString" : " Namespace" ,
211
249
"flags" : {},
212
250
"children" : [
213
251
{
214
- "id" : 20 ,
252
+ "id" : 23 ,
215
253
"name" : " PrimitiveType" ,
216
254
"kind" : 4194304 ,
217
255
"kindString" : " Type alias" ,
239
277
}
240
278
},
241
279
{
242
- "id" : 21 ,
280
+ "id" : 24 ,
243
281
"name" : " Value" ,
244
282
"kind" : 32 ,
245
283
"kindString" : " Variable" ,
257
295
"title" : " Type aliases" ,
258
296
"kind" : 4194304 ,
259
297
"children" : [
260
- 20
298
+ 23
261
299
]
262
300
},
263
301
{
264
302
"title" : " Variables" ,
265
303
"kind" : 32 ,
266
304
"children" : [
267
- 21
305
+ 24
268
306
]
269
307
}
270
308
]
271
309
},
272
310
{
273
- "id" : 17 ,
311
+ "id" : 20 ,
274
312
"name" : " GH1366" ,
275
313
"kind" : 2 ,
276
314
"kindString" : " Namespace" ,
277
315
"flags" : {},
278
316
"children" : [
279
317
{
280
- "id" : 18 ,
318
+ "id" : 21 ,
281
319
"name" : " Foo" ,
282
320
"kind" : 16777216 ,
283
321
"kindString" : " Reference" ,
284
322
"flags" : {},
285
- "target" : 15
323
+ "target" : 18
286
324
}
287
325
],
288
326
"groups" : [
289
327
{
290
328
"title" : " References" ,
291
329
"kind" : 16777216 ,
292
330
"children" : [
293
- 18
331
+ 21
294
332
]
295
333
}
296
334
]
297
335
},
298
336
{
299
- "id" : 15 ,
337
+ "id" : 18 ,
300
338
"name" : " Foo" ,
301
339
"kind" : 256 ,
302
340
"kindString" : " Interface" ,
303
341
"flags" : {},
304
342
"children" : [
305
343
{
306
- "id" : 16 ,
344
+ "id" : 19 ,
307
345
"name" : " prop" ,
308
346
"kind" : 1024 ,
309
347
"kindString" : " Property" ,
319
357
"title" : " Properties" ,
320
358
"kind" : 1024 ,
321
359
"children" : [
322
- 16
360
+ 19
323
361
]
324
362
}
325
363
]
330
368
"title" : " Namespaces" ,
331
369
"kind" : 2 ,
332
370
"children" : [
333
- 19 ,
334
- 17
371
+ 22 ,
372
+ 20
335
373
]
336
374
},
337
375
{
338
376
"title" : " Interfaces" ,
339
377
"kind" : 256 ,
340
378
"children" : [
341
- 15
379
+ 18
342
380
]
343
381
}
344
382
]
351
389
"children" : [
352
390
1 ,
353
391
7 ,
354
- 14
392
+ 14 ,
393
+ 17
355
394
]
356
395
}
357
396
]
You can’t perform that action at this time.
0 commit comments