Pipe Parameter is now a Tuple

This commit is contained in:
Michael Schimmel
2026-01-05 00:13:51 +01:00
parent 242ec9a56e
commit 264314cd93
15 changed files with 322 additions and 1244 deletions
+2 -31
View File
@@ -55,9 +55,6 @@ type
function VisitTuple(const Node: IAstNode): Boolean;
// Pipe Support
function VisitPipeInput(const Node: IAstNode): Boolean;
function VisitPipeSelectorList(const Node: IAstNode): Boolean;
function VisitPipeInputList(const Node: IAstNode): Boolean;
function VisitPipe(const Node: IAstNode): Boolean;
// Helper to check if a node is pure (handling nil gracefully)
@@ -131,9 +128,6 @@ begin
Register(akTuple, VisitTuple);
// Pipes
Register(akPipeInput, VisitPipeInput);
Register(akPipeSelectorList, VisitPipeSelectorList);
Register(akPipeInputList, VisitPipeInputList);
Register(akPipe, VisitPipe);
end;
@@ -328,34 +322,11 @@ end;
// --- Pipe Support ---
function TPurityAnalyzer.VisitPipeInput(const Node: IAstNode): Boolean;
begin
var P := Node.AsPipeInput;
// Input node itself is declarative.
// But we check its parts just in case.
Result := IsNodePure(P.StreamSource) and IsNodePure(P.Selectors);
end;
function TPurityAnalyzer.VisitPipeSelectorList(const Node: IAstNode): Boolean;
begin
for var item in Node.AsPipeSelectorList do
if not IsNodePure(item) then
exit(False);
Result := True;
end;
function TPurityAnalyzer.VisitPipeInputList(const Node: IAstNode): Boolean;
begin
for var item in Node.AsPipeInputList do
if not IsNodePure(item) then
exit(False);
Result := True;
end;
function TPurityAnalyzer.VisitPipe(const Node: IAstNode): Boolean;
begin
var P := Node.AsPipe;
// A pipe is pure if its input definitions are pure AND its transformation lambda is pure.
// A pipe is pure if its inputs are pure AND its transformation lambda is pure.
// P.Inputs is an ITupleNode (recursive Tuple of Tuples), so VisitTuple handles it.
Result := IsNodePure(P.Inputs) and IsNodePure(P.Transformation);
end;