@@ -31,6 +31,7 @@ class Interpreter[R <: Reflection & Singleton](reflect0: R) extends TreeInterpre
31
31
val symbol = sym.methods.find(_.name == method.getName).get
32
32
33
33
if (symbol.isDefinedInCurrentRun) {
34
+ // TODO use `super.interpretCall(...)`
34
35
symbol match {
35
36
case IsDefSymbol (symbol) =>
36
37
val args1 = if (args == null ) Nil else args.toList
@@ -57,36 +58,34 @@ class Interpreter[R <: Reflection & Singleton](reflect0: R) extends TreeInterpre
57
58
58
59
override def interpretCall (fn : Term , argss : List [List [Term ]]): Result = {
59
60
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)
60
78
else {
61
79
import Term ._
62
80
fn match {
63
81
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)
73
84
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)
90
89
}
91
90
}
92
91
}
0 commit comments