@@ -295,12 +295,16 @@ object Splicer {
295295 case _ if tree.symbol == defn.TastyTasty_macroContext =>
296296 interpretTastyContext()
297297
298- case StaticCall (fn, args) =>
299- if (fn.symbol.is(Module )) {
300- assert(args.isEmpty)
301- interpretModuleAccess(fn)
298+ case Call (fn, args) =>
299+ if (fn.symbol.isConstructor && fn.symbol.owner.owner.is(Package )) {
300+ interpretNew(fn, args.map(interpretTree))
301+ } else if (fn.symbol.isStatic) {
302+ if (fn.symbol.is(Module )) interpretModuleAccess(fn)
303+ else interpretStaticMethodCall(fn, args.map(arg => interpretTree(arg)))
304+ } else if (env.contains(fn.name)) {
305+ env(fn.name)
302306 } else {
303- interpretStaticMethodCall(fn, args.map(arg => interpretTree(arg)) )
307+ unexpectedTree(tree )
304308 }
305309
306310 // Interpret `foo(j = x, i = y)` which it is expanded to
@@ -313,28 +317,21 @@ object Splicer {
313317 })
314318 interpretTree(expr)(newEnv)
315319 case NamedArg (_, arg) => interpretTree(arg)
316- case Ident (name) if env.contains(name) => env(name)
317320
318321 case Inlined (EmptyTree , Nil , expansion) => interpretTree(expansion)
319322
320- case Apply (TypeApply (fun : RefTree , _), args) if fun.symbol.isConstructor && fun.symbol.owner.owner.is(Package ) =>
321- interpretNew(fun, args.map(interpretTree))
322-
323- case Apply (fun : RefTree , args) if fun.symbol.isConstructor && fun.symbol.owner.owner.is(Package )=>
324- interpretNew(fun, args.map(interpretTree))
325-
326323 case Typed (SeqLiteral (elems, _), _) =>
327324 interpretVarargs(elems.map(e => interpretTree(e)))
328325
329326 case _ =>
330327 unexpectedTree(tree)
331328 }
332329
333- object StaticCall {
330+ object Call {
334331 def unapply (arg : Tree ): Option [(RefTree , List [Tree ])] = arg match {
335- case fn : RefTree if fn.symbol.isStatic => Some ((fn, Nil ))
336- case Apply (StaticCall (fn, args1), args2) => Some ((fn, args1 ::: args2)) // TODO improve performance
337- case TypeApply (StaticCall (fn, args), _) => Some ((fn, args))
332+ case fn : RefTree => Some ((fn, Nil ))
333+ case Apply (Call (fn, args1), args2) => Some ((fn, args1 ::: args2)) // TODO improve performance
334+ case TypeApply (Call (fn, args), _) => Some ((fn, args))
338335 case _ => None
339336 }
340337 }
0 commit comments