@@ -204,31 +204,33 @@ private def getName(t: Tree, symNme: Opt[Tree]): (Opt[Tree], Diagnostic \/ Ident
204
204
205
205
trait TermDefImpl :
206
206
this : TermDef =>
207
- lazy val (symName, name, params , typeParams, signature): (Opt [Tree ], Diagnostic \/ Ident , Opt [ Ls [Tree ] ], Opt [Tree ], Opt [Tree ]) =
208
- def rec (t : Tree , symName : Opt [Tree ]):
209
- ( Opt [ Tree ], Diagnostic \/ Ident , Opt [ Ls [ Tree ]], Opt [ Tree ], Opt [ Tree ]) =
210
- t match
211
- case InfixApp ( id : Ident , Keyword .`:`, sign) =>
212
- (symName, R (id), N , N , S ( sign))
213
- // show(t: Tree): Str
214
- case InfixApp ( App ( id : Ident , args), Keyword .`:`, ret) =>
215
- (symName, R (id), S (args :: Nil ), N , N )
216
- // show[A](t: Tree[A]): Str
217
- case InfixApp (App (App (id : Ident , typeParams : TyTup ), args ), Keyword .`:`, ret) =>
218
- // val sign = S(InfixApp(typeParams, Keyword.`->`, InfixApp(args, Keyword.`->`, ret)) )
219
- (symName, R (id), S (args :: Nil ), S (typeParams), N )
207
+ lazy val (symName, name, paramLists , typeParams, signature): (Opt [Tree ], Diagnostic \/ Ident , Ls [Tup ], Opt [Tree ], Opt [Tree ]) =
208
+ def rec (t : Tree , symName : Opt [Tree ]): ( Opt [ Tree ], Diagnostic \/ Ident , Ls [ Tup ], Opt [ Tree ], Opt [ Tree ]) = t match
209
+ // fun f: Int
210
+ // fun f(n1: Int): Int
211
+ // fun f(n1: Int)(nn: Int): Int
212
+ case InfixApp ( Apps (id : Ident , paramLists), Keyword .`:`, sign) =>
213
+ (symName, R (id), paramLists, N , S (sign))
214
+ // fun f[T]: Int
215
+ // fun f[T](n1: Int): Int
216
+ // fun f[T](n1: Int)(nn: Int): Int
217
+ case InfixApp (Apps (App (id : Ident , typeParams : TyTup ), paramLists ), Keyword .`:`, ret) =>
218
+ (symName, R (id), paramLists, S (typeParams), N )
219
+
220
220
case InfixApp (Jux (lhs, rhs), Keyword .`:`, ret) =>
221
221
rec(InfixApp (rhs, Keyword .`:`, ret), S (lhs))
222
- case id : Ident =>
223
- (symName, R (id), N , N , N )
224
- case App (id : Ident , typeParams : TyTup ) =>
225
- (symName, R (id), N , S (typeParams), N )
226
- case App (id : Ident , args) =>
227
- (symName, R (id), S (args :: Nil ), N , N )
228
- case App (primary : App , second) =>
229
- // TODO: handle the second parameter list
230
- val (sn, id, first, tps, sig) = rec(primary, symName)
231
- (sn, id, S (first.fold(Ls (second))(_ :+ second)), tps, sig)
222
+
223
+ // fun f
224
+ // fun f(n1: Int)
225
+ // fun f(n1: Int)(nn: Int)
226
+ case Apps (id : Ident , paramLists) =>
227
+ (symName, R (id), paramLists, N , N )
228
+ // fun f[T]
229
+ // fun f[T](n1: Int)
230
+ // fun f[T](n1: Int)(nn: Int)
231
+ case Apps (App (id : Ident , typeParams : TyTup ), paramLists) =>
232
+ (symName, R (id), paramLists, S (typeParams), N )
233
+
232
234
case Jux (lhs, rhs) => // happens in `fun (op) nme` form
233
235
require(symName.isEmpty) // TOOD
234
236
rec(rhs, S (lhs))
0 commit comments