Package org.jruby.ir.operands
Class UndefinedValue
java.lang.Object
org.jruby.ir.operands.Operand
org.jruby.ir.operands.UndefinedValue
- All Implemented Interfaces:
IRubyObject
For argument processing. If an opt arg does not exist we will return
this so instrs can reason about non-existent arguments.
Since this value can be temporarily stored in a binding, we need it to be an IRubyObject as well.
But since it can never really participate in any operation, all calls throw a runtime exception.
-
Field Summary
FieldsFields inherited from class org.jruby.ir.operands.Operand
EMPTY_ARRAYFields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFinalizer(IRubyObject finalizer) addFinalizer(ThreadContext context, IRubyObject finalizer) voidAppend the list of variables used in this operand to the input list -- force every operand to implement this because a missing implementation can cause bad failures.make this object into a string (hopefully)Convert the object into a symbol name if possible.asString()rb_obj_as_stringcallMethod(ThreadContext context, int methodIndex, String name) Deprecated.callMethod(ThreadContext context, int methodIndex, String name, IRubyObject arg) Deprecated.callMethod(ThreadContext context, String name) callMethod(ThreadContext context, String name, IRubyObject arg) callMethod(ThreadContext context, String name, IRubyObject[] args) callMethod(ThreadContext context, String name, IRubyObject[] args, Block block) callSuper(ThreadContext context, IRubyObject[] args, Block block) Deprecated.booleanCan we replace every use of a variable 'v' that contains the value of this operand with the operand itself? This takes importance when there are at least two uses of 'v' within this scope.is this an array if so return it otherwise nilcheckCallMethod(ThreadContext context, String name) checkCallMethod(ThreadContext context, JavaSites.CheckedSites sites) is this a string if so return it otherwise nilConverts this Ruby object to an Array.Converts this Ruby object to a Float (using to_f).Converts this Ruby object to a Hash.Converts this Ruby object to an Integer.convertToInteger(String convertMethod) Converts this Ruby object to an Integer.Converts this Ruby object to a String.voidOur version of Data_Get_Struct.Deprecated.voiddataWrapStruct(Object obj) Our version of Data_Wrap_Struct.dup()RubyMethod dup.booleaneql(IRubyObject other) RubyMethod getJavaClass.Retrieveself.class.RubyMethod getRuntime.Retrieveself.singleton_class.getType()RubyMethod getType.getVariable(int index) inthow many variables?list of all variableslist of all variable namesbooleanReturns true if object has any variables, defined as: instance variables class variables constants internal variables, such as those used when marshalling Ranges and Exceptionsid()The id of the objectinfectBy(IRubyObject obj) Deprecated.inspect()RubyMethod inspect.booleanisClass()If is_a? semantics is required, use(someObject instanceof RubyClass/MetaClass)instead.booleanisFrozen()RubyMethod isFrozen.booleanIs this an immediate objectbooleanisModule()If is_a? semantics is required, use(someObject instanceof RubyModule)instead.booleanisNil()Check whether this object is nil.booleanIs this a special constantbooleanisTaint()Deprecated.booleanisTrue()Check whether this object is truthy.booleanDeprecated.op_eqq(ThreadContext context, IRubyObject other) op_equal(ThreadContext context, IRubyObject other) rbClone()RubyMethod rbClone.voidbooleanrespondsTo(String string) RubyMethod respondsTo.booleanrespondsToMissing(String string) RubyMethod respondsTo.booleanrespondsToMissing(String string, boolean priv) RubyMethod respondsTo.retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) voidsetFrozen(boolean b) RubyMethod setFrozen.voidsetTaint(boolean b) Deprecated.voidsetUntrusted(boolean b) Deprecated.voidsetVariable(int index, Object value) singletonClass(ThreadContext context) voidsyncVariables(List<Variable<Object>> variables) Deprecated.voidsyncVariables(IRubyObject source) Sets object's variables to those in the supplied object, removing/replacing any previously defined variables of the same name.Convert the object to the specified Java class, if possible.toString()voidMethods inherited from class org.jruby.ir.operands.Operand
encode, getSimplifiedOperand, getValue, hasKnownValue, isFalseyImmediate, isTruthyImmediateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jruby.runtime.builtin.IRubyObject
checkStringType19, convertToInteger, dup, getMarshalVariableList, inspect, marshalLiveVariables
-
Field Details
-
UNDEFINED
-
-
Method Details
-
getOperandType
- Specified by:
getOperandTypein classOperand
-
addUsedVariables
Description copied from class:OperandAppend the list of variables used in this operand to the input list -- force every operand to implement this because a missing implementation can cause bad failures.- Specified by:
addUsedVariablesin classOperand
-
cloneForInlining
- Specified by:
cloneForInliningin classOperand
-
canCopyPropagate
public boolean canCopyPropagate()Description copied from class:OperandCan we replace every use of a variable 'v' that contains the value of this operand with the operand itself? This takes importance when there are at least two uses of 'v' within this scope. Ex: v = [1,2,3]; x = v; y = v In this case, we cannot replace the occurrences of 'v' because we would then get x = [1,2,3]; y = [1,2,3] which would then result in two different array objects being constructed instead of a single one.- Overrides:
canCopyPropagatein classOperand- Returns:
- true if it is safe to copy-propagate the operand.
-
retrieve
public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) -
callSuper
Deprecated.- Specified by:
callSuperin interfaceIRubyObject
-
callMethod
- Specified by:
callMethodin interfaceIRubyObject
-
callMethod
- Specified by:
callMethodin interfaceIRubyObject
-
callMethod
- Specified by:
callMethodin interfaceIRubyObject
-
callMethod
- Specified by:
callMethodin interfaceIRubyObject
-
callMethod
Deprecated.- Specified by:
callMethodin interfaceIRubyObject
-
callMethod
@Deprecated public IRubyObject callMethod(ThreadContext context, int methodIndex, String name, IRubyObject arg) Deprecated.- Specified by:
callMethodin interfaceIRubyObject
-
checkCallMethod
- Specified by:
checkCallMethodin interfaceIRubyObject
-
checkCallMethod
- Specified by:
checkCallMethodin interfaceIRubyObject
-
isNil
public boolean isNil()Description copied from interface:IRubyObjectCheck whether this object is nil. MRI: NIL_P macro- Specified by:
isNilin interfaceIRubyObject- Returns:
- true for
nilonly
-
isTrue
public boolean isTrue()Description copied from interface:IRubyObjectCheck whether this object is truthy.- Specified by:
isTruein interfaceIRubyObject- Returns:
- false for
nilandfalse, true otherwise
-
isFrozen
public boolean isFrozen()RubyMethod isFrozen.- Specified by:
isFrozenin interfaceIRubyObject- Returns:
- boolean
-
setFrozen
public void setFrozen(boolean b) RubyMethod setFrozen.- Specified by:
setFrozenin interfaceIRubyObject- Parameters:
b-
-
isImmediate
public boolean isImmediate()Description copied from interface:IRubyObjectIs this an immediate object- Specified by:
isImmediatein interfaceIRubyObject- Returns:
- boolean
-
isSpecialConst
public boolean isSpecialConst()Description copied from interface:IRubyObjectIs this a special constant- Specified by:
isSpecialConstin interfaceIRubyObject- Returns:
- boolean
-
getMetaClass
Description copied from interface:IRubyObjectRetrieveself.class.- Specified by:
getMetaClassin interfaceIRubyObject- Returns:
- the Ruby (meta) class
-
getSingletonClass
Description copied from interface:IRubyObjectRetrieveself.singleton_class.- Specified by:
getSingletonClassin interfaceIRubyObject- Returns:
- the Ruby singleton class
-
singletonClass
- Specified by:
singletonClassin interfaceIRubyObject
-
getType
Description copied from interface:IRubyObjectRubyMethod getType.- Specified by:
getTypein interfaceIRubyObject- Returns:
- RubyClass
-
respondsTo
Description copied from interface:IRubyObjectRubyMethod respondsTo.- Specified by:
respondsToin interfaceIRubyObject- Parameters:
string- method name- Returns:
- boolean
-
respondsToMissing
Description copied from interface:IRubyObjectRubyMethod respondsTo.- Specified by:
respondsToMissingin interfaceIRubyObject- Parameters:
string- method name- Returns:
- boolean
-
respondsToMissing
Description copied from interface:IRubyObjectRubyMethod respondsTo.- Specified by:
respondsToMissingin interfaceIRubyObject- Parameters:
string- method namepriv- private?- Returns:
- boolean
-
getRuntime
Description copied from interface:IRubyObjectRubyMethod getRuntime.- Specified by:
getRuntimein interfaceIRubyObject- Returns:
- the Ruby runtime this belongs to
-
getJavaClass
Description copied from interface:IRubyObjectRubyMethod getJavaClass.- Specified by:
getJavaClassin interfaceIRubyObject- Returns:
- Class
-
asJavaString
Description copied from interface:IRubyObjectConvert the object into a symbol name if possible.- Specified by:
asJavaStringin interfaceIRubyObject- Returns:
- String the symbol name
-
asString
Description copied from interface:IRubyObjectrb_obj_as_string- Specified by:
asStringin interfaceIRubyObject- Returns:
- string representation
-
convertToArray
Description copied from interface:IRubyObjectConverts this Ruby object to an Array.- Specified by:
convertToArrayin interfaceIRubyObject- Returns:
- an array value
-
convertToHash
Description copied from interface:IRubyObjectConverts this Ruby object to a Hash.- Specified by:
convertToHashin interfaceIRubyObject- Returns:
- a hash value
-
convertToFloat
Description copied from interface:IRubyObjectConverts this Ruby object to a Float (using to_f).- Specified by:
convertToFloatin interfaceIRubyObject- Returns:
- a float value
-
convertToInteger
Description copied from interface:IRubyObjectConverts this Ruby object to an Integer. Uses the default conversion method (to_int).- Specified by:
convertToIntegerin interfaceIRubyObject- Returns:
- an integer value
-
convertToInteger
Description copied from interface:IRubyObjectConverts this Ruby object to an Integer.- Specified by:
convertToIntegerin interfaceIRubyObject- Parameters:
convertMethod- method to use e.g. to_i- Returns:
- an integer value
-
convertToString
Description copied from interface:IRubyObjectConverts this Ruby object to a String.- Specified by:
convertToStringin interfaceIRubyObject- Returns:
- a string value
-
anyToString
Description copied from interface:IRubyObjectmake this object into a string (hopefully)- Specified by:
anyToStringin interfaceIRubyObject- Returns:
- a string value
-
checkStringType
Description copied from interface:IRubyObjectis this a string if so return it otherwise nil- Specified by:
checkStringTypein interfaceIRubyObject- Returns:
- nil if type check failed
-
checkArrayType
Description copied from interface:IRubyObjectis this an array if so return it otherwise nil- Specified by:
checkArrayTypein interfaceIRubyObject- Returns:
- nil if type check failed
-
toJava
Convert the object to the specified Java class, if possible.- Specified by:
toJavain interfaceIRubyObject- Parameters:
cls- The target type to which the object should be converted.- Returns:
- java type
-
dup
Description copied from interface:IRubyObjectRubyMethod dup.- Specified by:
dupin interfaceIRubyObject- Returns:
- a dup-ed object
-
inspect
Description copied from interface:IRubyObjectRubyMethod inspect.- Specified by:
inspectin interfaceIRubyObject- Returns:
- String
-
rbClone
RubyMethod rbClone.- Specified by:
rbClonein interfaceIRubyObject- Returns:
- IRubyObject
-
isModule
public boolean isModule()Description copied from interface:IRubyObjectIf is_a? semantics is required, use(someObject instanceof RubyModule)instead.- Specified by:
isModulein interfaceIRubyObject- Returns:
- true if an object is Ruby Module instance (note that it will return false for Ruby Classes).
If is_a? semantics is required, use
(someObject instanceof RubyModule)instead.
-
isClass
public boolean isClass()Description copied from interface:IRubyObjectIf is_a? semantics is required, use(someObject instanceof RubyClass/MetaClass)instead.- Specified by:
isClassin interfaceIRubyObject- Returns:
- true if an object is Ruby Class instance (note that it will return false for Ruby singleton classes).
If is_a? semantics is required, use
(someObject instanceof RubyClass/MetaClass)instead.
-
dataWrapStruct
Our version of Data_Wrap_Struct. This method will just set a private pointer to the object provided. This pointer is transient and will not be accessible from Ruby.- Specified by:
dataWrapStructin interfaceIRubyObject- Parameters:
obj- the object to wrap
-
dataGetStruct
Our version of Data_Get_Struct. Returns a wrapped data value if there is one, otherwise returns null.- Specified by:
dataGetStructin interfaceIRubyObject- Returns:
- the object wrapped.
-
id
Description copied from interface:IRubyObjectThe id of the object- Specified by:
idin interfaceIRubyObject- Returns:
- the object id
-
op_equal
- Specified by:
op_equalin interfaceIRubyObject
-
op_eqq
- Specified by:
op_eqqin interfaceIRubyObject
-
eql
- Specified by:
eqlin interfaceIRubyObject
-
addFinalizer
- Specified by:
addFinalizerin interfaceIRubyObject
-
addFinalizer
- Specified by:
addFinalizerin interfaceIRubyObject
-
removeFinalizers
public void removeFinalizers()- Specified by:
removeFinalizersin interfaceIRubyObject
-
hasVariables
public boolean hasVariables()Description copied from interface:IRubyObjectReturns true if object has any variables, defined as:- instance variables
- class variables
- constants
- internal variables, such as those used when marshalling Ranges and Exceptions
- Specified by:
hasVariablesin interfaceIRubyObject- Returns:
- true if object has any variables, else false
-
getVariableCount
public int getVariableCount()Description copied from interface:IRubyObjecthow many variables?- Specified by:
getVariableCountin interfaceIRubyObject- Returns:
- the count of all variables (ivar/cvar/constant/internal)
-
syncVariables
Deprecated.Description copied from interface:IRubyObjectSets object's variables to those in the supplied list, removing/replacing any previously defined variables. Applies to all variable types (ivar/cvar/constant/internal).- Specified by:
syncVariablesin interfaceIRubyObject- Parameters:
variables- the variables to be set for object
-
syncVariables
Description copied from interface:IRubyObjectSets object's variables to those in the supplied object, removing/replacing any previously defined variables of the same name. Applies to all variable types (ivar/cvar/constant/internal).- Specified by:
syncVariablesin interfaceIRubyObject- Parameters:
source- the source object containing the variables to sync
-
getVariableList
Description copied from interface:IRubyObjectlist of all variables- Specified by:
getVariableListin interfaceIRubyObject- Returns:
- a list of all variables (ivar/internal)
-
getInstanceVariables
- Specified by:
getInstanceVariablesin interfaceIRubyObject
-
getInternalVariables
- Specified by:
getInternalVariablesin interfaceIRubyObject
-
getVariableNameList
Description copied from interface:IRubyObjectlist of all variable names- Specified by:
getVariableNameListin interfaceIRubyObject- Returns:
- a list of all variable names (ivar/cvar/constant/internal)
-
copySpecialInstanceVariables
- Specified by:
copySpecialInstanceVariablesin interfaceIRubyObject
-
getVariable
- Specified by:
getVariablein interfaceIRubyObject
-
setVariable
- Specified by:
setVariablein interfaceIRubyObject
-
toString
-
visit
-
dataGetStructChecked
Deprecated.- Specified by:
dataGetStructCheckedin interfaceIRubyObject
-
isTaint
Deprecated.- Specified by:
isTaintin interfaceIRubyObject
-
setTaint
Deprecated.- Specified by:
setTaintin interfaceIRubyObject
-
infectBy
Deprecated.- Specified by:
infectByin interfaceIRubyObject
-
isUntrusted
Deprecated.Description copied from interface:IRubyObjectRubyMethod isUntrusted.- Specified by:
isUntrustedin interfaceIRubyObject- Returns:
- boolean
-
setUntrusted
Deprecated.Description copied from interface:IRubyObjectRubyMethod setUntrusted.- Specified by:
setUntrustedin interfaceIRubyObject- Parameters:
b- boolean
-