# Actually the name of the `mclass`
redef fun name do return mclass.name
+ # The module and class name separated by a '#'.
+ #
+ # The short-name of the class is used for introduction.
+ # Example: "my_module#MyClass"
+ #
+ # The full-name of the class is used for refinement.
+ # Example: "my_module#intro_module::MyClass"
+ redef var full_name is lazy do
+ if is_intro then
+ return "{mmodule.full_name}#{mclass.name}"
+ else
+ return "{mmodule.full_name}#{mclass.full_name}"
+ end
+ end
+
redef fun model do return mmodule.model
# All declared super-types
redef fun to_s do return mclass.to_s
+ redef fun full_name do return mclass.full_name
+
redef fun need_anchor do return false
redef fun anchor_to(mmodule: MModule, anchor: MClassType): MClassType
self.to_s = "{mclass}[{arguments.join(", ")}]"
end
- # Recursively print the type of the arguments within brackets.
+ # The short-name of the class, then the full-name of each type arguments within brackets.
# Example: `"Map[String, List[Int]]"`
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]]"`
+ redef var full_name is lazy do
+ var args = new Array[String]
+ for t in arguments do
+ args.add t.full_name
+ end
+ return "{mclass.full_name}[{args.join(", ")}]}"
+ end
+
redef var need_anchor: Bool is noinit
redef fun resolve_for(mtype, anchor, mmodule, cleanup_virtual)
end
redef fun to_s do return self.mproperty.to_s
+
+ redef fun full_name do return self.mproperty.full_name
end
# The type associated to a formal parameter generic type of a class
redef fun to_s do return name
+ redef var full_name is lazy do return "{mclass.full_name}::{name}"
+
redef fun lookup_bound(mmodule: MModule, resolved_receiver: MType): MType
do
assert not resolved_receiver.need_anchor
redef var to_s: String is noinit
+ redef var full_name is lazy do return "nullable {mtype.full_name}"
+
redef fun need_anchor do return mtype.need_anchor
redef fun as_nullable do return self
redef fun as_notnullable do return mtype
super MType
redef var model: Model
redef fun to_s do return "null"
+ redef fun full_name do return "null"
redef fun as_nullable do return self
redef fun need_anchor do return false
redef fun resolve_for(mtype, anchor, mmodule, cleanup_virtual) do return self
# Actually the name of the `mproperty`
redef fun name do return mproperty.name
+ # The full-name of mpropdefs combine the information about the `classdef` and the `mproperty`.
+ #
+ # Therefore the combination of identifiers is awful,
+ # the worst case being
+ #
+ # ~~~nitish
+ # "{mclassdef.mmodule.full_name}#{mclassdef.mclass.intro_mmodule.full_name}::{mclassdef.name}#{mproperty.intro_mclassdef.mmodule.full_name}::{mproperty.intro_mclassdef.name}::{name}"
+ # ~~~
+ #
+ # Fortunately, the full-name is simplified when entities are repeated.
+ # The simplest form is "my_module#MyClass#my_property".
+ redef var full_name is lazy do
+ var res = new FlatBuffer
+ res.append mclassdef.mmodule.full_name
+ res.append "#"
+ if not mclassdef.is_intro then
+ res.append mclassdef.mclass.intro_mmodule.full_name
+ res.append "::"
+ end
+ res.append mclassdef.name
+ res.append "#"
+ if mproperty.intro_mclassdef.mmodule != mclassdef.mmodule then
+ res.append mproperty.intro_mclassdef.mmodule.full_name
+ res.append "::"
+ end
+ if mclassdef.mclass != mproperty.intro_mclassdef.mclass then
+ res.append mproperty.intro_mclassdef.mclass.name
+ res.append "::"
+ end
+ res.append name
+ return res.to_s
+ end
+
redef fun model do return mclassdef.model
# Internal name combining the module, the class and the property