63 lines
2.6 KiB
Diff
63 lines
2.6 KiB
Diff
|
From fe9f10e0ee9c1052caea63a2679d14b1acefd4b2 Mon Sep 17 00:00:00 2001
|
||
|
From: James Carter <jwcart2@gmail.com>
|
||
|
Date: Tue, 11 May 2021 14:36:29 -0400
|
||
|
Subject: [PATCH] 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>
|
||
|
---
|
||
|
secilc/docs/cil_call_macro_statements.md | 24 ++++++++++++------------
|
||
|
1 file changed, 12 insertions(+), 12 deletions(-)
|
||
|
|
||
|
diff --git a/secilc/docs/cil_call_macro_statements.md b/secilc/docs/cil_call_macro_statements.md
|
||
|
index 352a9fb06efe..3cc14bf86fdb 100644
|
||
|
--- a/secilc/docs/cil_call_macro_statements.md
|
||
|
+++ b/secilc/docs/cil_call_macro_statements.md
|
||
|
@@ -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:**
|
||
|
--
|
||
|
2.32.0
|
||
|
|