X-Git-Url: http://nitlanguage.org diff --git a/contrib/neo_doxygen/src/model/class_compound.nit b/contrib/neo_doxygen/src/model/class_compound.nit index 986695e..b0f2096 100644 --- a/contrib/neo_doxygen/src/model/class_compound.nit +++ b/contrib/neo_doxygen/src/model/class_compound.nit @@ -44,25 +44,13 @@ class ClassCompound # Return the number of type parameters. fun arity: Int do return class_type.arity - redef fun name=(name: String) do + redef fun name=(name) do super class_type.name = name class_def.name = name end - redef fun full_name=(full_name: String) do - super - class_type.full_name = full_name - class_def.full_name = full_name - end - - redef fun parent_name=(parent_name: String) do - super - class_type.parent_name = parent_name - class_def.parent_name = parent_name - end - - redef fun location=(location: nullable Location) do + redef fun location=(location) do super class_def.location = location end @@ -72,14 +60,19 @@ class ClassCompound class_def["mdoc"] = doc end - redef fun declare_super(id: String, name: String, prot: String, virt: String) do - class_def.declare_super(id, name, prot, virt) + redef fun declare_super(id, full_name, prot, virt) do + class_def.declare_super(id, full_name, prot, virt) end - redef fun declare_member(member: Member) do + redef fun declare_member(member) do class_def.declare_member(member) end + # Append the specified type parameter. + fun add_type_parameter(parameter: TypeParameter) do + class_type.arguments.add(parameter) + end + redef fun put_in_graph do super class_type.put_in_graph @@ -104,9 +97,23 @@ end class ClassDef super CodeBlock + # The defined class. var class_compound: ClassCompound + + # The `model_id` of the base classes. var supers: SimpleCollection[String] = new Array[String] - var members: SimpleCollection[Member] = new Array[Member] + + # The set of the introduced/redefined members. + # + # Includes inner classes. + # + # Filled by `declare_member` and `declare_class`. + # + # Note: `declare_class` is defined by the `inner_class` module. + # + # SEE: `declare_member` + # SEE: `declare_class` + var members: SimpleCollection[MemberOrInner] = new Array[MemberOrInner] init do super @@ -114,36 +121,27 @@ class ClassDef self["is_intro"] = true end - fun declare_super(id: String, name: String, prot: String, virt: String) do - # TODO prot, virt, name + # Declare a base compound (usually, a base class). + # + # Parameters: + # + # * `id`: `model_id` of the base compound. May be empty. + # * `full_name`: qualified name of the base compound. May be empty. + # * `prot`: visibility (proctection) of the relationship. + # * `virt`: level of virtuality of the relationship. + fun declare_super(id: String, full_name: String, prot: String, + virt: String) do + # TODO prot, virt, full_name if "" != id then supers.add(id) end end + # Append the specified member. fun declare_member(member: Member) do - var full_name = self["full_name"] - - if full_name != null then - member.parent_name = full_name.to_s - end members.add(member) end - redef fun full_name=(full_name: String) do - super - for m in members do - m.parent_name = full_name - end - end - - redef fun parent_name=(parent_name: String) do - super - for m in members do - m.parent_name = full_name - end - end - redef fun put_edges do super graph.add_edge(self, "BOUNDTYPE", class_compound.class_type) @@ -176,6 +174,7 @@ class ClassType # You may use this attribute or `class_compound` to specify the class. var class_compound_id: String = "" is writable + # The type arguments or the type parameters. var arguments = new Array[TypeEntity] init do @@ -184,8 +183,9 @@ class ClassType end # Return the number of arguments. - fun arity: Int do return 0 # TODO + fun arity: Int do return arguments.length + # Is the class generic? fun is_generic: Bool do return arity > 0 redef fun put_in_graph do