gnu.kawa.reflect
Class SlotGet
java.lang.Object
gnu.mapping.PropertySet
gnu.mapping.Procedure
gnu.mapping.Procedure2
gnu.kawa.reflect.SlotGet
- All Implemented Interfaces:
- CanInline, Inlineable, HasSetter, Named
public class SlotGet
- extends Procedure2
- implements HasSetter, CanInline, Inlineable
Constructor Summary |
SlotGet(java.lang.String name,
boolean isStatic)
|
SlotGet(java.lang.String name,
boolean isStatic,
Procedure setter)
|
Method Summary |
java.lang.Object |
apply2(java.lang.Object arg1,
java.lang.Object arg2)
|
void |
compile(ApplyExp exp,
Compilation comp,
Target target)
|
static java.lang.Object |
field(java.lang.Object obj,
java.lang.String fname)
|
Type |
getReturnType(Expression[] args)
|
Procedure |
getSetter()
|
static java.lang.Object |
getSlotValue(boolean isStatic,
java.lang.Object obj,
java.lang.String name,
java.lang.String fname,
java.lang.String getName,
java.lang.String isName,
Language language)
The actual gets of finding the field value. |
Expression |
inline(ApplyExp exp,
ExpWalker walker)
Inline an application of this Procedure and return result. |
static Member |
lookupMember(ClassType clas,
java.lang.String name,
ClassType caller)
Get a named property - field or 'get' accessor method. |
static ApplyExp |
makeGetField(Expression value,
java.lang.String fieldName)
Convenience method to make an Expression that gets the value of a field. |
void |
set2(java.lang.Object obj,
java.lang.Object name,
java.lang.Object value)
|
void |
setN(java.lang.Object[] args)
|
static java.lang.Object |
staticField(java.lang.Object obj,
java.lang.String fname)
|
Methods inherited from class gnu.mapping.Procedure |
apply, apply, check0, check1, check2, check3, check4, checkArgCount, checkN, getSourceLocation, match0, match1, match2, match3, match4, matchN, maxArgs, minArgs, set0, set1, setSetter, setSourceLocation, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
field
public static final SlotGet field
slotRef
public static final SlotGet slotRef
staticField
public static final SlotGet staticField
SlotGet
public SlotGet(java.lang.String name,
boolean isStatic)
SlotGet
public SlotGet(java.lang.String name,
boolean isStatic,
Procedure setter)
field
public static java.lang.Object field(java.lang.Object obj,
java.lang.String fname)
staticField
public static java.lang.Object staticField(java.lang.Object obj,
java.lang.String fname)
apply2
public java.lang.Object apply2(java.lang.Object arg1,
java.lang.Object arg2)
- Specified by:
apply2
in class Procedure2
getSlotValue
public static java.lang.Object getSlotValue(boolean isStatic,
java.lang.Object obj,
java.lang.String name,
java.lang.String fname,
java.lang.String getName,
java.lang.String isName,
Language language)
- The actual gets of finding the field value.
The compiler emits calls to this method if the field name is literals
but the actual field is not known at compile time.
This speeds lookup a bit.
setN
public void setN(java.lang.Object[] args)
- Overrides:
setN
in class Procedure
set2
public void set2(java.lang.Object obj,
java.lang.Object name,
java.lang.Object value)
lookupMember
public static Member lookupMember(ClassType clas,
java.lang.String name,
ClassType caller)
- Get a named property - field or 'get' accessor method.
- Parameters:
clas
- the class type declaring the property.name
- the source (unmangled) name of the property.
inline
public Expression inline(ApplyExp exp,
ExpWalker walker)
- Description copied from interface:
CanInline
- Inline an application of this Procedure and return result.
Can return original expression.
- Specified by:
inline
in interface CanInline
compile
public void compile(ApplyExp exp,
Compilation comp,
Target target)
- Specified by:
compile
in interface Inlineable
getReturnType
public Type getReturnType(Expression[] args)
- Specified by:
getReturnType
in interface Inlineable
getSetter
public Procedure getSetter()
- Specified by:
getSetter
in interface HasSetter
- Overrides:
getSetter
in class Procedure
makeGetField
public static ApplyExp makeGetField(Expression value,
java.lang.String fieldName)
- Convenience method to make an Expression that gets the value of a field.
- Parameters:
value
- evaluates to object that has the named fieldfieldName
- name of field in value
- Returns:
- expression that get the name field from value