Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
15 lines (12 sloc) 424 Bytes
package org.monalang.monac.symbol
class Scope() {
var parent: Option[Scope] = None
val lookupTable = collection.mutable.Map[String, Symbol]()
def lookup(name: String): Option[Symbol] = lookupTable.get(name) match {
case None => if (parent != None) parent.get.lookup(name) else None
case Some(symbol) => Some(symbol)
}
def addSymbol(name: String, symbol: Symbol) {
lookupTable += name -> symbol
}
}