Package iota
Class MethodContext
java.lang.Object
iota.Context
iota.LocalContext
iota.MethodContext
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).
-
Field Summary
Fields inherited from class iota.LocalContext
offset
Fields inherited from class iota.Context
compilationUnitContext, entries, surroundingContext
-
Constructor Summary
ConstructorsConstructorDescriptionMethodContext
(Context surrounding, Type methodReturnType) Constructs a method context. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Records fact that (non-void) method has at least one return.boolean
Returns true if this (non-void) method has at least one return, and false otherwise.Returns the return type of this method.void
toJSON
(JSONElement json) Adds information pertaining to this context to the given JSON element.Methods inherited from class iota.LocalContext
nextOffset, offset
Methods inherited from class iota.Context
addEntry, addType, compilationUnitContext, definingType, lookup, methodContext, names, surroundingContext
-
Constructor Details
-
MethodContext
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
Returns the return type of this method.- Returns:
- the return type of this method.
-
toJSON
Adds information pertaining to this context to the given JSON element.- Overrides:
toJSON
in classLocalContext
- Parameters:
json
- JSON element.
-