-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathfn_decl.v
More file actions
742 lines (714 loc) · 20.8 KB
/
fn_decl.v
File metadata and controls
742 lines (714 loc) · 20.8 KB
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
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
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
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
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
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
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
// Copyright (c) 2024 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by a GPL license that can be found in the LICENSE file.
fn (mut app App) func_decl(decl FuncDecl) {
app.cur_fn_names.clear()
app.name_mapping.clear()
app.named_return_params.clear()
app.named_return_types.clear()
app.error_vars.clear() // Reset error variable tracking at function boundary
app.force_upper = false // Reset force_upper at function boundary
app.genln('')
app.comments(decl.doc)
// Function names must always be snake_case in V, regardless of whether
// the name matches a type/struct name (which go2v_ident would preserve)
mut method_name := decl.name.name.camel_to_snake()
// Special handling for String() method:
// - No args: Stringer interface -> str()
// - With args: custom method -> string_() (with trailing underscore to avoid V's .str())
if decl.name.name == 'String' {
if decl.typ.params.list.len == 0 {
method_name = 'str'
} else {
method_name = 'string_'
}
} else {
// Escape V keywords
if method_name in v_keywords {
method_name = method_name + '_'
}
// Escape V type names (e.g., u64, u32, string, etc.)
if method_name in v_type_names {
method_name = method_name + '_'
}
}
// Check for name collision with existing global names
if method_name in app.global_names {
mut i := 1
for {
new_name := '${method_name}_${i}'
if new_name !in app.global_names {
method_name = new_name
break
}
i++
}
}
app.global_names[method_name] = true
// Capital? Then it's public in Go
is_pub := decl.name.name[0].is_capital()
if is_pub {
app.gen('pub ')
}
// println('FUNC DECL ${method_name}')
// Track named return parameters and their types
for ret in decl.typ.results.list {
for n in ret.names {
if n.name != '' {
app.named_return_params[n.name] = true
app.named_return_types[n.name] = ret.typ
}
}
}
// Set flag if there are named return params to declare
app.pending_named_returns = app.named_return_params.len > 0
// Detect interface{} parameters and prepare for generic conversion
// V requires single-character generic type names
generic_type_names := ['T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H']
mut generic_params := map[string]string{} // param_name -> generic_type_name
mut generic_counter := 0
for param in decl.typ.params.list {
if param.typ is InterfaceType {
iface := param.typ as InterfaceType
if iface.methods.list.len == 0 {
// Empty interface{} - convert to generic
for name in param.names {
generic_type := if generic_counter < generic_type_names.len {
generic_type_names[generic_counter]
} else {
'T' // fallback
}
generic_params[name.name] = generic_type
generic_counter++
}
}
}
}
// mut recv := ''
// if decl.recv.list.len > 0 {
// recv_type := type_or_ident(decl.recv.list[0].typ)
// recv_name := decl.recv.list[0].names[0].name
// recv = '(${recv_name} ${recv_type})'
//}
// params := decl.typ.params.list.map(it.names.map(it.name).join(', ') + ' ' +
// type_or_ident(it.typ)).join(', ')
// if recv != '' {
if decl.recv.list.len > 0 {
// app.gen('fn ${recv} ')
app.gen('fn (')
recv_typ := decl.recv.list[0].typ
is_ptr_recv := recv_typ is StarExpr
if decl.recv.list[0].names.len == 0 {
app.is_mut_recv = true
app.gen('mut _ ')
} else {
recv_name := decl.recv.list[0].names[0].name
app.cur_fn_names[recv_name] = true // Register the receiver in this scope, since some people shadow receivers too!
// Pointer receivers should be mut in V
// Also check if receiver is modified via indexing (for slice types)
is_modified_via_index := app.receiver_modified_via_index(recv_name, decl.body.list)
if is_ptr_recv || is_modified_via_index {
app.gen('mut ')
app.is_mut_recv = true
}
app.gen(recv_name + ' ')
}
app.typ(decl.recv.list[0].typ)
app.gen(') ')
} else {
app.gen('fn ')
}
app.gen(method_name)
// Add generic type parameters if we have interface{} params
if generic_params.len > 0 {
mut generic_types := []string{}
for _, gtype in generic_params {
if gtype !in generic_types {
generic_types << gtype
}
}
app.gen('[${generic_types.join(', ')}]')
}
app.func_params_with_generics(decl.typ.params, generic_params)
app.func_return_type(decl.typ.results)
app.gen(' ') // Space before block
app.block_stmt(decl.body)
}
fn (mut app App) func_type(t FuncType) {
// Skip 'fn' prefix for interface method declarations
if !app.in_interface_decl {
app.gen('fn')
}
app.func_params_for_type(t.params)
app.func_return_type(t.results)
}
fn (mut app App) func_params_for_type(params FieldList) {
// Function type parameters: unnamed params are just types, no _ needed
app.gen('(')
for i, param in params.list {
if param.names.len == 0 {
// In function types, unnamed params are just the type
app.typ(param.typ)
} else {
for j, name in param.names {
saved_force_upper := app.force_upper
app.force_upper = false
v_name := app.go2v_ident(name.name)
app.gen(v_name)
app.force_upper = saved_force_upper
app.gen(' ')
app.force_upper = true
app.typ(param.typ)
if j < param.names.len - 1 {
app.gen(',')
}
}
}
if i < params.list.len - 1 {
app.gen(',')
}
}
app.gen(')')
}
fn (mut app App) func_return_type(results FieldList) {
// app.genln(results)
// Return types
return_types := results.list
if return_types.len == 0 {
return
}
// Add space before return type(s)
app.gen(' ')
needs_pars := return_types.len > 1
//|| (return_types.len > 0 && return_types[0].names.len > 0 && return_types[0].names[0].name != '')
if needs_pars {
app.gen('(')
}
for i, res in return_types {
/*
if res.names.len > 0 && res.names[0].name != '' {
app.gen(app.go2v_ident(res.names[0].name))
app.gen(' ')
}
*/
app.typ(res.typ)
if i < return_types.len - 1 {
app.gen(',')
}
//' ${decl.typ.results.list.map(type_or_ident(it.typ)).join(', ')}'
}
if needs_pars {
app.gen(')')
}
}
fn (mut app App) func_params(params FieldList) {
app.func_params_with_mutability(params, map[string]bool{})
}
fn (mut app App) func_params_with_mutability(params FieldList, mut_params map[string]bool) {
// p := params.list.map(it.names.map(it.name).join(', ') + ' ' + type_or_ident(it.typ)).join(', ')
app.gen('(')
// app.gen(p)
// println(app.sb.str())
for i, param in params.list {
// param names can be missing. V doesn't allow that, so use `_`
// param_names := if param.names.len > 0 { param.names } else { [Ident{name'_'] }
if param.names.len == 0 {
app.gen('_ ')
app.typ(param.typ)
} else {
for j, name in param.names {
// Check if this parameter needs to be mutable (reassigned in body)
// But only add mut for reference types - V doesn't allow mut for basic types
if name.name in mut_params {
// Only add mut for types that V allows: pointers, arrays, maps, structs, interfaces
// Note: We don't include SelectorExpr (module-qualified types) because adding mut
// changes the function signature, breaking callback compatibility
is_ref_type := param.typ is StarExpr || param.typ is ArrayType
|| param.typ is MapType || param.typ is StructType
|| param.typ is InterfaceType
if is_ref_type {
app.gen('mut ')
}
}
// Parameter names must be lowercase in V
saved_force_upper := app.force_upper
app.force_upper = false
v_name := app.go2v_ident(name.name)
app.gen(v_name)
app.force_upper = saved_force_upper
app.gen(' ')
app.force_upper = true
app.typ(param.typ)
if j < param.names.len - 1 {
app.gen(',')
}
app.cur_fn_names[v_name] = true // Register the V name for shadowing detection
}
}
// app.gen(type_or_ident(param.typ))
if i < params.list.len - 1 {
app.gen(',')
}
}
app.gen(')')
}
fn (mut app App) func_params_with_generics(params FieldList, generic_params map[string]string) {
app.gen('(')
for i, param in params.list {
if param.names.len == 0 {
app.gen('_ ')
app.typ(param.typ)
} else {
for j, name in param.names {
// Parameter names must be lowercase in V
saved_force_upper := app.force_upper
app.force_upper = false
v_name := app.go2v_ident(name.name)
app.gen(v_name)
app.force_upper = saved_force_upper
app.gen(' ')
// Check if this parameter should use a generic type
if name.name in generic_params {
app.gen(generic_params[name.name])
} else {
app.force_upper = true
app.typ(param.typ)
}
if j < param.names.len - 1 {
app.gen(',')
}
app.cur_fn_names[v_name] = true // Register the V name for shadowing detection
}
}
if i < params.list.len - 1 {
app.gen(',')
}
}
app.gen(')')
}
fn (mut app App) comments(doc Doc) {
if doc.list.len == 0 {
return
}
for x in doc.list {
app.genln(x.text)
}
}
fn (mut app App) func_lit(node FuncLit) {
// Collect identifiers used in the closure body
mut used_idents := map[string]bool{}
app.collect_idents_from_stmts(node.body.list, mut used_idents)
// Collect identifiers declared within the closure body (loop vars, local vars, etc.)
mut declared_in_closure := map[string]bool{}
app.collect_declarations_from_stmts(node.body.list, mut declared_in_closure)
// Filter to only identifiers from outer scope (cur_fn_names)
// Exclude variables declared within the closure itself
mut captured := []string{}
for ident, _ in used_idents {
// Skip blank identifier
if ident == '_' {
continue
}
// Skip variables declared within the closure
if ident in declared_in_closure {
continue
}
// Check if this variable was renamed due to shadowing
// If so, use the mapped name; otherwise convert using go2v_ident
v_name := if ident in app.name_mapping {
app.name_mapping[ident]
} else {
app.go2v_ident(ident)
}
if v_name in app.cur_fn_names && v_name !in captured {
captured << v_name
}
}
// Exclude closure parameters from captures and remove stale name_mappings
// for parameter names (closure params shadow any outer variable with same name)
for param in node.typ.params.list {
for name in param.names {
v_name := app.go2v_ident(name.name)
captured = captured.filter(it != v_name)
// Also filter out any mapped version of this name
if name.name in app.name_mapping {
mapped_name := app.name_mapping[name.name]
captured = captured.filter(it != mapped_name)
}
}
}
// Find parameters that are assigned in the closure body (need mut)
assigned_params := app.find_assigned_params(node.typ.params, node.body.list)
app.gen('fn ')
// Add capture list if there are captured variables
// In V, all captured variables that might be modified need 'mut'
if captured.len > 0 {
app.gen('[')
for i, cap in captured {
if i > 0 {
app.gen(', ')
}
// Add mut prefix - in most cases Go closures can modify captured variables
app.gen('mut ')
app.gen(cap)
}
app.gen('] ')
}
app.func_params_with_mutability(node.typ.params, assigned_params)
app.func_return_type(node.typ.results)
app.gen(' ') // Space before block
// Remove old name_mappings for parameter names before processing body
// The closure parameters shadow any outer variables with the same name
for param in node.typ.params.list {
for name in param.names {
app.name_mapping.delete(name.name)
}
}
app.block_stmt(node.body)
}
// Collect all identifiers referenced in a list of statements
fn (mut app App) collect_idents_from_stmts(stmts []Stmt, mut idents map[string]bool) {
for stmt in stmts {
app.collect_idents_from_stmt(stmt, mut idents)
}
}
// Collect identifiers that are declared within statements (loop variables, local vars)
fn (mut app App) collect_declarations_from_stmts(stmts []Stmt, mut declared map[string]bool) {
for stmt in stmts {
app.collect_declarations_from_stmt(stmt, mut declared)
}
}
fn (mut app App) collect_declarations_from_stmt(stmt Stmt, mut declared map[string]bool) {
match stmt {
AssignStmt {
// := creates new declarations
if stmt.tok == ':=' {
for lhs in stmt.lhs {
if lhs is Ident {
declared[lhs.name] = true
}
}
}
}
DeclStmt {
// var x type creates new declarations
if stmt.decl is GenDecl {
decl := stmt.decl as GenDecl
if decl.tok == 'var' {
for spec in decl.specs {
if spec is ValueSpec {
for n in spec.names {
declared[n.name] = true
}
}
}
}
}
}
BlockStmt {
app.collect_declarations_from_stmts(stmt.list, mut declared)
}
ForStmt {
// For init creates declarations
if stmt.init.tok == ':=' {
for lhs in stmt.init.lhs {
if lhs is Ident {
declared[lhs.name] = true
}
}
}
app.collect_declarations_from_stmts(stmt.body.list, mut declared)
}
IfStmt {
// If init creates declarations
if stmt.init.tok == ':=' {
for lhs in stmt.init.lhs {
if lhs is Ident {
declared[lhs.name] = true
}
}
}
app.collect_declarations_from_stmts(stmt.body.list, mut declared)
app.collect_declarations_from_stmt(stmt.else_, mut declared)
}
RangeStmt {
// Range loop variables
if stmt.key.name != '' && stmt.key.name != '_' {
declared[stmt.key.name] = true
}
if stmt.value.name != '' && stmt.value.name != '_' {
declared[stmt.value.name] = true
}
app.collect_declarations_from_stmts(stmt.body.list, mut declared)
}
SwitchStmt {
app.collect_declarations_from_stmts(stmt.body.list, mut declared)
}
CaseClause {
for s in stmt.body {
app.collect_declarations_from_stmt(s, mut declared)
}
}
else {}
}
}
fn (mut app App) collect_idents_from_stmt(stmt Stmt, mut idents map[string]bool) {
match stmt {
AssignStmt {
for expr in stmt.lhs {
app.collect_idents_from_expr(expr, mut idents)
}
for expr in stmt.rhs {
app.collect_idents_from_expr(expr, mut idents)
}
}
BlockStmt {
app.collect_idents_from_stmts(stmt.list, mut idents)
}
DeferStmt {
app.collect_idents_from_expr(stmt.call, mut idents)
}
ExprStmt {
app.collect_idents_from_expr(stmt.x, mut idents)
}
ForStmt {
app.collect_idents_from_expr(stmt.cond, mut idents)
app.collect_idents_from_stmts(stmt.body.list, mut idents)
}
IfStmt {
app.collect_idents_from_expr(stmt.cond, mut idents)
app.collect_idents_from_stmts(stmt.body.list, mut idents)
app.collect_idents_from_stmt(stmt.else_, mut idents)
}
IncDecStmt {
app.collect_idents_from_expr(stmt.x, mut idents)
}
RangeStmt {
app.collect_idents_from_expr(stmt.x, mut idents)
app.collect_idents_from_stmts(stmt.body.list, mut idents)
}
ReturnStmt {
for expr in stmt.results {
app.collect_idents_from_expr(expr, mut idents)
}
}
SwitchStmt {
app.collect_idents_from_expr(stmt.tag, mut idents)
app.collect_idents_from_stmts(stmt.body.list, mut idents)
}
CaseClause {
for expr in stmt.list {
app.collect_idents_from_expr(expr, mut idents)
}
for s in stmt.body {
app.collect_idents_from_stmt(s, mut idents)
}
}
else {}
}
}
fn (mut app App) collect_idents_from_expr(expr Expr, mut idents map[string]bool) {
match expr {
Ident {
idents[expr.name] = true
}
BinaryExpr {
app.collect_idents_from_expr(expr.x, mut idents)
app.collect_idents_from_expr(expr.y, mut idents)
}
CallExpr {
app.collect_idents_from_expr(expr.fun, mut idents)
for arg in expr.args {
app.collect_idents_from_expr(arg, mut idents)
}
}
IndexExpr {
app.collect_idents_from_expr(expr.x, mut idents)
app.collect_idents_from_expr(expr.index, mut idents)
}
SelectorExpr {
// Don't collect the base of SelectorExpr - if it's a module/package name
// (like 'ast' in 'ast.ImportEntryPoint'), we don't want to capture it.
// If it's actually a variable being accessed (like 'obj.field'), the
// variable will be collected from other usages where it's not a selector base.
// Only recurse if the base is not a simple Ident (e.g., it's a nested expression)
if expr.x !is Ident {
app.collect_idents_from_expr(expr.x, mut idents)
}
}
SliceExpr {
app.collect_idents_from_expr(expr.x, mut idents)
if expr.low !is InvalidExpr {
app.collect_idents_from_expr(expr.low, mut idents)
}
if expr.high !is InvalidExpr {
app.collect_idents_from_expr(expr.high, mut idents)
}
}
StarExpr {
app.collect_idents_from_expr(expr.x, mut idents)
}
UnaryExpr {
app.collect_idents_from_expr(expr.x, mut idents)
}
ParenExpr {
app.collect_idents_from_expr(expr.x, mut idents)
}
CompositeLit {
for elt in expr.elts {
app.collect_idents_from_expr(elt, mut idents)
}
}
KeyValueExpr {
// Don't collect the key if it's a simple Ident - it's likely a struct field name
// rather than a variable reference. Map keys with variable names will be missed,
// but this is rare and avoids false positives from struct field names.
if expr.key !is Ident {
app.collect_idents_from_expr(expr.key, mut idents)
}
app.collect_idents_from_expr(expr.value, mut idents)
}
FuncLit {
// Recurse into nested closures - if they use outer variables,
// this closure also needs to capture them to make them available.
// But we need to exclude the nested closure's own parameters.
mut nested_declared := map[string]bool{}
// Add nested closure's parameters as declared
for param in expr.typ.params.list {
for name in param.names {
nested_declared[name.name] = true
}
}
// Collect declarations from the nested closure body
app.collect_declarations_from_stmts(expr.body.list, mut nested_declared)
// Collect identifiers, but skip those declared in the nested closure
mut nested_idents := map[string]bool{}
app.collect_idents_from_stmts(expr.body.list, mut nested_idents)
for ident, _ in nested_idents {
if ident !in nested_declared {
idents[ident] = true
}
}
}
else {}
}
}
// Check if a receiver variable is modified via indexing (for slice types)
fn (app App) receiver_modified_via_index(recv_name string, stmts []Stmt) bool {
for stmt in stmts {
if app.stmt_modifies_via_index(recv_name, stmt) {
return true
}
}
return false
}
fn (app App) stmt_modifies_via_index(recv_name string, stmt Stmt) bool {
match stmt {
AssignStmt {
for lhs in stmt.lhs {
if app.is_indexed_access_on(recv_name, lhs) {
return true
}
}
}
BlockStmt {
return app.receiver_modified_via_index(recv_name, stmt.list)
}
IfStmt {
if app.receiver_modified_via_index(recv_name, stmt.body.list) {
return true
}
return app.stmt_modifies_via_index(recv_name, stmt.else_)
}
ForStmt {
return app.receiver_modified_via_index(recv_name, stmt.body.list)
}
RangeStmt {
return app.receiver_modified_via_index(recv_name, stmt.body.list)
}
SwitchStmt {
return app.receiver_modified_via_index(recv_name, stmt.body.list)
}
CaseClause {
for s in stmt.body {
if app.stmt_modifies_via_index(recv_name, s) {
return true
}
}
}
else {}
}
return false
}
fn (app App) is_indexed_access_on(recv_name string, expr Expr) bool {
match expr {
IndexExpr {
// Check if the base of the index expression is the receiver
if expr.x is Ident {
return (expr.x as Ident).name == recv_name
}
}
else {}
}
return false
}
// Find parameters that are assigned (LHS of = assignment) in the function body
// These need to be declared as mut in V
fn (app App) find_assigned_params(params FieldList, stmts []Stmt) map[string]bool {
// Collect all parameter names
mut param_names := map[string]bool{}
for param in params.list {
for name in param.names {
if name.name != '' && name.name != '_' {
param_names[name.name] = true
}
}
}
// Find which parameters are assigned in the body
mut assigned := map[string]bool{}
app.find_assignments_in_stmts(stmts, param_names, mut assigned)
return assigned
}
fn (app App) find_assignments_in_stmts(stmts []Stmt, param_names map[string]bool, mut assigned map[string]bool) {
for stmt in stmts {
app.find_assignments_in_stmt(stmt, param_names, mut assigned)
}
}
fn (app App) find_assignments_in_stmt(stmt Stmt, param_names map[string]bool, mut assigned map[string]bool) {
match stmt {
AssignStmt {
// Only look at = assignments, not := declarations
if stmt.tok == '=' {
for lhs in stmt.lhs {
if lhs is Ident {
if lhs.name in param_names {
assigned[lhs.name] = true
}
}
}
}
}
BlockStmt {
app.find_assignments_in_stmts(stmt.list, param_names, mut assigned)
}
IfStmt {
app.find_assignments_in_stmts(stmt.body.list, param_names, mut assigned)
app.find_assignments_in_stmt(stmt.else_, param_names, mut assigned)
}
ForStmt {
app.find_assignments_in_stmts(stmt.body.list, param_names, mut assigned)
}
RangeStmt {
app.find_assignments_in_stmts(stmt.body.list, param_names, mut assigned)
}
SwitchStmt {
app.find_assignments_in_stmts(stmt.body.list, param_names, mut assigned)
}
CaseClause {
for s in stmt.body {
app.find_assignments_in_stmt(s, param_names, mut assigned)
}
}
else {}
}
}