using GLib;
-namespace Vala {
+/**
+ * Represents a part of the parsed source code.
+ *
+ * Code nodes get created by the parser and are used throughout the whole
+ * compilation process.
+ */
+public abstract class Vala.CodeNode {
/**
- * Represents a part of the parsed source code.
- *
- * Code nodes get created by the parser and are used throughout the
- * whole compilation process.
+ * Symbol that corresponds to this code node.
+ */
+ public Symbol symbol { get; set; }
+
+ /**
+ * References the location in the source file where this code node has
+ * been written.
+ */
+ public SourceReference source_reference { get; set; }
+
+ /**
+ * Contains all attributes that have been specified for this code node.
*/
- public abstract class CodeNode {
- /**
- * Symbol that corresponds to this code node.
- */
- public Symbol symbol { get; set; }
-
- /**
- * References the location in the source file where this code
- * node has been written.
- */
- public SourceReference source_reference { get; set; }
-
- /**
- * Contains all attributes that have been specified for this
- * code node.
- */
- public List<Attribute> attributes;
-
- /**
- * Generated CCodeNode that corresponds to this code node.
- */
- public CCodeNode ccodenode { get; set; }
-
- /**
- * Specifies whether a fatal error has been detected in this
- * code node.
- */
- public bool error { get; set; }
+ public List<Attribute> attributes;
+
+ /**
+ * Generated CCodeNode that corresponds to this code node.
+ */
+ public CCodeNode ccodenode { get; set; }
+
+ /**
+ * Specifies whether a fatal error has been detected in this code node.
+ */
+ public bool error { get; set; }
- /**
- * Visits this code node and all children with the specified
- * CodeVisitor.
- *
- * @param visitor the visitor to be called while traversing
- */
- public abstract void accept (CodeVisitor! visitor);
- }
+ /**
+ * Visits this code node and all children with the specified
+ * CodeVisitor.
+ *
+ * @param visitor the visitor to be called while traversing
+ */
+ public abstract void accept (CodeVisitor! visitor);
}
using GLib;
-namespace Vala {
+/**
+ * Represents a runtime data type. This data type may be defined in Vala source
+ * code or imported from an external library with a Vala API file.
+ */
+public abstract class Vala.DataType : CodeNode {
+ /**
+ * The symbol name of this data type.
+ */
+ public string! name { get; set construct; }
+
/**
- * Represents a runtime data type. This data type may be defined in Vala
- * source code or imported from an external library with a Vala API
- * file.
+ * Specifies the accessibility of the class. Public accessibility
+ * doesn't limit access. Default accessibility limits access to this
+ * program or library. Protected and private accessibility is not
+ * supported for types.
*/
- public abstract class DataType : CodeNode {
- /**
- * The symbol name of this data type.
- */
- public string! name { get; set construct; }
-
- /**
- * Specifies the accessibility of the class. Public
- * accessibility doesn't limit access. Default accessibility
- * limits access to this program or library. Protected and
- * private accessibility is not supported for types.
- */
- public MemberAccessibility access;
-
- /**
- * The namespace containing this data type.
- */
- public weak Namespace @namespace;
+ public MemberAccessibility access;
+
+ /**
+ * The namespace containing this data type.
+ */
+ public weak Namespace @namespace;
- /**
- * Returns the name of this data type as it is used in C code.
- *
- * @return the name to be used in C code
- */
- public abstract string get_cname ();
-
- /**
- * Checks whether this data type has value or reference type
- * semantics.
- *
- * @return true if this data type has reference type semantics
- */
- public virtual bool is_reference_type () {
- return false;
- }
-
- /**
- * Returns the C function name that duplicates instances of this
- * data type. The specified C function must accept one argument
- * referencing the instance of this data type and return a
- * reference to the duplicate.
- *
- * @return the name of the C function if supported or null
- * otherwise
- */
- public virtual string get_dup_function () {
- return null;
- }
-
- /**
- * Returns the C function name that frees instances of this
- * data type. This is only valid for data types with reference
- * type semantics that do not support reference counting. The
- * specified C function must accept one argument pointing to the
- * instance to be freed.
- *
- * @return the name of the C function or null if this data type
- * is not a reference type or if it supports reference
- * counting
- */
- public virtual string get_free_function () {
- return null;
- }
-
- /**
- * Checks whether this data type supports reference counting.
- * This is only valid for reference types.
- *
- * @return true if this data type supports reference counting
- */
- public virtual bool is_reference_counting () {
- return false;
- }
-
- /**
- * Returns the C function name that increments the reference
- * count of instances of this data type. This is only valid for
- * data types supporting reference counting. The specified C
- * function must accept one argument referencing the instance of
- * this data type and return the reference.
- *
- * @return the name of the C function or null if this data type
- * does not support reference counting
- */
- public virtual string get_ref_function () {
- return null;
- }
-
- /**
- * Returns the C function name that decrements the reference
- * count of instances of this data type. This is only valid for
- * data types supporting reference counting. The specified C
- * function must accept one argument referencing the instance of
- * this data type.
- *
- * @return the name of the C function or null if this data type
- * does not support reference counting
- */
- public virtual string get_unref_function () {
- return null;
- }
-
- /**
- * Returns the C symbol representing the runtime type id for
- * this data type. The specified symbol must express a
- * registered GType.
- *
- * @return the name of the GType name in C code or null if this
- * data type is not registered with GType
- */
- public virtual string get_type_id () {
- return null;
- }
-
- /**
- * Returns the C name of this data type in upper case. Words are
- * separated by underscores. The upper case C name of the
- * namespace is prefix of the result.
- *
- * @param infix a string to be placed between namespace and
- * data type name or null
- * @return the upper case name to be used in C code
- */
- public abstract ref string! get_upper_case_cname (string infix);
-
- /**
- * Returns the C name of this data type in lower case. Words are
- * separated by underscores. The lower case C name of the
- * namespace is prefix of the result.
- *
- * @param infix a string to be placed between namespace and
- * data type name or null
- * @return the lower case name to be used in C code
- */
- public abstract ref string! get_lower_case_cname (string infix);
-
- /**
- * Returns a list of C header filenames users of this data type
- * must include.
- *
- * @return list of C header filenames for this data type
- */
- public ref List<string> get_cheader_filenames () {
- if (cheader_filenames == null) {
- /* default to header filenames of the namespace */
- foreach (string filename in @namespace.get_cheader_filenames ()) {
- add_cheader_filename (filename);
- }
+ /**
+ * Returns the name of this data type as it is used in C code.
+ *
+ * @return the name to be used in C code
+ */
+ public abstract string get_cname ();
+
+ /**
+ * Checks whether this data type has value or reference type semantics.
+ *
+ * @return true if this data type has reference type semantics
+ */
+ public virtual bool is_reference_type () {
+ return false;
+ }
+
+ /**
+ * Returns the C function name that duplicates instances of this data
+ * type. The specified C function must accept one argument referencing
+ * the instance of this data type and return a reference to the
+ * duplicate.
+ *
+ * @return the name of the C function if supported or null otherwise
+ */
+ public virtual string get_dup_function () {
+ return null;
+ }
+
+ /**
+ * Returns the C function name that frees instances of this data type.
+ * This is only valid for data types with reference type semantics that
+ * do not support reference counting. The specified C function must
+ * accept one argument pointing to the instance to be freed.
+ *
+ * @return the name of the C function or null if this data type is not a
+ * reference type or if it supports reference counting
+ */
+ public virtual string get_free_function () {
+ return null;
+ }
+
+ /**
+ * Checks whether this data type supports reference counting. This is
+ * only valid for reference types.
+ *
+ * @return true if this data type supports reference counting
+ */
+ public virtual bool is_reference_counting () {
+ return false;
+ }
+
+ /**
+ * Returns the C function name that increments the reference count of
+ * instances of this data type. This is only valid for data types
+ * supporting reference counting. The specified C function must accept
+ * one argument referencing the instance of this data type and return
+ * the reference.
+ *
+ * @return the name of the C function or null if this data type does not
+ * support reference counting
+ */
+ public virtual string get_ref_function () {
+ return null;
+ }
+
+ /**
+ * Returns the C function name that decrements the reference count of
+ * instances of this data type. This is only valid for data types
+ * supporting reference counting. The specified C function must accept
+ * one argument referencing the instance of this data type.
+ *
+ * @return the name of the C function or null if this data type does not
+ * support reference counting
+ */
+ public virtual string get_unref_function () {
+ return null;
+ }
+
+ /**
+ * Returns the C symbol representing the runtime type id for this data
+ * type. The specified symbol must express a registered GType.
+ *
+ * @return the name of the GType name in C code or null if this data
+ * type is not registered with GType
+ */
+ public virtual string get_type_id () {
+ return null;
+ }
+
+ /**
+ * Returns the C name of this data type in upper case. Words are
+ * separated by underscores. The upper case C name of the namespace is
+ * prefix of the result.
+ *
+ * @param infix a string to be placed between namespace and data type
+ * name or null
+ * @return the upper case name to be used in C code
+ */
+ public abstract ref string! get_upper_case_cname (string infix);
+
+ /**
+ * Returns the C name of this data type in lower case. Words are
+ * separated by underscores. The lower case C name of the namespace is
+ * prefix of the result.
+ *
+ * @param infix a string to be placed between namespace and data type
+ * name or null
+ * @return the lower case name to be used in C code
+ */
+ public abstract ref string! get_lower_case_cname (string infix);
+
+ /**
+ * Returns a list of C header filenames users of this data type must
+ * include.
+ *
+ * @return list of C header filenames for this data type
+ */
+ public ref List<string> get_cheader_filenames () {
+ if (cheader_filenames == null) {
+ /* default to header filenames of the namespace */
+ foreach (string filename in @namespace.get_cheader_filenames ()) {
+ add_cheader_filename (filename);
}
- return cheader_filenames.copy ();
- }
-
- /**
- * Adds a filename to the list of C header filenames users of
- * this data type must include.
- *
- * @param filename a C header filename
- */
- public void add_cheader_filename (string! filename) {
- cheader_filenames.append (filename);
}
+ return cheader_filenames.copy ();
+ }
- private List<string> cheader_filenames;
+ /**
+ * Adds a filename to the list of C header filenames users of this data
+ * type must include.
+ *
+ * @param filename a C header filename
+ */
+ public void add_cheader_filename (string! filename) {
+ cheader_filenames.append (filename);
}
+
+ private List<string> cheader_filenames;
}
using GLib;
-namespace Vala {
+/**
+ * Base class for all code nodes that might be used as an expression.
+ */
+public abstract class Vala.Expression : CodeNode {
+ /**
+ * The static type of this expression.
+ *
+ * The semantic analyzer computes this value.
+ */
+ public TypeReference static_type { get; set; }
+
+ /*
+ * The static type this expression is expected to have.
+ *
+ * The semantic analyzer computes this value, lambda expressions use it.
+ */
+ public TypeReference expected_type { get; set; }
+
+ /**
+ * The symbol this expression refers to.
+ */
+ public Symbol symbol_reference { get; set; }
+
+ /**
+ * Specifies that this expression transfers ownership without a receiver
+ * being present.
+ *
+ * The memory manager computes this value, the code generator uses it.
+ */
+ public bool ref_leaked { get; set; }
+
+ /**
+ * Specifies that this expression is expected to transfer ownership but
+ * doesn't.
+ *
+ * The memory manager computes this value, the code generator uses it.
+ */
+ public bool ref_missing { get; set; }
+
/**
- * Base class for all code nodes that might be used as an expression.
+ * Contains all temporary variables this expression requires for
+ * execution.
+ *
+ * The code generator sets and uses them for memory management.
*/
- public abstract class Expression : CodeNode {
- /**
- * The static type of this expression.
- *
- * The semantic analyzer computes this value.
- */
- public TypeReference static_type { get; set; }
-
- /*
- * The static type this expression is expected to have.
- *
- * The semantic analyzer computes this value, lambda expressions
- * use it.
- */
- public TypeReference expected_type { get; set; }
-
- /**
- * The symbol this expression refers to.
- */
- public Symbol symbol_reference { get; set; }
-
- /**
- * Specifies that this expression transfers ownership without a
- * receiver being present.
- *
- * The memory manager computes this value, the code generator
- * uses it.
- */
- public bool ref_leaked { get; set; }
-
- /**
- * Specifies that this expression is expected to transfer
- * ownership but doesn't.
- *
- * The memory manager computes this value, the code generator
- * uses it.
- */
- public bool ref_missing { get; set; }
-
- /**
- * Contains all temporary variables this expression requires
- * for execution.
- *
- * The code generator sets and uses them for memory management.
- */
- public List<VariableDeclarator> temp_vars;
- }
+ public List<VariableDeclarator> temp_vars;
}