Skip to content

Commit

Permalink
special variables should not cause that to die
Browse files Browse the repository at this point in the history
  • Loading branch information
Stevan Little committed Apr 11, 2013
1 parent 6ef5fb6 commit e712210
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/scala/org/moe/interpreter/InterpreterUtils.scala
Expand Up @@ -118,7 +118,7 @@ object InterpreterUtils {
case VariableDeclarationNode(varname, _) =>
declared += varname
case VariableAccessNode(varname) =>
if (!env.has(varname) && !declared(varname)) {
if (!env.has(varname) && !declared(varname) && !env.isSpecialMarker(varname)) {
throw new MoeErrors.VariableNotFound(varname)
}
case _ => Unit
Expand Down
5 changes: 5 additions & 0 deletions src/main/scala/org/moe/runtime/MoeEnvironment.scala
Expand Up @@ -22,6 +22,11 @@ class MoeEnvironment(
val Topic = "$_"
}

def isSpecialMarker(m: String) =
m == Markers.Runtime || m == Markers.Package ||
m == Markers.Class || m == Markers.Invocant ||
m == Markers.Topic

private val pad: Map[String, MoeObject] = new HashMap[String, MoeObject]()

def getCurrentRuntime : Option[MoeRuntime] = getAs[MoeRuntime](Markers.Runtime)
Expand Down

0 comments on commit e712210

Please sign in to comment.