Step 16: remove ToBoolStatement

This commit is contained in:
Sergey Chernov 2026-02-09 11:42:51 +03:00
parent 565dbf98ed
commit ae88898f58
2 changed files with 3 additions and 12 deletions

View File

@ -53,9 +53,9 @@ Goal: migrate the compiler so all values live in frames/bytecode, keeping JVM te
- [x] Step 15: Class-scope `?=` in bytecode.
- [x] Handle `C.x ?= v` and `C?.x ?= v` for class-scope members without falling back.
- [x] Add a JVM test for class-scope `?=` on static vars.
- [ ] Step 16: Remove dead `ToBoolStatement`.
- [ ] Confirm no parser/compiler paths construct `ToBoolStatement` and delete it plus interpreter hooks.
- [ ] Keep JVM tests green after removal.
- [x] Step 16: Remove dead `ToBoolStatement`.
- [x] Confirm no parser/compiler paths construct `ToBoolStatement` and delete it plus interpreter hooks.
- [x] Keep JVM tests green after removal.
- [x] Step 17: Callable property calls in bytecode.
- [x] Support `CallRef` where the target is a `FieldRef` (e.g., `(obj.fn)()`), keeping compile-time resolution.
- [x] Add a JVM test for a callable property call compiled to bytecode.

View File

@ -439,15 +439,6 @@ class ThrowStatement(
}
}
class ToBoolStatement(
val expr: Statement,
override val pos: Pos,
) : Statement() {
override suspend fun execute(scope: Scope): Obj {
return if (expr.execute(scope).toBool()) net.sergeych.lyng.obj.ObjTrue else net.sergeych.lyng.obj.ObjFalse
}
}
class ExpressionStatement(
val ref: net.sergeych.lyng.obj.ObjRef,
override val pos: Pos