3.3. Semantic Analyzer ​
3.3.1. Attribute Processing ​
Vala.Attribute nodes have a name and a possibly empty list of key-value arguments. Some types of code tree nodes have as children a list of Attribute nodes. The attribute processor's purpose is to interpret the attributes which were parsed into the code tree.
Later in the compilation, the results of attribute processing will be used, for example the CCode attribute cname affects what function names are used in emitted C code.
All attributes except for Conditional are handled from Vala.AttributeProcessor. I don't know where and how the Conditional attribute is handled, but there is a function ignore_node() in Vala.CodeContext.
Vala.AttributeProcessor is a CodeVisitor which simply calls the process_attributes() method on every namespace, class, struct, interface, enum, method, constructor, parameter, property, delegate, constant, field, and signal that it visits.
Inside the process_attributes() method of each of these objects, a series of string comparisons will be made to parse the attributes. If the attribute is called CCode, then the process_ccode_attributes() function will be called to parse the key-value pairs supplied.
Attributes Recognized by Vala
All Vala.Symbol (class, constant, delegate, enum, enum value, errordomain, field, interface, method, property, signal, struct):
Deprecatedsince
Vala.Namespace
CCode
Vala.Class
CCodeDBusCompactImmutableErrorBase
Vala.Struct
CCodeSimpleTypeIntegerTypeFloatingTypeBooleanTypeImmutable
Vala.Interface
CCodeDBus
Vala.Enum
CCodeFlags
Vala.Method
CCodeDBusReturnsModifiedPointerFloatingReferenceNoWrapperNoReturnModuleInit
Vala.CreationMethod
Same as
Vala.Method— this class inherits fromMethod.
Vala.FormalParameter
CCode
Vala.Property
CCodeDBusNoAccessorMethodDescriptionnickblurb
Vala.PropertyAccessor
CCode
Vala.Delegate
CCode
Vala.Constant
CCode
Vala.Field
CCode
Vala.Signal
DBusSignalHasEmitter
