Scope class
A simple lexical scope to track the lifetime of variables. This helps our mapping algorithm preserve variable correctness across the entire program.
Properties
Methods
-
advanceNextId(
) → void -
Advances the next ID and returns it using the following
algorithm:
Bumps the last letter in the set to the next in the
collection
[a-z, A-Z, 0-9]. If the last letter was '9', then flip it back to 'a' and append a new alphabet entry to the_newIdlist. If_newIdis empty, then the letter "a" is inserted. If_newIdis of length 1 and is letter "Z", then skip numbers[0-9]b/c lua needs a non-number character for valid identifiers. -
createID(
String id) → String -
If
idis not already assigned a new identifier, then constructs one with_newId. Then advances the new id set via advanceNextId. -
getID(
String id) → String? -
Returns the mapped
idstored in ids. If the mappedidis not found in this scope, then walks up the Scope.parent chain until it is found. In this way we preserve lexical scoping and globals. If no id is found, null is returned. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resetNextIdFrom(
Scope other) → void -
Clears
_nextIdand copies the contents of theother's ownnextId. This should be used with caution as the two scopes could shadow variables where this is not wanted. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited