Elsa Ast Type Function
From MozillaWiki
Function is a Ast type node (without any subtype nodes). Function is a record.
Record Data Fields
- function_dflags : declFlags
- retspec : TypeSpecifier
- nameAndParams : Declarator
- function_inits : MemberInit list
- function_body : Statement (* = S_compound *) option
- function_handlers : Handler list
- funcType : TY_Function
- receiver : Variable option
- retVar : Variable option
- function_dtor_statement : Statement option
- implicitlyDefined : bool
Subtype Nodes (Subclasses)
Function has no subtype nodes.
Comments
Please make your modifications only below, because the content above will be regenerated automatically from time to time.
Field content
- nameAndParams
- Name. Parameters can be accessed easier via funcType.function_type_params.
- function_inits
- nonempty only for constructors: member initialization list
- implicitlyDefined
- true, if compiler generated function (default constructor of similar)
Location
Function nodes don't have a sourceLoc field, but the syntax nodes above Function nodes do.
Function name
To obtain the function name go to the declarator via nameAndParams and extract the name of the declarator_var. Variable name and declarator variable are always present, as far as I can tell.
Parameters
To access the variable nodes for the function parameters follow funcType.function_type_params. For nonstatic methods, this contains the this pointer, which actually has a reference type (with variable_name __receiver).