Package jminusminus
Class MethodContext
java.lang.Object
jminusminus.Context
jminusminus.LocalContext
jminusminus.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 jminusminus.LocalContext
offset
Fields inherited from class jminusminus.Context
classContext, compilationUnitContext, entries, surroundingContext
-
Constructor Summary
ConstructorDescriptionMethodContext
(Context surrounding, boolean isStatic, Type methodReturnType) Constructs a method context. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Records fact that (non-void) method has at least one return.boolean
isStatic()
Returns true if this is a static method, and false otherwise.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 jminusminus.LocalContext
nextOffset, offset
Methods inherited from class jminusminus.Context
addEntry, addType, classContext, compilationUnitContext, definingType, lookup, lookupType, methodContext, names, surroundingContext
-
Constructor Details
-
MethodContext
Constructs a method context.- Parameters:
surrounding
- the surrounding (class) context.isStatic
- is this method static?methodReturnType
- return type of this method.
-
-
Method Details
-
isStatic
public boolean isStatic()Returns true if this is a static method, and false otherwise.- Returns:
- true if this is a static method, and false otherwise.
-
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.
-