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_ARRAY
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addFinalizer
(IRubyObject finalizer) addFinalizer
(ThreadContext context, IRubyObject finalizer) void
Append 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.boolean
Can 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.void
Our version of Data_Get_Struct.Deprecated.void
dataWrapStruct
(Object obj) Our version of Data_Wrap_Struct.dup()
RubyMethod dup.boolean
eql
(IRubyObject other) RubyMethod getJavaClass.Retrieveself.class
.RubyMethod getRuntime.Retrieveself.singleton_class
.getType()
RubyMethod getType.getVariable
(int index) int
how many variables?list of all variableslist of all variable namesboolean
Returns 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.boolean
isClass()
If is_a? semantics is required, use(someObject instanceof RubyClass/MetaClass)
instead.boolean
isFrozen()
RubyMethod isFrozen.boolean
Is this an immediate objectboolean
isModule()
If is_a? semantics is required, use(someObject instanceof RubyModule)
instead.boolean
isNil()
Check whether this object is nil.boolean
Is this a special constantboolean
isTaint()
Deprecated.boolean
isTrue()
Check whether this object is truthy.boolean
Deprecated.op_eqq
(ThreadContext context, IRubyObject other) op_equal
(ThreadContext context, IRubyObject other) rbClone()
RubyMethod rbClone.void
boolean
respondsTo
(String string) RubyMethod respondsTo.boolean
respondsToMissing
(String string) RubyMethod respondsTo.boolean
respondsToMissing
(String string, boolean priv) RubyMethod respondsTo.retrieve
(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) void
setFrozen
(boolean b) RubyMethod setFrozen.void
setTaint
(boolean b) Deprecated.void
setUntrusted
(boolean b) Deprecated.void
setVariable
(int index, Object value) singletonClass
(ThreadContext context) void
syncVariables
(List<Variable<Object>> variables) Deprecated.void
syncVariables
(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()
void
Methods inherited from class org.jruby.ir.operands.Operand
encode, getSimplifiedOperand, getValue, hasKnownValue, isFalseyImmediate, isTruthyImmediate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jruby.runtime.builtin.IRubyObject
checkStringType19, convertToInteger, dup, getMarshalVariableList, inspect, marshalLiveVariables
-
Field Details
-
UNDEFINED
-
-
Method Details
-
getOperandType
- Specified by:
getOperandType
in classOperand
-
addUsedVariables
Description copied from class:Operand
Append 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:
addUsedVariables
in classOperand
-
cloneForInlining
- Specified by:
cloneForInlining
in classOperand
-
canCopyPropagate
public boolean canCopyPropagate()Description copied from class:Operand
Can 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:
canCopyPropagate
in 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:
callSuper
in interfaceIRubyObject
-
callMethod
- Specified by:
callMethod
in interfaceIRubyObject
-
callMethod
- Specified by:
callMethod
in interfaceIRubyObject
-
callMethod
- Specified by:
callMethod
in interfaceIRubyObject
-
callMethod
- Specified by:
callMethod
in interfaceIRubyObject
-
callMethod
Deprecated.- Specified by:
callMethod
in interfaceIRubyObject
-
callMethod
@Deprecated public IRubyObject callMethod(ThreadContext context, int methodIndex, String name, IRubyObject arg) Deprecated.- Specified by:
callMethod
in interfaceIRubyObject
-
checkCallMethod
- Specified by:
checkCallMethod
in interfaceIRubyObject
-
checkCallMethod
- Specified by:
checkCallMethod
in interfaceIRubyObject
-
isNil
public boolean isNil()Description copied from interface:IRubyObject
Check whether this object is nil. MRI: NIL_P macro- Specified by:
isNil
in interfaceIRubyObject
- Returns:
- true for
nil
only
-
isTrue
public boolean isTrue()Description copied from interface:IRubyObject
Check whether this object is truthy.- Specified by:
isTrue
in interfaceIRubyObject
- Returns:
- false for
nil
andfalse
, true otherwise
-
isFrozen
public boolean isFrozen()RubyMethod isFrozen.- Specified by:
isFrozen
in interfaceIRubyObject
- Returns:
- boolean
-
setFrozen
public void setFrozen(boolean b) RubyMethod setFrozen.- Specified by:
setFrozen
in interfaceIRubyObject
- Parameters:
b
-
-
isImmediate
public boolean isImmediate()Description copied from interface:IRubyObject
Is this an immediate object- Specified by:
isImmediate
in interfaceIRubyObject
- Returns:
- boolean
-
isSpecialConst
public boolean isSpecialConst()Description copied from interface:IRubyObject
Is this a special constant- Specified by:
isSpecialConst
in interfaceIRubyObject
- Returns:
- boolean
-
getMetaClass
Description copied from interface:IRubyObject
Retrieveself.class
.- Specified by:
getMetaClass
in interfaceIRubyObject
- Returns:
- the Ruby (meta) class
-
getSingletonClass
Description copied from interface:IRubyObject
Retrieveself.singleton_class
.- Specified by:
getSingletonClass
in interfaceIRubyObject
- Returns:
- the Ruby singleton class
-
singletonClass
- Specified by:
singletonClass
in interfaceIRubyObject
-
getType
Description copied from interface:IRubyObject
RubyMethod getType.- Specified by:
getType
in interfaceIRubyObject
- Returns:
- RubyClass
-
respondsTo
Description copied from interface:IRubyObject
RubyMethod respondsTo.- Specified by:
respondsTo
in interfaceIRubyObject
- Parameters:
string
- method name- Returns:
- boolean
-
respondsToMissing
Description copied from interface:IRubyObject
RubyMethod respondsTo.- Specified by:
respondsToMissing
in interfaceIRubyObject
- Parameters:
string
- method name- Returns:
- boolean
-
respondsToMissing
Description copied from interface:IRubyObject
RubyMethod respondsTo.- Specified by:
respondsToMissing
in interfaceIRubyObject
- Parameters:
string
- method namepriv
- private?- Returns:
- boolean
-
getRuntime
Description copied from interface:IRubyObject
RubyMethod getRuntime.- Specified by:
getRuntime
in interfaceIRubyObject
- Returns:
- the Ruby runtime this belongs to
-
getJavaClass
Description copied from interface:IRubyObject
RubyMethod getJavaClass.- Specified by:
getJavaClass
in interfaceIRubyObject
- Returns:
- Class
-
asJavaString
Description copied from interface:IRubyObject
Convert the object into a symbol name if possible.- Specified by:
asJavaString
in interfaceIRubyObject
- Returns:
- String the symbol name
-
asString
Description copied from interface:IRubyObject
rb_obj_as_string- Specified by:
asString
in interfaceIRubyObject
- Returns:
- string representation
-
convertToArray
Description copied from interface:IRubyObject
Converts this Ruby object to an Array.- Specified by:
convertToArray
in interfaceIRubyObject
- Returns:
- an array value
-
convertToHash
Description copied from interface:IRubyObject
Converts this Ruby object to a Hash.- Specified by:
convertToHash
in interfaceIRubyObject
- Returns:
- a hash value
-
convertToFloat
Description copied from interface:IRubyObject
Converts this Ruby object to a Float (using to_f).- Specified by:
convertToFloat
in interfaceIRubyObject
- Returns:
- a float value
-
convertToInteger
Description copied from interface:IRubyObject
Converts this Ruby object to an Integer. Uses the default conversion method (to_int).- Specified by:
convertToInteger
in interfaceIRubyObject
- Returns:
- an integer value
-
convertToInteger
Description copied from interface:IRubyObject
Converts this Ruby object to an Integer.- Specified by:
convertToInteger
in interfaceIRubyObject
- Parameters:
convertMethod
- method to use e.g. to_i- Returns:
- an integer value
-
convertToString
Description copied from interface:IRubyObject
Converts this Ruby object to a String.- Specified by:
convertToString
in interfaceIRubyObject
- Returns:
- a string value
-
anyToString
Description copied from interface:IRubyObject
make this object into a string (hopefully)- Specified by:
anyToString
in interfaceIRubyObject
- Returns:
- a string value
-
checkStringType
Description copied from interface:IRubyObject
is this a string if so return it otherwise nil- Specified by:
checkStringType
in interfaceIRubyObject
- Returns:
- nil if type check failed
-
checkArrayType
Description copied from interface:IRubyObject
is this an array if so return it otherwise nil- Specified by:
checkArrayType
in interfaceIRubyObject
- Returns:
- nil if type check failed
-
toJava
Convert the object to the specified Java class, if possible.- Specified by:
toJava
in interfaceIRubyObject
- Parameters:
cls
- The target type to which the object should be converted.- Returns:
- java type
-
dup
Description copied from interface:IRubyObject
RubyMethod dup.- Specified by:
dup
in interfaceIRubyObject
- Returns:
- a dup-ed object
-
inspect
Description copied from interface:IRubyObject
RubyMethod inspect.- Specified by:
inspect
in interfaceIRubyObject
- Returns:
- String
-
rbClone
RubyMethod rbClone.- Specified by:
rbClone
in interfaceIRubyObject
- Returns:
- IRubyObject
-
isModule
public boolean isModule()Description copied from interface:IRubyObject
If is_a? semantics is required, use(someObject instanceof RubyModule)
instead.- Specified by:
isModule
in 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:IRubyObject
If is_a? semantics is required, use(someObject instanceof RubyClass/MetaClass)
instead.- Specified by:
isClass
in 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:
dataWrapStruct
in 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:
dataGetStruct
in interfaceIRubyObject
- Returns:
- the object wrapped.
-
id
Description copied from interface:IRubyObject
The id of the object- Specified by:
id
in interfaceIRubyObject
- Returns:
- the object id
-
op_equal
- Specified by:
op_equal
in interfaceIRubyObject
-
op_eqq
- Specified by:
op_eqq
in interfaceIRubyObject
-
eql
- Specified by:
eql
in interfaceIRubyObject
-
addFinalizer
- Specified by:
addFinalizer
in interfaceIRubyObject
-
addFinalizer
- Specified by:
addFinalizer
in interfaceIRubyObject
-
removeFinalizers
public void removeFinalizers()- Specified by:
removeFinalizers
in interfaceIRubyObject
-
hasVariables
public boolean hasVariables()Description copied from interface:IRubyObject
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:
hasVariables
in interfaceIRubyObject
- Returns:
- true if object has any variables, else false
-
getVariableCount
public int getVariableCount()Description copied from interface:IRubyObject
how many variables?- Specified by:
getVariableCount
in interfaceIRubyObject
- Returns:
- the count of all variables (ivar/cvar/constant/internal)
-
syncVariables
Deprecated.Description copied from interface:IRubyObject
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:
syncVariables
in interfaceIRubyObject
- Parameters:
variables
- the variables to be set for object
-
syncVariables
Description copied from interface:IRubyObject
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:
syncVariables
in interfaceIRubyObject
- Parameters:
source
- the source object containing the variables to sync
-
getVariableList
Description copied from interface:IRubyObject
list of all variables- Specified by:
getVariableList
in interfaceIRubyObject
- Returns:
- a list of all variables (ivar/internal)
-
getInstanceVariables
- Specified by:
getInstanceVariables
in interfaceIRubyObject
-
getInternalVariables
- Specified by:
getInternalVariables
in interfaceIRubyObject
-
getVariableNameList
Description copied from interface:IRubyObject
list of all variable names- Specified by:
getVariableNameList
in interfaceIRubyObject
- Returns:
- a list of all variable names (ivar/cvar/constant/internal)
-
copySpecialInstanceVariables
- Specified by:
copySpecialInstanceVariables
in interfaceIRubyObject
-
getVariable
- Specified by:
getVariable
in interfaceIRubyObject
-
setVariable
- Specified by:
setVariable
in interfaceIRubyObject
-
toString
-
visit
-
dataGetStructChecked
Deprecated.- Specified by:
dataGetStructChecked
in interfaceIRubyObject
-
isTaint
Deprecated.- Specified by:
isTaint
in interfaceIRubyObject
-
setTaint
Deprecated.- Specified by:
setTaint
in interfaceIRubyObject
-
infectBy
Deprecated.- Specified by:
infectBy
in interfaceIRubyObject
-
isUntrusted
Deprecated.Description copied from interface:IRubyObject
RubyMethod isUntrusted.- Specified by:
isUntrusted
in interfaceIRubyObject
- Returns:
- boolean
-
setUntrusted
Deprecated.Description copied from interface:IRubyObject
RubyMethod setUntrusted.- Specified by:
setUntrusted
in interfaceIRubyObject
- Parameters:
b
- boolean
-