Skip to content

Commit 16488eb

Browse files
committed
Remove unnecessary lambda from Interpreter
1 parent a897254 commit 16488eb

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

compiler/src/dotty/tools/dotc/quoted/Interpreter.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ abstract class Interpreter(pos: SrcPos, classLoader: ClassLoader)(using Context)
7373
else if (fn.symbol.is(Module))
7474
interpretModuleAccess(fn.symbol)
7575
else if (fn.symbol.is(Method) && fn.symbol.isStatic) {
76-
val staticMethodCall = interpretedStaticMethodCall(fn.symbol.owner, fn.symbol)
77-
staticMethodCall(interpretArgs(args, fn.symbol.info))
76+
interpretedStaticMethodCall(fn.symbol.owner, fn.symbol, interpretArgs(args, fn.symbol.info))
7877
}
7978
else if fn.symbol.isStatic then
8079
assert(args.isEmpty)
@@ -83,8 +82,7 @@ abstract class Interpreter(pos: SrcPos, classLoader: ClassLoader)(using Context)
8382
if (fn.name == nme.asInstanceOfPM)
8483
interpretModuleAccess(fn.qualifier.symbol)
8584
else {
86-
val staticMethodCall = interpretedStaticMethodCall(fn.qualifier.symbol.moduleClass, fn.symbol)
87-
staticMethodCall(interpretArgs(args, fn.symbol.info))
85+
interpretedStaticMethodCall(fn.qualifier.symbol.moduleClass, fn.symbol, interpretArgs(args, fn.symbol.info))
8886
}
8987
else if (env.contains(fn.symbol))
9088
env(fn.symbol)
@@ -158,7 +156,7 @@ abstract class Interpreter(pos: SrcPos, classLoader: ClassLoader)(using Context)
158156
private def interpretVarargs(args: List[Object]): Object =
159157
args.toSeq
160158

161-
private def interpretedStaticMethodCall(moduleClass: Symbol, fn: Symbol): List[Object] => Object = {
159+
private def interpretedStaticMethodCall(moduleClass: Symbol, fn: Symbol, args: List[Object]): Object = {
162160
val (inst, clazz) =
163161
try
164162
if (moduleClass.name.startsWith(str.REPL_SESSION_LINE))
@@ -175,7 +173,7 @@ abstract class Interpreter(pos: SrcPos, classLoader: ClassLoader)(using Context)
175173

176174
val name = fn.name.asTermName
177175
val method = getMethod(clazz, name, paramsSig(fn))
178-
(args: List[Object]) => stopIfRuntimeException(method.invoke(inst, args: _*), method)
176+
stopIfRuntimeException(method.invoke(inst, args: _*), method)
179177
}
180178

181179
private def interpretedStaticFieldAccess(sym: Symbol): Object = {

0 commit comments

Comments
 (0)