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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFinalizer(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.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.checkCallMethod(ThreadContext context, String name) checkCallMethod(ThreadContext context, JavaSites.CheckedSites sites) Methods which perform to_xxx if the object has such a methodConverts this Ruby object to a Float (using to_f).Converts this Ruby object to a Hash.Converts this Ruby object to an Integer.convertToInteger(int convertMethodIndex, String convertMethod) Deprecated.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.RubyMethod getRubyClass.RubyMethod getRuntime.RubyMethod getSingletonClass.getType()RubyMethod getType.getVariable(int index) intbooleanReturns true if object has any variables, defined as: instance variables class variables constants internal variables, such as those used when marshalling Ranges and Exceptionsid()infectBy(IRubyObject obj) Infect this object using the taint of another objectinspect()RubyMethod inspect.booleanisClass()booleanisFrozen()RubyMethod isFrozen.booleanbooleanisModule()booleanisNil()Check whether this object is nil.booleanbooleanisTaint()RubyMethod isTaint.booleanisTrue()Check whether this object is truthy.booleanRubyMethod isUntrusted.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) RubyMethod setTaint.voidsetUntrusted(boolean b) RubyMethod setUntrusted.voidsetVariable(int index, Object value) 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()private RuntimeExceptionvoidMethods 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
-
Field Details
-
UNDEFINED
-
-
Constructor Details
-
UndefinedValue
private UndefinedValue()
-
-
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) -
undefinedOperation
-
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.- 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:
-
isTaint
public boolean isTaint()RubyMethod isTaint.- Specified by:
isTaintin interfaceIRubyObject- Returns:
- boolean
-
setTaint
public void setTaint(boolean b) RubyMethod setTaint.- Specified by:
setTaintin interfaceIRubyObject- Parameters:
b-
-
infectBy
Infect this object using the taint of another object- Specified by:
infectByin interfaceIRubyObject- Parameters:
obj-- Returns:
-
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-
-
isUntrusted
public boolean isUntrusted()RubyMethod isUntrusted.- Specified by:
isUntrustedin interfaceIRubyObject- Returns:
- boolean
-
setUntrusted
public void setUntrusted(boolean b) RubyMethod setUntrusted.- Specified by:
setUntrustedin interfaceIRubyObject- Parameters:
b-
-
isImmediate
public boolean isImmediate()- Specified by:
isImmediatein interfaceIRubyObject- Returns:
-
isSpecialConst
public boolean isSpecialConst()- Specified by:
isSpecialConstin interfaceIRubyObject- Returns:
-
getMetaClass
RubyMethod getRubyClass.- Specified by:
getMetaClassin interfaceIRubyObject- Returns:
-
getSingletonClass
RubyMethod getSingletonClass.- Specified by:
getSingletonClassin interfaceIRubyObject- Returns:
- RubyClass
-
getType
RubyMethod getType.- Specified by:
getTypein interfaceIRubyObject- Returns:
- RubyClass
-
respondsTo
RubyMethod respondsTo.- Specified by:
respondsToin interfaceIRubyObject- Parameters:
string-- Returns:
- boolean
-
respondsToMissing
RubyMethod respondsTo.- Specified by:
respondsToMissingin interfaceIRubyObject- Parameters:
string-- Returns:
- boolean
-
respondsToMissing
RubyMethod respondsTo.- Specified by:
respondsToMissingin interfaceIRubyObject- Parameters:
string-- Returns:
- boolean
-
getRuntime
RubyMethod getRuntime.- Specified by:
getRuntimein interfaceIRubyObject- Returns:
-
getJavaClass
RubyMethod getJavaClass.- Specified by:
getJavaClassin interfaceIRubyObject- Returns:
- Class
-
asJavaString
Convert the object into a symbol name if possible.- Specified by:
asJavaStringin interfaceIRubyObject- Returns:
- String the symbol name
-
asString
rb_obj_as_string- Specified by:
asStringin interfaceIRubyObject- Returns:
-
convertToArray
Methods which perform to_xxx if the object has such a method- Specified by:
convertToArrayin interfaceIRubyObject- Returns:
-
convertToHash
Description copied from interface:IRubyObjectConverts this Ruby object to a Hash.- Specified by:
convertToHashin interfaceIRubyObject- Returns:
-
convertToFloat
Description copied from interface:IRubyObjectConverts this Ruby object to a Float (using to_f).- Specified by:
convertToFloatin interfaceIRubyObject- Returns:
-
convertToInteger
Description copied from interface:IRubyObjectConverts this Ruby object to an Integer. Uses the default conversion method (to_int).- Specified by:
convertToIntegerin interfaceIRubyObject- Returns:
-
convertToInteger
Deprecated.- Specified by:
convertToIntegerin interfaceIRubyObject- Returns:
- See Also:
-
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:
-
convertToString
Description copied from interface:IRubyObjectConverts this Ruby object to a String.- Specified by:
convertToStringin interfaceIRubyObject- Returns:
-
anyToString
- Specified by:
anyToStringin interfaceIRubyObject- Returns:
-
checkStringType
- Specified by:
checkStringTypein interfaceIRubyObject- Returns:
-
checkArrayType
- Specified by:
checkArrayTypein interfaceIRubyObject- Returns:
-
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.
-
dup
RubyMethod dup.- Specified by:
dupin interfaceIRubyObject- Returns:
-
inspect
RubyMethod inspect.- Specified by:
inspectin interfaceIRubyObject- Returns:
- String
-
rbClone
RubyMethod rbClone.- Specified by:
rbClonein interfaceIRubyObject- Returns:
- IRubyObject
-
isModule
public boolean isModule()- 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()- 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
- Specified by:
idin interfaceIRubyObject- Returns:
-
op_equal
- Specified by:
op_equalin interfaceIRubyObject
-
op_eqq
- Specified by:
op_eqqin interfaceIRubyObject
-
eql
- Specified by:
eqlin interfaceIRubyObject
-
addFinalizer
- Specified by:
addFinalizerin interfaceIRubyObject
-
removeFinalizers
public void removeFinalizers()- Specified by:
removeFinalizersin interfaceIRubyObject
-
hasVariables
public boolean hasVariables()Returns 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()- Specified by:
getVariableCountin interfaceIRubyObject- Returns:
- the count of all variables (ivar/cvar/constant/internal)
-
syncVariables
Deprecated.Sets 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
Sets 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
- Specified by:
getVariableListin interfaceIRubyObject- Returns:
- a list of all variables (ivar/cvar/constant/internal)
-
getInstanceVariables
- Specified by:
getInstanceVariablesin interfaceIRubyObject
-
getInternalVariables
- Specified by:
getInternalVariablesin interfaceIRubyObject
-
getVariableNameList
- 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
-