Apply changes to a typed region as patches to its own header

Instrument.Patches works out the opcode changes that make region i read as an
updated Region, checking them against the reader, and Instrument.Apply makes
them in the document. Only the changed settings are touched, always in the
region's own header, so unknown opcodes and what other regions inherit stay as
they are. A change the header can't hold is an error and changes nothing.

FlatRegion gains Own, Inherited and Header to trace a region to its source, and
regionLines lists a region's opcodes with the field each sets.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 18:42:17 +00:00
co-authored by Claude Sonnet 5.5
parent 359de59033
commit 83c905633c
7 changed files with 704 additions and 102 deletions
+3
View File
@@ -23,6 +23,9 @@ func TestModelTags(t *testing.T) {
names := map[string]bool{}
for i := 0; i < typ.NumField(); i++ {
f := typ.Field(i)
if !f.IsExported() {
continue
}
tag := f.Tag
name, _, _ := strings.Cut(tag.Get("json"), ",")
if name == "" || name == "-" || names[name] || name != strings.ToLower(name[:1])+name[1:] {