loki.transformations.inline.constants
Functions
|
Replace instances of variables with known constant values by Literals. |
- inline_constant_parameters(routine, external_only=True)
Replace instances of variables with known constant values by Literals.
Notes
The
.type.initialproperty is used to derive the replacement value,a which means for symbols imported from external modules, the parentModuleneeds to be supplied in thedefinitionsto the constructor when creating theSubroutine.Variables that are replaced are also removed from their corresponding import statements, with empty import statements being removed alltogether.
- Parameters:
routine (
Subroutine) – Procedure in which to inline/resolve constant parameters.external_only (bool, optional) – Do not replace variables declared in the local scope (default: True)