mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
Adds:
- analyzer/LocalVariableScope: tracks local variables created within a given scope.
- Instantiated on the stack during semantic analysis, this registers itself with LocalVariableScopes during construction and deregisters itself during destruction.
- Detects unused variables during deregistration
- analyzer/LocalVariableScopes: this is what LocalVariableScope registers with.
- keeps track of the stack of local scopes.
- can provide the current local scope, for var statements.
Other notes:
"Shadowed" variables: this is when a variable in one scope hides a variable in another, like so:
var a := 2;
if (a)
var a := 3;
a := 4;
endif
print(a); // still 2
"debug_variables": We'll use these later when writing debug files.
|
||
|---|---|---|
| .. | ||
| prog01.out | ||
| prog01.src | ||
| prog02.out | ||
| prog02.src | ||
| prog03.out | ||
| prog03.src | ||
| prog04.out | ||
| prog04.src | ||
| prog05.out | ||
| prog05.src | ||
| prog06-vars-are-local.out | ||
| prog06-vars-are-local.src | ||