Package iota

Class MethodContext


class MethodContext extends LocalContext
A method context is where formal parameters are declared. Also, it's where we start computing the offsets for local variables (formal parameters included), which are allocated in the current stack frame (for a method invocation).
  • Constructor Details

    • MethodContext

      public MethodContext(Context surrounding, Type methodReturnType)
      Constructs a method context.
      Parameters:
      surrounding - the surrounding (class) context.
      methodReturnType - return type of this method.
  • Method Details

    • confirmMethodHasReturn

      public void confirmMethodHasReturn()
      Records fact that (non-void) method has at least one return.
    • methodHasReturn

      public boolean methodHasReturn()
      Returns true if this (non-void) method has at least one return, and false otherwise.
      Returns:
      true if this (non-void) method has at least one return, and false otherwise.
    • methodReturnType

      public Type methodReturnType()
      Returns the return type of this method.
      Returns:
      the return type of this method.
    • toJSON

      public void toJSON(JSONElement json)
      Adds information pertaining to this context to the given JSON element.
      Overrides:
      toJSON in class LocalContext
      Parameters:
      json - JSON element.