LocalsVisitor
org.nlogo.compile.middle.LocalsVisitor
class LocalsVisitor(alteredLets: Map[Procedure, Map[Let, Int]]) extends DefaultAstVisitor
This is an AstVisitor that optimizes "let" variables by converting them to "locals" variables instead whenever possible, since the locals mechanism is speedier than the let mechanism.
"Whenever possible" is "whenever it's not inside an ask". We must find and convert two prims: _let and _letvariable. We also must add the variable to the procedure's locals list.
We also do the same thing with "repeat", which by default uses the "let" mechanism, but must be changed to use the "locals" mechanism when used outside "ask".
Attributes
- Source
- LocalsVisitor.scala
- Graph
-
- Supertypes
Members list
In this article