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
trait AstVisitor
class Object
trait Matchable
class Any

Members list

Type members

Classlikes

Attributes

Source
LocalsVisitor.scala
Supertypes
trait AstFolder[(Int, Map[Let, Boolean])]
class Object
trait Matchable
class Any

Value members

Concrete methods

Attributes

Definition Classes
Source
LocalsVisitor.scala
override def visitReporterApp(expr: ReporterApp): Unit

Attributes

Definition Classes
Source
LocalsVisitor.scala
override def visitStatement(stmt: Statement): Unit

Attributes

Definition Classes
Source
LocalsVisitor.scala

Inherited methods

Attributes

Inherited from:
DefaultAstVisitor
Source
AstVisitor.scala

Attributes

Inherited from:
DefaultAstVisitor
Source
AstVisitor.scala

Attributes

Inherited from:
DefaultAstVisitor
Source
AstVisitor.scala