Implements a validation pass for code running at compile-time or in NimScript/REPL contexts.
Future direction: this validation needs to be decoupled from the JIT and moved into the semantic analyisis layer.
Procs
proc validate(env: MirEnv; n: PNode): Result[void, VmGenDiag] {....raises: [], tags: [].}
-
Checks that the transformed AST n:
- doesn't use inaccessible globals
- doesn't use methods (either calling them or using them as value)
- doesn't use forwarded procedures
If the AST violates these, the VmGenDiag for the first error is returned.
Source Edit