Skip to content

Commit b838d71

Browse files
committed
Remove by-name paramteres
1 parent 73bf699 commit b838d71

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

compiler/src/dotty/tools/dotc/transform/Splicer.scala

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,11 @@ object Splicer {
187187
} else if (fn.symbol.is(Module)) {
188188
interpretModuleAccess(fn.symbol)
189189
} else if (fn.symbol.isStatic) {
190-
val module = fn.symbol.owner
191-
interpretStaticMethodCall(module, fn.symbol, args.flatten.map(interpretTree))
190+
val staticMethodCall = interpretedStaticMethodCall(fn.symbol.owner, fn.symbol)
191+
staticMethodCall(args.flatten.map(interpretTree))
192192
} else if (fn.qualifier.symbol.is(Module) && fn.qualifier.symbol.isStatic) {
193-
val module = fn.qualifier.symbol.moduleClass
194-
interpretStaticMethodCall(module, fn.symbol, args.flatten.map(interpretTree))
193+
val staticMethodCall = interpretedStaticMethodCall(fn.qualifier.symbol.moduleClass, fn.symbol)
194+
staticMethodCall(args.flatten.map(interpretTree))
195195
} else if (env.contains(fn.name)) {
196196
env(fn.name)
197197
} else if (tree.symbol.is(InlineProxy)) {
@@ -245,7 +245,7 @@ object Splicer {
245245
private def interpretQuoteContext()(implicit env: Env): Object =
246246
new scala.quoted.QuoteContext(ReflectionImpl(ctx, pos))
247247

248-
private def interpretStaticMethodCall(moduleClass: Symbol, fn: Symbol, args: => List[Object])(implicit env: Env): Object = {
248+
private def interpretedStaticMethodCall(moduleClass: Symbol, fn: Symbol)(implicit env: Env): List[Object] => Object = {
249249
val (inst, clazz) =
250250
if (moduleClass.name.startsWith(str.REPL_SESSION_LINE)) {
251251
(null, loadReplLineClass(moduleClass))
@@ -262,7 +262,8 @@ object Splicer {
262262

263263
val name = getDirectName(fn.info.finalResultType, fn.name.asTermName)
264264
val method = getMethod(clazz, name, paramsSig(fn))
265-
stopIfRuntimeException(method.invoke(inst, args: _*))
265+
266+
(args: List[Object]) => stopIfRuntimeException(method.invoke(inst, args: _*))
266267
}
267268

268269
private def interpretModuleAccess(fn: Symbol)(implicit env: Env): Object =

0 commit comments

Comments
 (0)