@@ -648,7 +648,6 @@ object Objects:
648
648
if ctor.isPrimaryConstructor then
649
649
val tpl = cls.defTree.asInstanceOf [TypeDef ].rhs.asInstanceOf [Template ]
650
650
extendTrace(cls.defTree) { eval(tpl, ref, cls, cacheResult = true ) }
651
- ref
652
651
else
653
652
extendTrace(ddef) { eval(ddef.rhs, ref, cls, cacheResult = true ) }
654
653
else
@@ -817,6 +816,7 @@ object Objects:
817
816
* @param sym The symbol of the variable.
818
817
*/
819
818
def readLocal (thisV : Value , sym : Symbol ): Contextual [Value ] = log(" reading local " + sym.show, printer, (_ : Value ).show) {
819
+ def isByNameParam (sym : Symbol ) = sym.is(Flags .Param ) && sym.info.isInstanceOf [ExprType ]
820
820
Env .resolveEnv(sym.enclosingMethod, thisV, summon[Env .Data ]) match
821
821
case Some (thisV -> env) =>
822
822
if sym.is(Flags .Mutable ) then
@@ -837,7 +837,7 @@ object Objects:
837
837
try
838
838
// Assume forward reference check is doing a good job
839
839
val value = Env .valValue(sym)
840
- if sym.is( Flags . Param ) && sym.info. isInstanceOf [ ExprType ] then
840
+ if isByNameParam( sym) then
841
841
value match
842
842
case fun : Fun =>
843
843
given Env .Data = fun.env
@@ -856,7 +856,7 @@ object Objects:
856
856
Bottom
857
857
858
858
case _ =>
859
- if sym.is( Flags . Param ) && sym.info. isInstanceOf [ ExprType ] then
859
+ if isByNameParam( sym) then
860
860
report.warning(" Calling cold by-name alias. Call trace: \n " + Trace .show, Trace .position)
861
861
Bottom
862
862
else
@@ -1089,10 +1089,10 @@ object Objects:
1089
1089
eval(expr, thisV, klass)
1090
1090
1091
1091
case Try (block, cases, finalizer) =>
1092
- eval (block, thisV, klass)
1092
+ val res = evalExprs (block :: cases.map(_.body) , thisV, klass).join
1093
1093
if ! finalizer.isEmpty then
1094
1094
eval(finalizer, thisV, klass)
1095
- evalExprs(cases.map(_.body), thisV, klass).join
1095
+ res
1096
1096
1097
1097
case SeqLiteral (elems, elemtpt) =>
1098
1098
evalExprs(elems, thisV, klass).join
0 commit comments