import javap_test_parser
import code_generator
import jtype_converter
-intrude import types
+intrude import model
class JavaVisitor
super Visitor
self.variable_type = new JavaType(self.converter)
super
end
+
+ # Add the identifier from `token` to the current context
+ fun add_identifier(token: NToken)
+ do
+ if declaration_type == "variable" then
+ if declaration_element == "type" then
+ variable_type.identifier.add(token.text)
+ end
+ else if declaration_type == "method" then
+ if declaration_element == "return_type" then
+ method_return_type.identifier.add(token.text)
+ else if declaration_element == "parameter_list" then
+ method_params[param_index].identifier.add(token.text)
+ end
+ end
+ end
end
redef class Node
end
redef class N_39dchar_39d
- redef fun accept_visitor(v)
- do
- if v.declaration_type == "variable" then
- if v.declaration_element == "type" then
- v.variable_type.identifier.add(self.text)
- end
- else if v.declaration_type == "method" then
- if v.declaration_element == "return_type" then
- v.method_return_type.identifier.add(self.text)
- else if v.declaration_element == "parameter_list" then
- v.method_params[v.param_index].identifier.add(self.text)
- end
- end
- end
+ redef fun accept_visitor(v) do v.add_identifier self
end
redef class N_39dboolean_39d
- redef fun accept_visitor(v)
- do
- if v.declaration_type == "variable" then
- if v.declaration_element == "type" then
- v.variable_type.identifier.add(self.text)
- end
- else if v.declaration_type == "method" then
- if v.declaration_element == "return_type" then
- v.method_return_type.identifier.add(self.text)
- else if v.declaration_element == "parameter_list" then
- v.method_params[v.param_index].identifier.add(self.text)
- end
- end
- end
+ redef fun accept_visitor(v) do v.add_identifier self
end
redef class N_39dfloat_39d
- redef fun accept_visitor(v)
- do
- if v.declaration_type == "variable" then
- if v.declaration_element == "type" then
- v.variable_type.identifier.add(self.text)
- end
- else if v.declaration_type == "method" then
- if v.declaration_element == "return_type" then
- v.method_return_type.identifier.add(self.text)
- else if v.declaration_element == "parameter_list" then
- v.method_params[v.param_index].identifier.add(self.text)
- end
- end
- end
+ redef fun accept_visitor(v) do v.add_identifier self
end
redef class N_39ddouble_39d
- redef fun accept_visitor(v)
- do
- if v.declaration_type == "variable" then
- if v.declaration_element == "type" then
- v.variable_type.identifier.add(self.text)
- end
- else if v.declaration_type == "method" then
- if v.declaration_element == "return_type" then
- v.method_return_type.identifier.add(self.text)
- else if v.declaration_element == "parameter_list" then
- v.method_params[v.param_index].identifier.add(self.text)
- end
- end
- end
+ redef fun accept_visitor(v) do v.add_identifier self
end
redef class N_39dbyte_39d
- redef fun accept_visitor(v)
- do
- if v.declaration_type == "variable" then
- if v.declaration_element == "type" then
- v.variable_type.identifier.add(self.text)
- end
- else if v.declaration_type == "method" then
- if v.declaration_element == "return_type" then
- v.method_return_type.identifier.add(self.text)
- else if v.declaration_element == "parameter_list" then
- v.method_params[v.param_index].identifier.add(self.text)
- end
- end
- end
+ redef fun accept_visitor(v) do v.add_identifier self
end
redef class N_39dshort_39d
- redef fun accept_visitor(v)
- do
- if v.declaration_type == "variable" then
- if v.declaration_element == "type" then
- v.variable_type.identifier.add(self.text)
- end
- else if v.declaration_type == "method" then
- if v.declaration_element == "return_type" then
- v.method_return_type.identifier.add(self.text)
- else if v.declaration_element == "parameter_list" then
- v.method_params[v.param_index].identifier.add(self.text)
- end
- end
- end
+ redef fun accept_visitor(v) do v.add_identifier self
end
redef class N_39dint_39d
- redef fun accept_visitor(v)
- do
- if v.declaration_type == "variable" then
- if v.declaration_element == "type" then
- v.variable_type.identifier.add(self.text)
- end
- else if v.declaration_type == "method" then
- if v.declaration_element == "return_type" then
- v.method_return_type.identifier.add(self.text)
- else if v.declaration_element == "parameter_list" then
- v.method_params[v.param_index].identifier.add(self.text)
- end
- end
- end
+ redef fun accept_visitor(v) do v.add_identifier self
end
redef class N_39dlong_39d
- redef fun accept_visitor(v)
- do
- if v.declaration_type == "variable" then
- if v.declaration_element == "type" then
- v.variable_type.identifier.add(self.text)
- end
- else if v.declaration_type == "method" then
- if v.declaration_element == "return_type" then
- v.method_return_type.identifier.add(self.text)
- else if v.declaration_element == "parameter_list" then
- v.method_params[v.param_index].identifier.add(self.text)
- end
- end
- end
+ redef fun accept_visitor(v) do v.add_identifier self
end
# #
end
end
-# #
-# F I E L D D E C L A R A T I O N S #
-# #
+# #
+# P R O P E R T Y D E C L A R A T I O N S #
+# #
-# Method declaration in the field declarations
+# Method declaration
redef class Nmethod_declaration
redef fun accept_visitor(v)
do
end
end
-# Constructor declaration in the field declarations
+# Constructor declaration
redef class Nconstructor_declaration
redef fun accept_visitor(v)
do
end
end
-# Variable declaration in the field declarations
+# Variable property declaration
redef class Nvariable_declaration
redef fun accept_visitor(v)
do
end
end
-# Static declaration in the field declarations
+# Static property declaration
redef class Nstatic_declaration
redef fun accept_visitor(v)
do
end
end
-# Identifier of the field
+# Identifier of a variable
redef class Nvariable_id
redef fun accept_visitor(v)
do