@@ -80,7 +80,7 @@ class Semantic {
80
80
case class Warm (klass : ClassSymbol , outer : Value , ctor : Symbol , args : List [Value ]) extends Addr
81
81
82
82
/** A function value */
83
- case class Fun (expr : Tree , params : List [ Symbol ], thisV : Addr , klass : ClassSymbol , env : Env ) extends Value
83
+ case class Fun (expr : Tree , thisV : Addr , klass : ClassSymbol , env : Env ) extends Value
84
84
85
85
/** A value which represents a set of addresses
86
86
*
@@ -416,13 +416,12 @@ class Semantic {
416
416
else
417
417
value.select(target, source, needResolve = false )
418
418
419
- case Fun (body, params, thisV, klass, env2 ) =>
419
+ case Fun (body, thisV, klass, env ) =>
420
420
// meth == NoSymbol for poly functions
421
421
if meth.name.toString == " tupled" then Result (value, Nil ) // a call like `fun.tupled`
422
422
else
423
- val env3 = Env (params.zip(args.map(_.value).widen).toMap).union(env2)
424
- use(env3) {
425
- eval(body, thisV, klass, cacheResult = true )
423
+ use(env) {
424
+ eval(body, thisV, klass, cacheResult = true ) ++ checkArgs
426
425
}
427
426
428
427
case RefSet (refs) =>
@@ -479,7 +478,7 @@ class Semantic {
479
478
if ! env.isHot then Result (Cold , res.errors)
480
479
else Result (value, res.errors)
481
480
482
- case Fun (body, params, thisV, klass, env) =>
481
+ case Fun (body, thisV, klass, env) =>
483
482
report.error(" unexpected tree in instantiating a function, fun = " + body.show, source)
484
483
Result (Hot , Nil )
485
484
@@ -553,7 +552,7 @@ class Semantic {
553
552
errors
554
553
}
555
554
556
- case fun @ Fun (body, params, thisV, klass, env) =>
555
+ case fun @ Fun (body, thisV, klass, env) =>
557
556
if promoted.contains(fun) then Nil
558
557
else
559
558
val res = eval(body, thisV, klass)
@@ -687,7 +686,7 @@ class Semantic {
687
686
args.foreach { arg =>
688
687
val res =
689
688
if arg.isByName then
690
- val fun = Fun (arg.tree, Nil , thisV, klass, env)
689
+ val fun = Fun (arg.tree, thisV, klass, env)
691
690
Result (fun, Nil )
692
691
else
693
692
eval(arg.tree, thisV, klass)
@@ -774,12 +773,11 @@ class Semantic {
774
773
eval(rhs, thisV, klass).ensureHot(" May only assign fully initialized value" , rhs)
775
774
776
775
case closureDef(ddef) =>
777
- val params = ddef.termParamss.head.map(_.symbol)
778
- val value = Fun (ddef.rhs, params, thisV, klass, env)
776
+ val value = Fun (ddef.rhs, thisV, klass, env)
779
777
Result (value, Nil )
780
778
781
779
case PolyFun (body) =>
782
- val value = Fun (body, Nil , thisV, klass, env)
780
+ val value = Fun (body, thisV, klass, env)
783
781
Result (value, Nil )
784
782
785
783
case Block (stats, expr) =>
0 commit comments