Overview
| Artifact ID: | 4d9f7346cd669d6eb30e7b346bb9d10cbab9bb0de8ca21e3a6ee3a149c8ae24a |
|---|---|
| Page Name: | branch/compile-uplevel |
| Date: | 2025-06-26 14:43:30 |
| Original User: | dkf |
| Mimetype: | text/x-markdown |
Content
Adds compilation for the uplevel command. This requires one new opcodes, INST_UPLEVEL, that takes two values on the stack (level, script) and produces one (result). Concatenation of arguments, if required, is handled by the compiled instruction sequence.
Note that the compiler requires the first argument to be known at compile time (so it can be definitely parsed to see if it is a level), and cannot handle a call with a single argument. This is caused by a flaw in the semantics of, say, uplevel 1 which currently parses as an error in all cases. The correct fix, similar to how switch was also fixed, is to say that when a single argument is present, it is always a script and never interpreted as anything else. This will require a TIP to fix.