diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2017-05-13 10:40:23 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2017-05-13 10:40:23 +0100 |
commit | febbfabe516ed12070f11ba4a9381692352ea12b (patch) | |
tree | 81675cd3a5b8c0e37012e7f0c464b101061a4634 | |
parent | 58dc45498e22b4a5c7f26633f31313a040de3c75 (diff) | |
download | lace-febbfabe516ed12070f11ba4a9381692352ea12b.tar.gz |
Check in allow/deny that names are defined
-rw-r--r-- | lib/lace/builtin.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/lace/builtin.lua b/lib/lace/builtin.lua index e7ecd1b..da728a3 100644 --- a/lib/lace/builtin.lua +++ b/lib/lace/builtin.lua @@ -138,6 +138,16 @@ local function _return(compcontext, result, reason, ...) local cond = {...} if #cond == 0 then unconditional_result = result + else + compcontext._lace.defined = (compcontext._lace.defined or {}) + for i, dname in ipairs(cond) do + if dname:sub(1,1) == "!" then + dname = dname:sub(2) + end + if not compcontext._lace.defined[dname] then + return err.error("Undefined name used in condition ("..dname..")", {i+2}) + end + end end last_result = result |