@@ -31,6 +31,7 @@ class Interpreter[R <: Reflection & Singleton](reflect0: R) extends TreeInterpre
3131 val symbol = sym.methods.find(_.name == method.getName).get
3232
3333 if (symbol.isDefinedInCurrentRun) {
34+ // TODO use `super.interpretCall(...)`
3435 symbol match {
3536 case IsDefSymbol (symbol) =>
3637 val args1 = if (args == null ) Nil else args.toList
@@ -57,36 +58,34 @@ class Interpreter[R <: Reflection & Singleton](reflect0: R) extends TreeInterpre
5758
5859 override def interpretCall (fn : Term , argss : List [List [Term ]]): Result = {
5960 if (fn.symbol.isDefinedInCurrentRun) super .interpretCall(fn, argss)
61+ else {
62+ fn match {
63+ case Term .Select (prefix, _) =>
64+ val IsDefSymbol (sym) = fn.symbol
65+ val pre = eval(prefix).asInstanceOf [Object ]
66+ val argss2 = evaluatedArgss(argss)
67+ jvmReflection.interpretMethodCall(pre, fn.symbol, argss2)
68+ case _ =>
69+ val IsDefSymbol (sym) = fn.symbol
70+ val argss2 = evaluatedArgss(argss)
71+ jvmReflection.interpretStaticMethodCall(fn.symbol.owner, fn.symbol, argss2)
72+ }
73+ }
74+ }
75+
76+ override def interpretValGet (fn : Term ): Result = {
77+ if (fn.symbol.isDefinedInCurrentRun) super .interpretValGet(fn)
6078 else {
6179 import Term ._
6280 fn match {
6381 case Select (prefix, _) =>
64- fn.symbol match {
65- case IsDefSymbol (sym) =>
66- val pre = eval(prefix).asInstanceOf [Object ]
67- val argss2 = evaluatedArgss(argss)
68- jvmReflection.interpretMethodCall(pre, fn.symbol, argss2)
69- case _ =>
70- // TODO not necesarly static?
71- jvmReflection.interpretStaticVal(fn.symbol.owner, fn.symbol)
72- }
82+ // FIXME not necesarly static
83+ jvmReflection.interpretStaticVal(fn.symbol.owner, fn.symbol)
7384 case _ =>
74- // println(fn.show)
75- fn.symbol match {
76- // TODO: obviously
77- case IsDefSymbol (sym) =>
78- val argss2 = evaluatedArgss(argss)
79- // argss2.foreach(println)
80- jvmReflection.interpretStaticMethodCall(fn.symbol.owner, fn.symbol, argss2)
81- case _ =>
82- if (fn.symbol.flags.isObject) {
83- jvmReflection.loadModule(fn.symbol.asVal.moduleClass.get)
84- }
85- // call to a static val
86- else {
87- jvmReflection.interpretStaticVal(fn.symbol.owner, fn.symbol)
88- }
89- }
85+ if (fn.symbol.flags.isObject)
86+ jvmReflection.loadModule(fn.symbol.asVal.moduleClass.get)
87+ else
88+ jvmReflection.interpretStaticVal(fn.symbol.owner, fn.symbol)
9089 }
9190 }
9291 }
0 commit comments