summaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorVolker Weißmann <volker.weissmann@gmx.de>2025-03-16 23:01:03 +0100
committerDylan Baker <dylan@pnwbakers.com>2025-05-29 09:20:27 -0700
commit9c5c9745d02e2931e83e01ee6d055ccda6cfe14a (patch)
tree8f4f6a959c5194ecd1b89c482316195288504098 /test cases
parentad10057deb4705a937bf8ae1801ce3632fa49ff8 (diff)
downloadmeson-9c5c9745d02e2931e83e01ee6d055ccda6cfe14a.tar.gz
Add AstInterpreter.dataflow_dag
Make the AstInterpreter create a directed acyclic graph (called `dataflow_dag`) that stores the how the data flowes from one node in the AST to another. Add `AstInterpreter.node_to_runtime_value` which uses `dataflow_dag` to find what value a variable at runtime will have. We don't use dataflow_dag or node_to_runtime_value anywhere yet, but it will prove useful in future commits.
Diffstat (limited to 'test cases')
-rw-r--r--test cases/rewrite/1 basic/expected_dag.txt83
-rw-r--r--test cases/unit/120 rewrite/meson.build5
2 files changed, 88 insertions, 0 deletions
diff --git a/test cases/rewrite/1 basic/expected_dag.txt b/test cases/rewrite/1 basic/expected_dag.txt
new file mode 100644
index 000000000..abc04fc31
--- /dev/null
+++ b/test cases/rewrite/1 basic/expected_dag.txt
@@ -0,0 +1,83 @@
+Data flowing to FunctionNode(1:0):
+ StringNode(1:8)
+ StringNode(1:23)
+Data flowing to ArrayNode(3:7):
+ StringNode(3:8)
+ StringNode(3:20)
+Data flowing to FunctionNode(4:7):
+ ArrayNode(4:13)
+Data flowing to ArrayNode(4:13):
+ StringNode(4:14)
+ StringNode(4:27)
+Data flowing to IdNode(5:7):
+ ArrayNode(3:7)
+Data flowing to ArrayNode(6:7):
+ IdNode(6:8)
+Data flowing to IdNode(6:8):
+ IdNode(5:7)
+Data flowing to FunctionNode(10:7):
+ StringNode(10:18)
+ ArithmeticNode(10:34)
+Data flowing to ArithmeticNode(10:34):
+ IdNode(10:34)
+ IdNode(10:41)
+Data flowing to IdNode(10:34):
+ ArrayNode(3:7)
+Data flowing to IdNode(10:41):
+ FunctionNode(4:7)
+Data flowing to FunctionNode(11:7):
+ StringNode(11:18)
+ IdNode(11:34)
+Data flowing to IdNode(11:34):
+ ArrayNode(3:7)
+Data flowing to FunctionNode(12:7):
+ StringNode(12:18)
+ ArrayNode(12:34)
+Data flowing to ArrayNode(12:34):
+ IdNode(12:35)
+Data flowing to IdNode(12:35):
+ FunctionNode(4:7)
+Data flowing to FunctionNode(13:7):
+ StringNode(13:18)
+ ArrayNode(13:34)
+Data flowing to ArrayNode(13:34):
+ StringNode(13:35)
+ StringNode(13:47)
+Data flowing to FunctionNode(14:7):
+ StringNode(14:18)
+ ArrayNode(14:34)
+Data flowing to ArrayNode(14:34):
+ StringNode(14:35)
+ ArrayNode(14:47)
+Data flowing to ArrayNode(14:47):
+ StringNode(14:48)
+Data flowing to FunctionNode(15:7):
+ StringNode(15:18)
+ ArrayNode(15:34)
+Data flowing to ArrayNode(15:34):
+ IdNode(15:35)
+ StringNode(15:41)
+Data flowing to IdNode(15:35):
+ FunctionNode(4:7)
+Data flowing to FunctionNode(16:7):
+ StringNode(16:18)
+ StringNode(16:34)
+ StringNode(16:46)
+Data flowing to FunctionNode(17:7):
+ StringNode(17:18)
+ StringNode(17:34)
+ IdNode(17:47)
+ StringNode(17:53)
+Data flowing to IdNode(17:47):
+ ArrayNode(3:7)
+Data flowing to FunctionNode(18:7):
+ StringNode(18:18)
+ IdNode(18:34)
+Data flowing to IdNode(18:34):
+ IdNode(5:7)
+Data flowing to FunctionNode(19:0):
+ StringNode(19:11)
+ IdNode(19:27)
+Data flowing to IdNode(19:27):
+ ArrayNode(6:7)
+
diff --git a/test cases/unit/120 rewrite/meson.build b/test cases/unit/120 rewrite/meson.build
index 7d0330b9e..545bb0fde 100644
--- a/test cases/unit/120 rewrite/meson.build
+++ b/test cases/unit/120 rewrite/meson.build
@@ -62,6 +62,7 @@ cppcoro = declare_dependency(
)
+cpp_compiler = meson.get_compiler('cpp')
if get_option('unicode') #if comment
#if comment 2
mfc=cpp_compiler.find_library(get_option('debug')?'mfc140ud':'mfc140u')
@@ -80,6 +81,10 @@ assert(not (3 in [1, 2]), '''3 shouldn't be in [1, 2]''')
assert('b' in ['a', 'b'], ''''b' should be in ['a', 'b']''')
assert('c' not in ['a', 'b'], ''''c' shouldn't be in ['a', 'b']''')
+exe1 = 'exe1'
+exe2 = 'exe2'
+exe3 = 'exe3'
+
assert(exe1 in [exe1, exe2], ''''exe1 should be in [exe1, exe2]''')
assert(exe3 not in [exe1, exe2], ''''exe3 shouldn't be in [exe1, exe2]''')