Skip to content

Commit 6970bae

Browse files
committed
Remove unnecessary lambda from Interpreter
1 parent 930fe2c commit 6970bae

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
@@ -72,8 +72,7 @@ abstract class Interpreter(pos: SrcPos, classLoader: ClassLoader)(using Context)
7272
else if (fn.symbol.is(Module))
7373
interpretModuleAccess(fn.symbol)
7474
else if (fn.symbol.is(Method) && fn.symbol.isStatic) {
75-
val staticMethodCall = interpretedStaticMethodCall(fn.symbol.owner, fn.symbol)
76-
staticMethodCall(interpretArgs(args, fn.symbol.info))
75+
interpretedStaticMethodCall(fn.symbol.owner, fn.symbol, interpretArgs(args, fn.symbol.info))
7776
}
7877
else if fn.symbol.isStatic then
7978
assert(args.isEmpty)
@@ -82,8 +81,7 @@ abstract class Interpreter(pos: SrcPos, classLoader: ClassLoader)(using Context)
8281
if (fn.name == nme.asInstanceOfPM)
8382
interpretModuleAccess(fn.qualifier.symbol)
8483
else {
85-
val staticMethodCall = interpretedStaticMethodCall(fn.qualifier.symbol.moduleClass, fn.symbol)
86-
staticMethodCall(interpretArgs(args, fn.symbol.info))
84+
interpretedStaticMethodCall(fn.qualifier.symbol.moduleClass, fn.symbol, interpretArgs(args, fn.symbol.info))
8785
}
8886
else if (env.contains(fn.symbol))
8987
env(fn.symbol)
@@ -157,7 +155,7 @@ abstract class Interpreter(pos: SrcPos, classLoader: ClassLoader)(using Context)
157155
private def interpretVarargs(args: List[Object]): Object =
158156
args.toSeq
159157

160-
private def interpretedStaticMethodCall(moduleClass: Symbol, fn: Symbol): List[Object] => Object = {
158+
private def interpretedStaticMethodCall(moduleClass: Symbol, fn: Symbol, args: List[Object]): Object = {
161159
val (inst, clazz) =
162160
try
163161
if (moduleClass.name.startsWith(str.REPL_SESSION_LINE))
@@ -174,7 +172,7 @@ abstract class Interpreter(pos: SrcPos, classLoader: ClassLoader)(using Context)
174172

175173
val name = fn.name.asTermName
176174
val method = getMethod(clazz, name, paramsSig(fn))
177-
(args: List[Object]) => stopIfRuntimeException(method.invoke(inst, args: _*), method)
175+
stopIfRuntimeException(method.invoke(inst, args: _*), method)
178176
}
179177

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

0 commit comments

Comments
 (0)