feat: add clearer error message for forward-referenced lowercase module variables

Add a new error code (-3) from wrenDefineVariable to detect when a lowercase (local-style) module variable is referenced before its definition. The compiler now reports the line of the first use, improving diagnostics for forward-declared top-level variables.
This commit is contained in:
underscorediscovery
2019-10-01 03:30:27 +00:00
parent a9df915c0c
commit 4954c0b4f2
5 changed files with 37 additions and 15 deletions
@@ -0,0 +1,5 @@
if (false) {
System.print(a)
}
var a = 123 // expect error: Error at '123': Variable 'a' referenced before this definition (first use at line 2).