Allow delay in bytecode

This commit is contained in:
Sergey Chernov 2026-02-09 02:18:00 +03:00
parent 58581d6bf0
commit 5b1a8af4e3
2 changed files with 7 additions and 2 deletions

View File

@ -32,6 +32,13 @@ Goal: migrate the compiler so all values live in frames/bytecode, keeping JVM te
- [x] Step 9: Module-level bytecode execution. - [x] Step 9: Module-level bytecode execution.
- [x] Compile `Script` bodies to bytecode instead of interpreting at module scope. - [x] Compile `Script` bodies to bytecode instead of interpreting at module scope.
- [x] Keep import/module slot seeding in frame-only flow. - [x] Keep import/module slot seeding in frame-only flow.
- [ ] Step 10: Bytecode for declaration statements in module scripts.
- [ ] Support `ClassDeclStatement`, `FunctionDeclStatement`, `EnumDeclStatement` in bytecode compilation.
- [ ] Decide whether to compile declarations into module bytecode or keep a mixed execution path.
- [ ] Step 11: Destructuring assignment bytecode.
- [ ] Handle `[a, b] = expr` (AssignRef target `ListLiteralRef`) without interpreter fallback.
- [ ] Step 12: Optional member assign-ops and inc/dec in bytecode.
- [ ] Support `a?.b += 1` and `a?.b++` for `FieldRef` targets.
## Notes ## Notes

View File

@ -1967,11 +1967,9 @@ class Compiler(
is LocalSlotRef -> target.name is LocalSlotRef -> target.name
else -> null else -> null
} }
if (targetName == "delay") return true
containsUnsupportedRef(ref.target) || ref.args.any { containsUnsupportedForBytecode(it.value) } containsUnsupportedRef(ref.target) || ref.args.any { containsUnsupportedForBytecode(it.value) }
} }
is MethodCallRef -> { is MethodCallRef -> {
if (ref.name == "delay") return true
val receiverClass = resolveReceiverClassForMember(ref.receiver) ?: return true val receiverClass = resolveReceiverClassForMember(ref.receiver) ?: return true
val hasMember = receiverClass.instanceMethodIdMap(includeAbstract = true)[ref.name] != null val hasMember = receiverClass.instanceMethodIdMap(includeAbstract = true)[ref.name] != null
if (!hasMember && !hasExtensionFor(receiverClass.className, ref.name)) return true if (!hasMember && !hasExtensionFor(receiverClass.className, ref.name)) return true