@@ -635,7 +635,7 @@ object Objects:
635
635
* @param ctor The symbol of the target method.
636
636
* @param args Arguments of the constructor call (all parameter blocks flatten to a list).
637
637
*/
638
- def callConstructor (thisV : Value , ctor : Symbol , args : List [ArgInfo ]): Contextual [Value ] = log(" call " + ctor.show + " , args = " + args.map(_.value.show), printer, (_ : Value ).show) {
638
+ def callConstructor (thisV : Value , ctor : Symbol , args : List [ArgInfo ]): Contextual [Unit ] = log(" call " + ctor.show + " , args = " + args.map(_.value.show), printer, (_ : Value ).show) {
639
639
640
640
thisV match
641
641
case ref : Ref =>
@@ -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
@@ -988,7 +988,7 @@ object Objects:
988
988
case Select (qual, _) =>
989
989
val receiver = eval(qual, thisV, klass)
990
990
if ref.symbol.isConstructor then
991
- withTrace(trace2) { callConstructor(receiver, ref.symbol, args) }
991
+ withTrace(trace2) { callConstructor(receiver, ref.symbol, args); Bottom }
992
992
else
993
993
withTrace(trace2) { call(receiver, ref.symbol, args, receiver = qual.tpe, superType = NoType ) }
994
994
@@ -1003,7 +1003,7 @@ object Objects:
1003
1003
case TermRef (prefix, _) =>
1004
1004
val receiver = withTrace(trace2) { evalType(prefix, thisV, klass) }
1005
1005
if id.symbol.isConstructor then
1006
- withTrace(trace2) { callConstructor(receiver, id.symbol, args) }
1006
+ withTrace(trace2) { callConstructor(receiver, id.symbol, args); Bottom }
1007
1007
else
1008
1008
withTrace(trace2) { call(receiver, id.symbol, args, receiver = prefix, superType = NoType ) }
1009
1009
@@ -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
@@ -1259,7 +1259,6 @@ object Objects:
1259
1259
tasks.append { () =>
1260
1260
printer.println(" init super class " + cls.show)
1261
1261
callConstructor(thisV, ctor, args)
1262
- ()
1263
1262
}
1264
1263
1265
1264
// parents
0 commit comments