+2007-06-15 Jürg Billeter <j@bitron.ch>
+
+ * vala/valaattributeprocessor.vala, vala/valacodevisitor.vala,
+ vala/valainterfacewriter.vala, vala/valamemorymanager.vala,
+ vala/valaparser.vala, vala/valasemanticanalyzer.vala,
+ vala/valasymbolbuilder.vala, vala/valasymbolresolver.vala,
+ vala/valacallback.vala, vala/valaclass.vala, vala/valaenum.vala,
+ vala/valaflags.vala, vala/valainterface.vala, vala/valastruct.vala,
+ gobject/valacodegenerator.class, gobject/valacodegeneratorclass.vala,
+ gobject/valacodegeneratorinterface.vala,
+ gobject/valacodegeneratorstruct.vala: move iteration of data types
+ from accept to accept_children method
+
2007-06-15 Jürg Billeter <j@bitron.ch>
* vala/valaattributeprocessor.vala, vala/valacodevisitor.vala,
ns.accept_children (this);
}
- public override void visit_begin_enum (Enum! en) {
+ public override void visit_enum (Enum! en) {
cenum = new CCodeEnum (en.get_cname ());
if (en.source_reference.comment != null) {
header_type_definition.append (new CCodeComment (en.source_reference.comment));
}
header_type_definition.append (cenum);
+
+ en.accept_children (this);
}
public override void visit_enum_value (EnumValue! ev) {
cenum.add_value (ev.get_cname (), val);
}
- public override void visit_begin_flags (Flags! fl) {
+ public override void visit_flags (Flags! fl) {
cenum = new CCodeEnum (fl.get_cname ());
if (fl.source_reference.comment != null) {
header_type_definition.append (new CCodeComment (fl.source_reference.comment));
}
header_type_definition.append (cenum);
+
+ fl.accept_children (this);
}
public override void visit_flags_value (FlagsValue! fv) {
cenum.add_value (fv.get_cname (), val);
}
- public override void visit_end_callback (Callback! cb) {
+ public override void visit_callback (Callback! cb) {
+ cb.accept_children (this);
+
var cfundecl = new CCodeFunctionDeclarator (cb.get_cname ());
foreach (FormalParameter param in cb.get_parameters ()) {
cfundecl.add_parameter ((CCodeFormalParameter) param.ccodenode);
using GLib;
public class Vala.CodeGenerator {
- public override void visit_begin_class (Class! cl) {
+ public override void visit_class (Class! cl) {
current_symbol = cl.symbol;
current_type_symbol = cl.symbol;
current_class = cl;
source_type_member_declaration.append (new CCodeMacroReplacement ("%s_GET_PRIVATE(o)".printf (cl.get_upper_case_cname (null)), macro));
}
source_type_member_declaration.append (prop_enum);
- }
-
- public override void visit_end_class (Class! cl) {
+
+ cl.accept_children (this);
+
if (!cl.is_static) {
if (class_has_readable_properties (cl)) {
add_get_property_function (cl);
using GLib;
public class Vala.CodeGenerator {
- public override void visit_begin_interface (Interface! iface) {
+ public override void visit_interface (Interface! iface) {
current_symbol = iface.symbol;
current_type_symbol = iface.symbol;
- if (iface.is_static) {
- return;
- }
+ if (!iface.is_static) {
+ type_struct = new CCodeStruct ("_%s".printf (iface.get_type_cname ()));
+
+ header_type_declaration.append (new CCodeNewline ());
+ var macro = "(%s_get_type ())".printf (iface.get_lower_case_cname (null));
+ header_type_declaration.append (new CCodeMacroReplacement (iface.get_upper_case_cname ("TYPE_"), macro));
- type_struct = new CCodeStruct ("_%s".printf (iface.get_type_cname ()));
-
- header_type_declaration.append (new CCodeNewline ());
- var macro = "(%s_get_type ())".printf (iface.get_lower_case_cname (null));
- header_type_declaration.append (new CCodeMacroReplacement (iface.get_upper_case_cname ("TYPE_"), macro));
+ macro = "(G_TYPE_CHECK_INSTANCE_CAST ((obj), %s, %s))".printf (iface.get_upper_case_cname ("TYPE_"), iface.get_cname ());
+ header_type_declaration.append (new CCodeMacroReplacement ("%s(obj)".printf (iface.get_upper_case_cname (null)), macro));
- macro = "(G_TYPE_CHECK_INSTANCE_CAST ((obj), %s, %s))".printf (iface.get_upper_case_cname ("TYPE_"), iface.get_cname ());
- header_type_declaration.append (new CCodeMacroReplacement ("%s(obj)".printf (iface.get_upper_case_cname (null)), macro));
+ macro = "(G_TYPE_CHECK_INSTANCE_TYPE ((obj), %s))".printf (iface.get_upper_case_cname ("TYPE_"));
+ header_type_declaration.append (new CCodeMacroReplacement ("%s(obj)".printf (iface.get_upper_case_cname ("IS_")), macro));
- macro = "(G_TYPE_CHECK_INSTANCE_TYPE ((obj), %s))".printf (iface.get_upper_case_cname ("TYPE_"));
- header_type_declaration.append (new CCodeMacroReplacement ("%s(obj)".printf (iface.get_upper_case_cname ("IS_")), macro));
+ macro = "(G_TYPE_INSTANCE_GET_INTERFACE ((obj), %s, %s))".printf (iface.get_upper_case_cname ("TYPE_"), iface.get_type_cname ());
+ header_type_declaration.append (new CCodeMacroReplacement ("%s_GET_INTERFACE(obj)".printf (iface.get_upper_case_cname (null)), macro));
+ header_type_declaration.append (new CCodeNewline ());
- macro = "(G_TYPE_INSTANCE_GET_INTERFACE ((obj), %s, %s))".printf (iface.get_upper_case_cname ("TYPE_"), iface.get_type_cname ());
- header_type_declaration.append (new CCodeMacroReplacement ("%s_GET_INTERFACE(obj)".printf (iface.get_upper_case_cname (null)), macro));
- header_type_declaration.append (new CCodeNewline ());
+ if (iface.source_reference.file.cycle == null) {
+ header_type_declaration.append (new CCodeTypeDefinition ("struct _%s".printf (iface.get_cname ()), new CCodeVariableDeclarator (iface.get_cname ())));
+ header_type_declaration.append (new CCodeTypeDefinition ("struct %s".printf (type_struct.name), new CCodeVariableDeclarator (iface.get_type_cname ())));
+ }
+
+ type_struct.add_field ("GTypeInterface", "parent");
- if (iface.source_reference.file.cycle == null) {
- header_type_declaration.append (new CCodeTypeDefinition ("struct _%s".printf (iface.get_cname ()), new CCodeVariableDeclarator (iface.get_cname ())));
- header_type_declaration.append (new CCodeTypeDefinition ("struct %s".printf (type_struct.name), new CCodeVariableDeclarator (iface.get_type_cname ())));
+ if (iface.source_reference.comment != null) {
+ header_type_definition.append (new CCodeComment (iface.source_reference.comment));
+ }
+ header_type_definition.append (type_struct);
}
-
- type_struct.add_field ("GTypeInterface", "parent");
- if (iface.source_reference.comment != null) {
- header_type_definition.append (new CCodeComment (iface.source_reference.comment));
- }
- header_type_definition.append (type_struct);
- }
+ iface.accept_children (this);
- public override void visit_end_interface (Interface! iface) {
if (!iface.is_static) {
add_interface_base_init_function (iface);
using GLib;
public class Vala.CodeGenerator {
- public override void visit_begin_struct (Struct! st) {
+ public override void visit_struct (Struct! st) {
current_type_symbol = st.symbol;
instance_struct = new CCodeStruct ("_%s".printf (st.get_cname ()));
header_type_definition.append (new CCodeComment (st.source_reference.comment));
}
header_type_definition.append (instance_struct);
- }
-
- public override void visit_end_struct (Struct! st) {
+
+ st.accept_children (this);
+
current_type_symbol = null;
}
}
ns.accept_children (this);
}
- public override void visit_begin_class (Class! cl) {
+ public override void visit_class (Class! cl) {
cl.process_attributes ();
+
+ cl.accept_children (this);
}
- public override void visit_begin_struct (Struct! st) {
+ public override void visit_struct (Struct! st) {
st.process_attributes ();
+
+ st.accept_children (this);
}
- public override void visit_begin_interface (Interface! iface) {
+ public override void visit_interface (Interface! iface) {
iface.process_attributes ();
+
+ iface.accept_children (this);
}
- public override void visit_begin_enum (Enum! en) {
+ public override void visit_enum (Enum! en) {
en.process_attributes ();
}
- public override void visit_begin_flags (Flags! fl) {
+ public override void visit_flags (Flags! fl) {
fl.process_attributes ();
}
prop.process_attributes ();
}
- public override void visit_begin_callback (Callback! cb) {
+ public override void visit_callback (Callback! cb) {
cb.process_attributes ();
}
return true;
}
-
+
public override void accept (CodeVisitor! visitor) {
- visitor.visit_begin_callback (this);
+ visitor.visit_callback (this);
+ }
+ public override void accept_children (CodeVisitor! visitor) {
foreach (TypeParameter p in type_parameters) {
p.accept (visitor);
}
foreach (FormalParameter! param in parameters) {
param.accept (visitor);
}
-
- visitor.visit_end_callback (this);
}
public override string get_cname (bool const_type = false) {
public ref List<weak Signal> get_signals () {
return signals.copy ();
}
-
+
public override void accept (CodeVisitor! visitor) {
- visitor.visit_begin_class (this);
-
+ visitor.visit_class (this);
+ }
+
+ public override void accept_children (CodeVisitor! visitor) {
foreach (TypeReference type in base_types) {
type.accept (visitor);
}
if (destructor != null) {
destructor.accept (visitor);
}
-
- visitor.visit_end_class (this);
}
-
+
public override string get_cname (bool const_type = false) {
if (cname == null) {
cname = "%s%s".printf (@namespace.get_cprefix (), name);
}
/**
- * Visit operation called at beginning of classes.
+ * Visit operation called for classes.
*
* @param cl a class
*/
- public virtual void visit_begin_class (Class! cl) {
+ public virtual void visit_class (Class! cl) {
}
/**
- * Visit operation called at end of classes.
- *
- * @param cl a class
- */
- public virtual void visit_end_class (Class! cl) {
- }
-
- /**
- * Visit operation called at beginning of structs.
- *
- * @param st a struct
- */
- public virtual void visit_begin_struct (Struct! st) {
- }
-
- /**
- * Visit operation called at end of structs.
+ * Visit operation called for structs.
*
* @param st a struct
*/
- public virtual void visit_end_struct (Struct! st) {
- }
-
- /**
- * Visit operation called at beginning of interfaces.
- *
- * @param iface an interface
- */
- public virtual void visit_begin_interface (Interface! iface) {
+ public virtual void visit_struct (Struct! st) {
}
/**
- * Visit operation called at end of interfaces.
+ * Visit operation called for interfaces.
*
* @param iface an interface
*/
- public virtual void visit_end_interface (Interface! iface) {
+ public virtual void visit_interface (Interface! iface) {
}
/**
- * Visit operation called at beginning of enums.
+ * Visit operation called for enums.
*
* @param en an enum
*/
- public virtual void visit_begin_enum (Enum! en) {
- }
-
- /**
- * Visit operation called at end of enums.
- *
- * @param en an enum
- */
- public virtual void visit_end_enum (Enum! en) {
+ public virtual void visit_enum (Enum! en) {
}
/**
}
/**
- * Visit operation called at beginning of flags.
- *
- * @param fl a flags
- */
- public virtual void visit_begin_flags (Flags! fl) {
- }
-
- /**
- * Visit operation called at end of flags.
+ * Visit operation called for flags.
*
* @param fl a flags
*/
- public virtual void visit_end_flags (Flags! fl) {
+ public virtual void visit_flags (Flags! fl) {
}
/**
}
/**
- * Visit operation called at beginning of callbacks.
- *
- * @param cb a callback
- */
- public virtual void visit_begin_callback (Callback! cb) {
- }
-
- /**
- * Visit operation called at end of callbacks.
+ * Visit operation called for callbacks.
*
* @param cb a callback
*/
- public virtual void visit_end_callback (Callback! cb) {
+ public virtual void visit_callback (Callback! cb) {
}
/**
/* valaenum.vala
*
- * Copyright (C) 2006 Jürg Billeter
+ * Copyright (C) 2006-2007 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
public void add_value (EnumValue! value) {
values.append (value);
}
-
+
public override void accept (CodeVisitor! visitor) {
- visitor.visit_begin_enum (this);
-
+ visitor.visit_enum (this);
+ }
+
+ public override void accept_children (CodeVisitor! visitor) {
foreach (EnumValue value in values) {
value.accept (visitor);
}
-
- visitor.visit_end_enum (this);
}
public override string get_cname (bool const_type = false) {
}
public override void accept (CodeVisitor! visitor) {
- visitor.visit_begin_flags (this);
+ visitor.visit_flags (this);
+ }
+ public override void accept_children (CodeVisitor! visitor) {
foreach (FlagsValue value in values) {
value.accept (visitor);
}
-
- visitor.visit_end_flags (this);
}
public override string get_cname (bool const_type = false) {
public override ref string get_upper_case_cname (string infix) {
return get_lower_case_cname (infix).up ();
}
-
+
public override void accept (CodeVisitor! visitor) {
- visitor.visit_begin_interface (this);
-
+ visitor.visit_interface (this);
+ }
+
+ public override void accept_children (CodeVisitor! visitor) {
foreach (TypeReference type in prerequisites) {
type.accept (visitor);
}
foreach (Signal sig in signals) {
sig.accept (visitor);
}
-
- visitor.visit_end_interface (this);
}
public override bool is_reference_type () {
int indent;
/* at begin of line */
bool bol = true;
-
- bool internal_scope = false;
-
+
string current_cheader_filename;
/**
write_newline ();
}
- public override void visit_begin_class (Class! cl) {
+ public override void visit_class (Class! cl) {
if (cl.access == MemberAccessibility.PRIVATE) {
- internal_scope = true;
return;
}
}
}
write_begin_block ();
- }
- public override void visit_end_class (Class! cl) {
- if (cl.access == MemberAccessibility.PRIVATE) {
- internal_scope = false;
- return;
- }
-
+ cl.accept_children (this);
+
write_end_block ();
write_newline ();
}
- public override void visit_begin_struct (Struct! st) {
+ public override void visit_struct (Struct! st) {
if (st.access == MemberAccessibility.PRIVATE) {
- internal_scope = true;
return;
}
write_string ("public struct ");
write_identifier (st.name);
write_begin_block ();
- }
- public override void visit_end_struct (Struct! st) {
- if (st.access == MemberAccessibility.PRIVATE) {
- internal_scope = false;
- return;
- }
-
+ st.accept_children (this);
+
write_end_block ();
write_newline ();
}
- public override void visit_begin_interface (Interface! iface) {
+ public override void visit_interface (Interface! iface) {
if (iface.access == MemberAccessibility.PRIVATE) {
- internal_scope = true;
return;
}
write_identifier (iface.name);
write_begin_block ();
- }
- public override void visit_end_interface (Interface! iface) {
- if (iface.access == MemberAccessibility.PRIVATE) {
- internal_scope = false;
- return;
- }
-
+ iface.accept_children (this);
+
write_end_block ();
write_newline ();
}
- public override void visit_begin_enum (Enum! en) {
+ public override void visit_enum (Enum! en) {
if (en.access == MemberAccessibility.PRIVATE) {
- internal_scope = true;
return;
}
write_string ("public enum ");
write_identifier (en.name);
write_begin_block ();
- }
- public override void visit_end_enum (Enum! en) {
- if (en.access == MemberAccessibility.PRIVATE) {
- internal_scope = false;
- return;
- }
+ en.accept_children (this);
write_end_block ();
write_newline ();
}
public override void visit_enum_value (EnumValue! ev) {
- if (internal_scope) {
- return;
- }
-
write_indent ();
write_identifier (ev.name);
write_string (",");
write_newline ();
}
- public override void visit_begin_flags (Flags! fl) {
+ public override void visit_flags (Flags! fl) {
if (fl.access == MemberAccessibility.PRIVATE) {
- internal_scope = true;
return;
}
write_string ("public flags ");
write_identifier (fl.name);
write_begin_block ();
- }
- public override void visit_end_flags (Flags! fl) {
- if (fl.access == MemberAccessibility.PRIVATE) {
- internal_scope = false;
- return;
- }
+ fl.accept_children (this);
write_end_block ();
write_newline ();
}
public override void visit_flags_value (FlagsValue! fv) {
- if (internal_scope) {
- return;
- }
-
write_indent ();
write_identifier (fv.name);
write_string (",");
}
public override void visit_constant (Constant! c) {
- if (internal_scope) {
- return;
- }
-
write_indent ();
write_string ("public const ");
write_string (c.type_reference.data_type.symbol.get_full_name ());
}
public override void visit_field (Field! f) {
- if (internal_scope || f.access == MemberAccessibility.PRIVATE) {
+ if (f.access == MemberAccessibility.PRIVATE) {
return;
}
write_string (")");
}
- public override void visit_begin_callback (Callback! cb) {
- if (internal_scope || cb.access == MemberAccessibility.PRIVATE) {
+ public override void visit_callback (Callback! cb) {
+ if (cb.access == MemberAccessibility.PRIVATE) {
return;
}
}
public override void visit_begin_method (Method! m) {
- if (internal_scope || m.access == MemberAccessibility.PRIVATE || m.overrides) {
+ if (m.access == MemberAccessibility.PRIVATE || m.overrides) {
return;
}
}
public override void visit_begin_property (Property! prop) {
- if (internal_scope) {
- return;
- }
-
if (prop.no_accessor_method) {
write_indent ();
write_string ("[NoAccessorMethod]");
}
public override void visit_begin_signal (Signal! sig) {
- if (internal_scope || sig.access == MemberAccessibility.PRIVATE) {
+ if (sig.access == MemberAccessibility.PRIVATE) {
return;
}
ns.accept_children (this);
}
+ public override void visit_class (Class! cl) {
+ cl.accept_children (this);
+ }
+
+ public override void visit_struct (Struct! st) {
+ st.accept_children (this);
+ }
+
+ public override void visit_interface (Interface! iface) {
+ iface.accept_children (this);
+ }
+
public override void visit_field (Field! f) {
if (f.initializer != null) {
if (f.type_reference.takes_ownership) {
source_file.comment = _file_comment;
}
- source_file.accept_children (this);
-
_file_comment = null;
}
current_symbol = current_symbol.parent_symbol;
}
- public override void visit_begin_class (Class! cl) {
+ public override void visit_class (Class! cl) {
current_symbol = cl.symbol;
current_class = cl;
foreach (TypeReference base_type_reference in cl.get_base_types ()) {
current_source_file.add_symbol_dependency (base_type_reference.data_type.symbol, SourceFileDependencyType.HEADER_FULL);
}
- }
-
- private ref List<DataType> get_all_prerequisites (Interface! iface) {
- List<DataType> ret = null;
-
- foreach (TypeReference prereq in iface.get_prerequisites ()) {
- DataType type = prereq.data_type;
- /* skip on previous errors */
- if (type == null) {
- continue;
- }
-
- ret.prepend (type);
- if (type is Interface) {
- ret.concat (get_all_prerequisites ((Interface) type));
-
- }
- }
-
- ret.reverse ();
- return #ret;
- }
- private bool class_is_a (Class! cl, DataType! t) {
- if (cl == t) {
- return true;
- }
+ cl.accept_children (this);
- foreach (TypeReference base_type in cl.get_base_types ()) {
- if (base_type.data_type is Class) {
- if (class_is_a ((Class) base_type.data_type, t)) {
- return true;
- }
- } else if (base_type.data_type == t) {
- return true;
- }
- }
-
- return false;
- }
-
- public override void visit_end_class (Class! cl) {
/* gather all prerequisites */
List<DataType> prerequisites = null;
foreach (TypeReference base_type in cl.get_base_types ()) {
current_class = null;
}
- public override void visit_begin_struct (Struct! st) {
+ private ref List<DataType> get_all_prerequisites (Interface! iface) {
+ List<DataType> ret = null;
+
+ foreach (TypeReference prereq in iface.get_prerequisites ()) {
+ DataType type = prereq.data_type;
+ /* skip on previous errors */
+ if (type == null) {
+ continue;
+ }
+
+ ret.prepend (type);
+ if (type is Interface) {
+ ret.concat (get_all_prerequisites ((Interface) type));
+
+ }
+ }
+
+ ret.reverse ();
+ return #ret;
+ }
+
+ private bool class_is_a (Class! cl, DataType! t) {
+ if (cl == t) {
+ return true;
+ }
+
+ foreach (TypeReference base_type in cl.get_base_types ()) {
+ if (base_type.data_type is Class) {
+ if (class_is_a ((Class) base_type.data_type, t)) {
+ return true;
+ }
+ } else if (base_type.data_type == t) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public override void visit_struct (Struct! st) {
current_symbol = st.symbol;
current_struct = st;
- }
- public override void visit_end_struct (Struct! st) {
+ st.accept_children (this);
+
current_symbol = current_symbol.parent_symbol;
current_struct = null;
}
- public override void visit_begin_interface (Interface! iface) {
+ public override void visit_interface (Interface! iface) {
current_symbol = iface.symbol;
foreach (TypeReference prerequisite_reference in iface.get_prerequisites ()) {
current_source_file.add_symbol_dependency (prerequisite_reference.data_type.symbol, SourceFileDependencyType.HEADER_FULL);
}
- }
- public override void visit_end_interface (Interface! iface) {
+ iface.accept_children (this);
+
/* check prerequisites */
Class prereq_class;
foreach (TypeReference prereq in iface.get_prerequisites ()) {
current_symbol = current_symbol.parent_symbol;
}
+ public override void visit_callback (Callback! cb) {
+ cb.accept_children (this);
+ }
+
public override void visit_constant (Constant! c) {
if (!current_source_file.pkg) {
if (c.initializer == null) {
public ref List<weak Method> get_methods () {
return methods.copy ();
}
-
+
public override void accept (CodeVisitor! visitor) {
- visitor.visit_begin_struct (this);
-
+ visitor.visit_struct (this);
+ }
+
+ public override void accept_children (CodeVisitor! visitor) {
foreach (TypeParameter p in type_parameters) {
p.accept (visitor);
}
foreach (Method m in methods) {
m.accept (visitor);
}
-
- visitor.visit_end_struct (this);
}
-
+
public override string get_cname (bool const_type = false) {
if (const_type && const_cname != null) {
return const_cname;
return node.symbol;
}
- public override void visit_begin_class (Class! cl) {
+ public override void visit_class (Class! cl) {
+ if (cl.error) {
+ /* skip classes with errors */
+ return;
+ }
+
var class_symbol = current_symbol.lookup (cl.name);
if (class_symbol == null || !(class_symbol.node is Class)) {
class_symbol = add_symbol (cl.name, cl);
}
current_symbol = class_symbol;
- }
-
- public override void visit_end_class (Class! cl) {
- if (cl.error) {
- /* skip classes with errors */
- return;
- }
-
+
+ cl.accept_children (this);
+
current_symbol = current_symbol.parent_symbol;
if (cl.symbol == null) {
cl.@namespace.remove_class (cl);
}
}
-
- public override void visit_begin_struct (Struct! st) {
+
+ public override void visit_struct (Struct! st) {
+ if (st.error) {
+ /* skip structs with errors */
+ return;
+ }
+
if (add_symbol (st.name, st) == null) {
return;
}
current_symbol = st.symbol;
+
+ st.accept_children (this);
+
+ current_symbol = current_symbol.parent_symbol;
}
-
- public override void visit_end_struct (Struct! st) {
- if (st.error) {
- /* skip structs with errors */
+
+ public override void visit_interface (Interface! iface) {
+ if (iface.error) {
+ /* skip interfaces with errors */
return;
}
- current_symbol = current_symbol.parent_symbol;
- }
-
- public override void visit_begin_interface (Interface! iface) {
if (add_symbol (iface.name, iface) == null) {
return;
}
current_symbol = iface.symbol;
+
+ iface.accept_children (this);
+
+ current_symbol = current_symbol.parent_symbol;
}
-
- public override void visit_end_interface (Interface! iface) {
- if (iface.error) {
- /* skip interfaces with errors */
+
+ public override void visit_enum (Enum! en) {
+ if (en.error) {
+ /* skip enums with errors */
return;
}
-
- current_symbol = current_symbol.parent_symbol;
- }
- public override void visit_begin_enum (Enum! en) {
if (add_symbol (en.name, en) == null) {
return;
}
current_symbol = en.symbol;
- }
- public override void visit_end_enum (Enum! en) {
- if (en.error) {
- /* skip enums with errors */
- return;
- }
+ en.accept_children (this);
current_symbol = current_symbol.parent_symbol;
}
current_symbol.add (ev.name, ev.symbol);
}
- public override void visit_begin_flags (Flags! fl) {
+ public override void visit_flags (Flags! fl) {
+ if (fl.error) {
+ /* skip flags with errors */
+ return;
+ }
+
if (add_symbol (fl.name, fl) == null) {
return;
}
current_symbol = fl.symbol;
- }
- public override void visit_end_flags (Flags! fl) {
- if (fl.error) {
- /* skip flags with errors */
- return;
- }
+ fl.accept_children (this);
current_symbol = current_symbol.parent_symbol;
}
current_symbol.add (fv.name, fv.symbol);
}
- public override void visit_begin_callback (Callback! cb) {
+ public override void visit_callback (Callback! cb) {
if (add_symbol (cb.name, cb) == null) {
return;
}
current_symbol = cb.symbol;
- }
-
- public override void visit_end_callback (Callback! cb) {
+
+ cb.accept_children (this);
+
if (cb.error) {
/* skip enums with errors */
return;
current_scope = root_symbol;
}
- public override void visit_begin_class (Class! cl) {
+ public override void visit_class (Class! cl) {
current_scope = cl.symbol;
- }
- public override void visit_end_class (Class! cl) {
+ cl.accept_children (this);
+
foreach (TypeReference type in cl.get_base_types ()) {
if (type.data_type is Class) {
if (cl.base_class != null) {
current_scope = current_scope.parent_symbol;
}
- public override void visit_begin_struct (Struct! st) {
+ public override void visit_struct (Struct! st) {
current_scope = st.symbol;
- }
- public override void visit_end_struct (Struct! st) {
+ st.accept_children (this);
+
current_scope = current_scope.parent_symbol;
}
- public override void visit_begin_interface (Interface! iface) {
+ public override void visit_interface (Interface! iface) {
current_scope = iface.symbol;
- }
- public override void visit_end_interface (Interface! iface) {
+ iface.accept_children (this);
+
current_scope = current_scope.parent_symbol;
}
- public override void visit_begin_callback (Callback! cb) {
+ public override void visit_callback (Callback! cb) {
current_scope = cb.symbol;
- }
- public override void visit_end_callback (Callback! cb) {
+ cb.accept_children (this);
+
current_scope = current_scope.parent_symbol;
}