adding a check for passing guarded function result as VAR parameter
|Assignee:||J. Templ||% Done:|
If a function returns a pointer and that result is guarded to some extended type it can be passed as a VAR parameter. This leads to an illegal instruction TRAP at runtime. The compiler should report an error in such a case. For a test case see https://forum.oberoncore.ru/viewtopic.php?f=127&t=6081 .
Reported by Ilya Ermakov of oberoncore, 2017-07-07.
NotVar applied recursively also for SYSTEM.VAL. Refs: #165.
The meaning is: if SYSTEM.VAL is applied to something that is not a variable, then
the result is also not a variable.
Such a case is hard to produce because the compiler normally does not generate a SYSTEM.VAL node
when converting a pointer. However, there are (rarely used) options that turn on the generation
of SYSTEM.VAL nodes in such cases.
Using NotVar recursively makes the code easier to read and also covers such exotic cases.
Signed-off-by: Josef Templ <email@example.com>