Step 5: allow bytecode for delegated var decls

This commit is contained in:
Sergey Chernov 2026-02-09 01:40:31 +03:00
parent f9fe3d1186
commit 026b023892
2 changed files with 6 additions and 4 deletions

View File

@ -19,9 +19,10 @@ Goal: migrate the compiler so all values live in frames/bytecode, keeping JVM te
- [x] Step 4: Allow bytecode wrapping for supported declaration statements. - [x] Step 4: Allow bytecode wrapping for supported declaration statements.
- [x] Enable `DestructuringVarDeclStatement` and `ExtensionPropertyDeclStatement` in `containsUnsupportedForBytecode`. - [x] Enable `DestructuringVarDeclStatement` and `ExtensionPropertyDeclStatement` in `containsUnsupportedForBytecode`.
- [x] Keep JVM tests green before commit. - [x] Keep JVM tests green before commit.
- [ ] Step 5: Enable bytecode for delegated var declarations. - [x] Step 5: Enable bytecode for delegated var declarations.
- [ ] Revisit `containsDelegatedRefs` guard for `DelegatedVarDeclStatement`. - [x] Revisit `containsDelegatedRefs` guard for `DelegatedVarDeclStatement`.
- [ ] Ensure delegate binding uses explicit `Statement` objects (no inline suspend lambdas). - [x] Ensure delegate binding uses explicit `Statement` objects (no inline suspend lambdas).
- [x] Keep JVM tests green before commit.
- [ ] Step 6: Map literal spread in bytecode. - [ ] Step 6: Map literal spread in bytecode.
- [ ] Replace `MapLiteralEntry.Spread` bytecode exception with runtime `putAll`/merge logic. - [ ] Replace `MapLiteralEntry.Spread` bytecode exception with runtime `putAll`/merge logic.
- [ ] Step 7: Class-scope member refs in bytecode. - [ ] Step 7: Class-scope member refs in bytecode.

View File

@ -1894,6 +1894,7 @@ class Compiler(
is InlineBlockStatement -> target.statements().any { containsUnsupportedForBytecode(it) } is InlineBlockStatement -> target.statements().any { containsUnsupportedForBytecode(it) }
is VarDeclStatement -> target.initializer?.let { containsUnsupportedForBytecode(it) } ?: false is VarDeclStatement -> target.initializer?.let { containsUnsupportedForBytecode(it) } ?: false
is DestructuringVarDeclStatement -> containsUnsupportedForBytecode(target.initializer) is DestructuringVarDeclStatement -> containsUnsupportedForBytecode(target.initializer)
is DelegatedVarDeclStatement -> containsUnsupportedForBytecode(target.initializer)
is BreakStatement -> target.resultExpr?.let { containsUnsupportedForBytecode(it) } ?: false is BreakStatement -> target.resultExpr?.let { containsUnsupportedForBytecode(it) } ?: false
is ContinueStatement -> false is ContinueStatement -> false
is ReturnStatement -> target.resultExpr?.let { containsUnsupportedForBytecode(it) } ?: false is ReturnStatement -> target.resultExpr?.let { containsUnsupportedForBytecode(it) } ?: false
@ -1993,7 +1994,7 @@ class Compiler(
is ExpressionStatement -> containsDelegatedRefs(target.ref) is ExpressionStatement -> containsDelegatedRefs(target.ref)
is BlockStatement -> target.statements().any { containsDelegatedRefs(it) } is BlockStatement -> target.statements().any { containsDelegatedRefs(it) }
is VarDeclStatement -> target.initializer?.let { containsDelegatedRefs(it) } ?: false is VarDeclStatement -> target.initializer?.let { containsDelegatedRefs(it) } ?: false
is DelegatedVarDeclStatement -> true is DelegatedVarDeclStatement -> containsDelegatedRefs(target.initializer)
is DestructuringVarDeclStatement -> containsDelegatedRefs(target.initializer) is DestructuringVarDeclStatement -> containsDelegatedRefs(target.initializer)
is IfStatement -> { is IfStatement -> {
containsDelegatedRefs(target.condition) || containsDelegatedRefs(target.condition) ||