secilc/docs: Relocate and reword macro call name resolution order

The listing of the order was in the macro section, but it belongs
in the call section.

Move the listing of the order to the call section and provide a
better explanation.

Signed-off-by: James Carter <jwcart2@gmail.com>
This commit is contained in:
James Carter 2021-05-11 14:36:29 -04:00
parent aa8ac8ffaf
commit fe9f10e0ee
1 changed files with 12 additions and 12 deletions

View File

@ -8,6 +8,18 @@ Instantiate a [macro](#macro) within the current namespace. There may be zero or
Each parameter passed contains an argument to be resolved by the [macro](#macro), these can be named or anonymous but must conform to the parameter types defined in the [`macro`](cil_call_macro_statements.md#macro) statement.
Macro rules are resolved by searching in the following order:
- The macro namespace (If found this means that the name was declared in the macro and is now declared in the namespace of one of the parents of the call.)
- The call arguments
- The parent namespaces of the macro being called (if any) with the exception of the global namespace.
- The parent namespaces of the call (if any) with the exception of the global namespace.
- The global namespace
**Statement definition:**
```secil
@ -46,18 +58,6 @@ macro
Declare a macro in the current namespace with its associated parameters. The macro identifier is used by the [`call`](cil_call_macro_statements.md#call) statement to instantiate the macro and resolve any parameters. The call statement may be within the body of a macro.
When resolving macros the following places are checked in this order:
- Items defined inside the macro
- Items passed into the macro as arguments
- Items defined in the same namespace of the macro
- Items defined in the callers namespace
- Items defined in the global namespace
[`tunable`](cil_conditional_statements.md#tunable), [`in`](cil_container_statements.md#in), [`block`](cil_container_statements.md#block), [`blockinherit`](cil_container_statements.md#blockinherit), [`blockabstract`](cil_container_statements.md#blockabstract), and other [`macro`](cil_call_macro_statements.md#macro) statements are not allowed in [`macro`](cil_call_macro_statements.md#macro) blocks.
**Statement definition:**