- fun accept_visitor(v: JavaVisitor) do visit_children(v)
-end
-
-redef class Nidentifier
- redef fun accept_visitor(v)
- do
- if v.declaration_type == "class_header" then
- # Class declaration
- if v.declaration_element == "id" then
- v.class_type.identifier.add text
- return
- end
-
- else if v.declaration_type == "variable" then
- # Attribute declaration
- if v.declaration_element == "id" then
- v.variable_id += text
- return
- end
-
- else if v.declaration_type == "method" then
-
- if v.declaration_element == "id" then
- # Method id
- v.method_id = self.text
- return
- else if v.declaration_element == "return_type" then
- if self.text == "void" then
- # void return type
- v.method_return_type.is_void = true
- return
- end
- else if v.declaration_element == "parameter_list" then
- # Parameters, leave it to add_identifier
-
- else if v.is_generic_param then
- # Creates a map to resolve generic return types
- # Example : public **<T extends android/os/Bundle>** T foo();
- if v.is_generic_id then
- v.generic_id = self.text
- v.generic_map[self.text] = new Array[String]
-
- if not v.method_return_type.has_unresolved_types then v.method_return_type.has_unresolved_types = true
- else
- v.generic_map[v.generic_id].add text
- end
- end
- end
-
- v.add_identifier text
- end
-end
-
-# Primitive array node
-redef class Nbrackets
- redef fun accept_visitor(v)
- do
- if v.declaration_type == "variable" then
- if v.declaration_element == "type" then
- if v.is_generic_param then
- v.variable_type.generic_params[v.gen_params_index].array_dimension += 1
- else
- v.variable_type.array_dimension += 1
- end
- end
-
- else if v.declaration_type == "method" then
-
- if v.declaration_element == "return_type" then
- if v.is_generic_param then
- v.method_return_type.generic_params[v.gen_params_index].array_dimension += 1
- else
- v.method_return_type.array_dimension += 1
- end
- else if v.declaration_element == "parameter_list" then
- if v.is_generic_param then
- v.method_params[v.param_index].generic_params[v.gen_params_index].array_dimension += 1
- else
- v.method_params[v.param_index].array_dimension += 1
- end
- end
-
- end
-
- super
- end
-end
-
-redef class N_39dchar_39d
- redef fun accept_visitor(v) do v.add_identifier text