Package jminusminus
Class LocalContext
java.lang.Object
jminusminus.Context
jminusminus.LocalContext
- Direct Known Subclasses:
- MethodContext
A local context is a context (scope) in which local variables (including formal parameters)
 can be declared. Local variables are allocated at fixed offsets from the base of the current
 method's stack frame; this is done during analysis. The definitions for local variables record
 these offsets. The offsets are used in code generation.
- 
Field SummaryFieldsFields inherited from class jminusminus.ContextclassContext, compilationUnitContext, entries, surroundingContext
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionintAllocates and returns a new offset (eg, for a parameter or local variable).intoffset()Returns the "next" offset.voidtoJSON(JSONElement json) Adds information pertaining to this context to the given JSON element.Methods inherited from class jminusminus.ContextaddEntry, addType, classContext, compilationUnitContext, definingType, lookup, lookupType, methodContext, names, surroundingContext
- 
Field Details- 
offsetprotected int offsetNext offset for a local variable.
 
- 
- 
Constructor Details- 
LocalContextConstructs a local context. A local context is constructed for each block.- Parameters:
- surrounding- the surrounding context.
 
 
- 
- 
Method Details- 
offsetpublic int offset()Returns the "next" offset. Not to be used for allocating new offsets (the nextOffset() method is used for that).- Returns:
- the next available offset.
 
- 
nextOffsetpublic int nextOffset()Allocates and returns a new offset (eg, for a parameter or local variable).- Returns:
- the next allocated offset.
 
- 
toJSONAdds information pertaining to this context to the given JSON element.
 
-