wake.analysis.utils
module
#
get_all_base_and_child_declarations(declaration, *, base=True, child=True)
#
get_all_base_and_child_declarations(
declaration: FunctionDefinition,
*,
base: bool = True,
child: bool = True
) -> Set[Union[FunctionDefinition, VariableDeclaration]]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
declaration
|
Union[FunctionDefinition, ModifierDefinition, VariableDeclaration]
|
Declaration to get base and child declarations of. |
required |
base
|
bool
|
Return base declarations of the given declaration. |
True
|
child
|
bool
|
Return child declarations of the given declaration. |
True
|
Returns:
Type | Description |
---|---|
Union[Set[Union[FunctionDefinition, VariableDeclaration]], Set[ModifierDefinition]]
|
Recursively all base and child declarations of the given declaration plus the given declaration itself. Set of ModifierDefinitions is returned for ModifierDefinition input, otherwise set of FunctionDefinitions and VariableDeclarations is returned. |
Source code in wake/analysis/utils.py
get_function_implementations(function, *, variables=True)
#
Also returns the given function if it is implemented.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
function
|
FunctionDefinition
|
Function to get implementations of. |
required |
variables
|
bool
|
Include variable declarations in the returned set. |
True
|
Returns:
Type | Description |
---|---|
Set[Union[FunctionDefinition, VariableDeclaration]]
|
All overridden implemented functions and variable declarations of the given function. |
Source code in wake/analysis/utils.py
get_modifier_implementations(modifier)
#
Also returns the given modifier if it is implemented.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
modifier
|
ModifierDefinition
|
Modifier to get implementations of. |
required |
Returns:
Type | Description |
---|---|
Set[ModifierDefinition]
|
All overridden implemented modifiers of the given modifier. |
Source code in wake/analysis/utils.py
pair_function_call_arguments(definition, call)
#
Pairs function call arguments with error/event/function/struct definition parameters. Returned pairs are in the same order as the definition parameters/members.
Example
The function also handles calls of bounded functions with the using for
directive.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
definition
|
Union[ErrorDefinition, EventDefinition, FunctionDefinition, StructDefinition]
|
Definition called. |
required |
call
|
FunctionCall
|
Function call or struct constructor call. |
required |
Returns:
Type | Description |
---|---|
Tuple[Tuple[VariableDeclaration, ExpressionAbc], ...]
|
Tuple of pairs of definition parameters/members and function call arguments. |