google / starlark-go

Starlark in Go: the Starlark configuration language, implemented in Go
BSD 3-Clause "New" or "Revised" License
2.3k stars 209 forks source link

starlark: report "uninitialized cell" errors gracefully #341

Closed alandonovan closed 3 years ago

alandonovan commented 3 years ago

The contents of a cell may be null, just like any other local. We should report this as an error.

So that we can name the variable in the error message, we change the instruction set so that LOCAL<local>+CELL are combined into a single LOCALCELL<local> instruction, and FREE<free>+CELL become a single FREECELL<free> instruction. For symmetry we also combine LOCAL<local>+SETCELL into SETLOCALCELL, though it cannot fail. (Happily, all three changes are optimizations previously described by TODO comments.)

Fixes #340