Evaluator: Handle function context gracefully. Use file scope as a fallback instead of error scope

This commit is contained in:
Yan Zhulanow
2019-02-21 00:31:10 +03:00
parent 5035de24ac
commit 16266259f5
7 changed files with 103 additions and 14 deletions
@@ -0,0 +1,19 @@
package defaultParameterValues
fun main() {
foo(3)
}
fun foo(
b: Int,
//Breakpoint!
a: Int = 5
) {
val c = 5
}
// EXPRESSION: a
// RESULT: Parameter evaluation is not supported for '$default' methods
// EXPRESSION: b
// RESULT: Parameter evaluation is not supported for '$default' methods
@@ -0,0 +1,9 @@
LineBreakpoint created at defaultParameterValues.kt:10
Run Java
Connected to the target VM
defaultParameterValues.kt:10
Compile bytecode for a
Compile bytecode for b
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,20 @@
package defaultParameterValues2
fun main() {
Foo().foo()
}
interface IFoo {
//Breakpoint!
fun foo(a: Int = 1)
}
class Foo : IFoo {
override fun foo(a: Int) {}
}
// EXPRESSION: Foo()
// RESULT: instance of defaultParameterValues2.Foo(id=ID): LdefaultParameterValues2/Foo;
// EXPRESSION: a
// RESULT: Parameter evaluation is not supported for '$default' methods
@@ -0,0 +1,9 @@
LineBreakpoint created at defaultParameterValues2.kt:9
Run Java
Connected to the target VM
defaultParameterValues2.kt:9
Compile bytecode for Foo()
Compile bytecode for a
Disconnected from the target VM
Process finished with exit code 0