Created
December 15, 2010 23:06
-
-
Save samskivert/742752 to your computer and use it in GitHub Desktop.
Readability
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Command (name :String, callsOtherCode :Boolean) | |
case class Procedure (name :String, commands :List[Command]) | |
case class Activation (procedure :Procedure, parent :Option[Activation], returnAddress :Int) { | |
def parentCmdName :Option[String] = | |
parent map(_.procedure.commands(returnAddress)) filter(_.callsOtherCode) map(_.name) | |
} | |
def callStack (act :Activation) :List[String] = | |
List(act.procedure.name) ++ act.parentCmdName ++ act.parent.map(callStack).flatten |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment