Make IrScript a statement container first, update JS support

The IrScript is now the IrStatementContainer with significant
statements order, and the code is adapted accordingly
This commit is contained in:
Ilya Chernikov
2020-07-14 12:08:48 +02:00
parent 55048f40ab
commit 01d73ba0fc
18 changed files with 330 additions and 114 deletions
@@ -143,7 +143,10 @@ abstract class AbstractReplTestRunner : TestCase() {
var t = 2 * 2
class A(val value: Int = 5) {
fun bar(): Int {
var q = 4
class B(val value: Int = 4) {
fun baz(): Int = value
}
var q = B().baz()
var w = 1
return q + w
}
@@ -221,9 +224,11 @@ abstract class AbstractReplTestRunner : TestCase() {
if (compileResult !is ReplCompileResult.CompiledClasses) return compileResult.toString()
val evalResult = tester.evaluate(compileResult)
if (evalResult !is ReplEvalResult.ValueResult) return evalResult.toString()
result = evalResult.value
when (evalResult) {
is ReplEvalResult.Error.Runtime -> return evalResult.cause.toString()
!is ReplEvalResult.ValueResult -> return evalResult.toString()
else -> result = evalResult.value
}
}
}
return result