Accept StringChunk where String is accepted: chunk setProp, script()/member(), arithmetic - #241
Open
TylerHamilton7 wants to merge 3 commits into
Open
Accept StringChunk where String is accepted: chunk setProp, script()/member(), arithmetic#241TylerHamilton7 wants to merge 3 commits into
TylerHamilton7 wants to merge 3 commits into
Conversation
Director MX chunk assignment (str.char[i] = x) compiles to objCall setProp on a chunk-typed receiver. StringChunkHandlers::call had no SetProp arm and fell through with "No handler setProp for string chunk datum". Dispatches SetProp to a set_prop_call that resolves the inner range the way get_prop_inner parses its args, then writes through set_contents. Note set_value is not usable here: it ignores the chunk expression and replaces the entire source, which truncates the field to the chunk being written. Refs igorlira#237 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
script(str.item[1]) raised "Invalid identifier for script" and member(str.item[k]) raised "Member number or name type invalid: string chunk", because both matched Datum::String explicitly and the fallback coerced to int. Adds StringChunk arms mirroring the String ones. Refs igorlira#237 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
add/subtract/multiply/divide have (String, Int|Float) arms for Director's numeric-string coercion but no StringChunk arms, so a chunk operand raised "Invalid operands". All four normalise through symbol_as_arithmetic_operand(), so one arm there covers every op. Refs igorlira#237 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
TylerHamilton7
requested a deployment
to
fork-pr-tests
August 27, 2026 18:47 — with
GitHub Actions
Waiting
TylerHamilton7
requested a deployment
to
fork-pr-tests
August 27, 2026 18:47 — with
GitHub Actions
Waiting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the three fixes from #237. One commit per lettered part, so they can be reviewed or dropped independently.
a)
setPropon a string chunk. DispatchesSetProponStringChunkHandlersto aset_prop_callthat resolves the(chunkType, start[, end], value)range the wayget_prop_innerparses its args.It writes through
set_contents, notset_valueas I suggested in the issue text.set_valueignores itschunk_exprand replaces the entire source, so writing the modified chunk back through it truncates the field to just that chunk. I hit this in a local build before catching it — Junk Food Jack marks a collected item withmember("roomN","screens").line[y].word[x] = "--", and withset_valuethe first pickup silently truncated that room's 19-line map to a single line. There is a comment at the call site.b)
script()/member()identifiers.StringChunkarms inMovieHandlers::script()andCastManager::find_member_ref_by_identifiers, mirroring the existingStringarms.c) Arithmetic operand. One arm in
symbol_as_arithmetic_operand(), which all four ops already route through.Repros: Junk Food Jack (Flashpoint
80cd4672-5b7c-46cb-bcb9-ea4adef35bdb) — collect any item (a); change room or die (b). Samurai Jack in Cavern Raid (36ec1007-0b46-4bb6-91bb-30ef37301189) — start a game (c).Verified:
cargo check --target wasm32-unknown-unknownis clean on this branch againstmain. On awasm-packbuild ofmainwith this plus my two companion PRs applied, Junk Food Jack collects items, changes rooms and re-enters previously-visited rooms with their maps intact.Fixes #237
🤖 Generated with Claude Code