# The primitive type `Byte`
var byte_type: MClassType = self.get_primitive_class("Byte").mclass_type is lazy
+ # The primitive type `Int8`
+ var int8_type: MClassType = self.get_primitive_class("Int8").mclass_type is lazy
+
+ # The primitive type `Int16`
+ var int16_type: MClassType = self.get_primitive_class("Int16").mclass_type is lazy
+
+ # The primitive type `UInt16`
+ var uint16_type: MClassType = self.get_primitive_class("UInt16").mclass_type is lazy
+
+ # The primitive type `Int32`
+ var int32_type: MClassType = self.get_primitive_class("Int32").mclass_type is lazy
+
+ # The primitive type `UInt32`
+ var uint32_type: MClassType = self.get_primitive_class("UInt32").mclass_type is lazy
+
# The primitive type `Char`
var char_type: MClassType = self.get_primitive_class("Char").mclass_type is lazy
# Is there a `new` factory to allow the pseudo instantiation?
var has_new_factory = false is writable
+
+ # Is `self` a standard or abstract class kind?
+ var is_class: Bool is lazy do return kind == concrete_kind or kind == abstract_kind
+
+ # Is `self` an interface kind?
+ var is_interface: Bool is lazy do return kind == interface_kind
+
+ # Is `self` an enum kind?
+ var is_enum: Bool is lazy do return kind == enum_kind
+
+ # Is `self` and abstract class?
+ var is_abstract: Bool is lazy do return kind == abstract_kind
end
# public gives 'p#A'
# private gives 'p::m#A'
return "{mmodule.namespace_for(mclass.visibility)}#{mclass.name}"
- else if mclass.intro_mmodule.mproject != mmodule.mproject then
+ else if mclass.intro_mmodule.mpackage != mmodule.mpackage then
# public gives 'q::n#p::A'
# private gives 'q::n#p::m::A'
return "{mmodule.full_name}#{mclass.full_name}"
redef var c_name is lazy do
if is_intro then
return "{mmodule.c_namespace_for(mclass.visibility)}___{mclass.c_name}"
- else if mclass.intro_mmodule.mproject == mmodule.mproject and mclass.visibility > private_visibility then
+ else if mclass.intro_mmodule.mpackage == mmodule.mpackage and mclass.visibility > private_visibility then
return "{mmodule.c_name}___{mclass.name.to_cmangle}"
else
return "{mmodule.c_name}___{mclass.c_name}"
redef var to_s: String is noinit
# The full-name of the class, then the full-name of each type arguments within brackets.
- # Example: `"standard::Map[standard::String, standard::List[standard::Int]]"`
+ # Example: `"core::Map[core::String, core::List[core::Int]]"`
redef var full_name is lazy do
var args = new Array[String]
for t in arguments do
# The number of parameters
fun arity: Int do return mparameters.length
- # The number of non-default parameters
- #
- # The number of default parameters is then `arity-min_arity`.
- #
- # Note that there cannot be both varargs and default prameters, thus
- # if `vararg_rank != -1` then `min_arity` == `arity`
- fun min_arity: Int
- do
- if vararg_rank != -1 then return arity
- var res = 0
- for p in mparameters do
- if not p.is_default then res += 1
- end
- return res
- end
-
redef fun to_s
do
var b = new FlatBuffer
# Is the parameter a vararg?
var is_vararg: Bool
- # Is the parameter a default one?
- var is_default: Bool
-
redef fun to_s
do
if is_vararg then
do
if not self.mtype.need_anchor then return self
var newtype = self.mtype.resolve_for(mtype, anchor, mmodule, cleanup_virtual)
- var res = new MParameter(self.name, newtype, self.is_vararg, self.is_default)
+ var res = new MParameter(self.name, newtype, self.is_vararg)
return res
end
# The canonical name of the property.
#
# It is the short-`name` prefixed by the short-name of the class and the full-name of the module.
- # Example: "my_project::my_module::MyClass::my_method"
+ # Example: "my_package::my_module::MyClass::my_method"
redef var full_name is lazy do
return "{intro_mclassdef.mmodule.namespace_for(visibility)}::{intro_mclassdef.mclass.name}::{name}"
end
do
return self.is_init
end
+
+ # A specific method that is safe to call on null.
+ # Currently, only `==`, `!=` and `is_same_instance` are safe
+ fun is_null_safe: Bool do return name == "==" or name == "!=" or name == "is_same_instance"
end
# A global attribute
res.append name
else
# Just try to simplify each part
- if mclassdef.mmodule.mproject != mproperty.intro_mclassdef.mmodule.mproject then
+ if mclassdef.mmodule.mpackage != mproperty.intro_mclassdef.mmodule.mpackage then
# precise "p::m" only if "p" != "r"
res.append mproperty.intro_mclassdef.mmodule.full_name
res.append "::"
else if mproperty.visibility <= private_visibility then
- # Same project ("p"=="q"), but private visibility,
+ # Same package ("p"=="q"), but private visibility,
# does the module part ("::m") need to be displayed
- if mclassdef.mmodule.namespace_for(mclassdef.mclass.visibility) != mproperty.intro_mclassdef.mmodule.mproject then
+ if mclassdef.mmodule.namespace_for(mclassdef.mclass.visibility) != mproperty.intro_mclassdef.mmodule.mpackage then
res.append "::"
res.append mproperty.intro_mclassdef.mmodule.name
res.append "::"