Runtime variables are associated to Nit local variables and intermediate results in Nit expressions.
The tricky point is that a single C variable can be associated to more than one RuntimeVariable
because the static knowledge of the type of an expression can vary in the C code.
nitc :: RuntimeVariable :: _is_exact
If the variable exaclty a mcasttype?nitc :: RuntimeVariable :: _mcasttype
The current casted type of the variable (as known in Nit)nitc :: RuntimeVariable :: _mtype
The static type of the variable (as declard in C)nitc :: RuntimeVariable :: defaultinit
nitc :: RuntimeVariable :: is_exact=
If the variable exaclty a mcasttype?nitc :: RuntimeVariable :: mcasttype
The current casted type of the variable (as known in Nit)nitc :: RuntimeVariable :: mcasttype=
The current casted type of the variable (as known in Nit)nitc :: RuntimeVariable :: mtype=
The static type of the variable (as declard in C)nitc :: RuntimeVariable :: name=
The name of the variable in the C codenitc $ RuntimeVariable :: SELF
Type of this instance, automatically specialized in every classnitc $ RuntimeVariable :: init
nitc $ RuntimeVariable :: inspect
Developer readable representation ofself
.
nitc :: RuntimeVariable :: _is_exact
If the variable exaclty a mcasttype?nitc :: RuntimeVariable :: _mcasttype
The current casted type of the variable (as known in Nit)nitc :: RuntimeVariable :: _mtype
The static type of the variable (as declard in C)core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Object :: defaultinit
nitc :: RuntimeVariable :: defaultinit
nitc :: RuntimeVariable :: is_exact=
If the variable exaclty a mcasttype?core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
nitc :: RuntimeVariable :: mcasttype
The current casted type of the variable (as known in Nit)nitc :: RuntimeVariable :: mcasttype=
The current casted type of the variable (as known in Nit)nitc :: RuntimeVariable :: mtype=
The static type of the variable (as declard in C)nitc :: RuntimeVariable :: name=
The name of the variable in the C codecore :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).
# A runtime variable hold a runtime value in C.
# Runtime variables are associated to Nit local variables and intermediate results in Nit expressions.
#
# The tricky point is that a single C variable can be associated to more than one `RuntimeVariable` because the static knowledge of the type of an expression can vary in the C code.
class RuntimeVariable
# The name of the variable in the C code
var name: String
# The static type of the variable (as declard in C)
var mtype: MType
# The current casted type of the variable (as known in Nit)
var mcasttype: MType is writable
# If the variable exaclty a mcasttype?
# false (usual value) means that the variable is a mcasttype or a subtype.
var is_exact: Bool = false is writable
init
do
assert not mtype.need_anchor
assert not mcasttype.need_anchor
end
redef fun to_s do return name
redef fun inspect
do
var exact_str
if self.is_exact then
exact_str = " exact"
else
exact_str = ""
end
var type_str
if self.mtype == self.mcasttype then
type_str = "{mtype}{exact_str}"
else
type_str = "{mtype}({mcasttype}{exact_str})"
end
return "<{name}:{type_str}>"
end
end
src/compiler/abstract_compiler.nit:2349,1--2391,3