Remove unused pipe node definitions
The `Pipe` node and its associated logic have been removed from the AST. This commit cleans up the code by removing all references to this defunct node in the analyzer, binder, captures, dumper, lowering, macros, optimizer, and type checker. The parser no longer recognizes the `pipe` keyword.
This commit is contained in:
@@ -226,24 +226,6 @@ impl<'a> Analyzer<'a> {
|
||||
Purity::Impure,
|
||||
)
|
||||
}
|
||||
NodeKind::Pipe {
|
||||
inputs,
|
||||
lambda,
|
||||
} => {
|
||||
let mut analyzed_inputs = Vec::with_capacity(inputs.len());
|
||||
for input in inputs {
|
||||
analyzed_inputs.push(Rc::new(self.visit(input.clone())));
|
||||
}
|
||||
let a_lambda = Rc::new(self.visit(lambda.clone()));
|
||||
(
|
||||
NodeKind::Pipe {
|
||||
inputs: analyzed_inputs,
|
||||
lambda: a_lambda,
|
||||
},
|
||||
Purity::Impure,
|
||||
)
|
||||
}
|
||||
|
||||
NodeKind::Block { exprs } => {
|
||||
let mut new_exprs = Vec::with_capacity(exprs.len());
|
||||
let mut p = Purity::Pure;
|
||||
|
||||
@@ -358,22 +358,6 @@ impl Binder {
|
||||
}
|
||||
}
|
||||
|
||||
SyntaxKind::Pipe { inputs, lambda } => {
|
||||
let mut bound_inputs = Vec::with_capacity(inputs.len());
|
||||
for input in inputs {
|
||||
bound_inputs.push(Rc::new(self.bind(input, ExprContext::Expression, diag)));
|
||||
}
|
||||
let bound_lambda =
|
||||
Rc::new(self.bind(lambda.as_ref(), ExprContext::Expression, diag));
|
||||
self.make_node(
|
||||
node.identity.clone(),
|
||||
NodeKind::Pipe {
|
||||
inputs: bound_inputs,
|
||||
lambda: bound_lambda,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
SyntaxKind::Lambda { params, body, .. } => {
|
||||
let identity = node.identity.clone();
|
||||
self.functions
|
||||
|
||||
@@ -63,20 +63,6 @@ impl CapturePass {
|
||||
info,
|
||||
},
|
||||
|
||||
NodeKind::Pipe {
|
||||
inputs,
|
||||
lambda,
|
||||
} => {
|
||||
let mut t_inputs = Vec::with_capacity(inputs.len());
|
||||
for input in inputs {
|
||||
t_inputs.push(Rc::new(Self::transform(input.as_ref().clone(), capture_map)));
|
||||
}
|
||||
NodeKind::Pipe {
|
||||
inputs: t_inputs,
|
||||
lambda: Rc::new(Self::transform(lambda.as_ref().clone(), capture_map)),
|
||||
}
|
||||
}
|
||||
|
||||
NodeKind::Block { exprs } => NodeKind::Block {
|
||||
exprs: exprs
|
||||
.into_iter()
|
||||
|
||||
@@ -138,16 +138,6 @@ impl Dumper {
|
||||
self.visit(args);
|
||||
self.indent -= 1;
|
||||
}
|
||||
NodeKind::Pipe { inputs, lambda } => {
|
||||
self.log("Pipe", node);
|
||||
self.indent += 1;
|
||||
for input in inputs {
|
||||
self.visit(input);
|
||||
}
|
||||
self.visit(lambda);
|
||||
self.indent -= 1;
|
||||
}
|
||||
|
||||
NodeKind::Block { exprs } => {
|
||||
self.log("Block", node);
|
||||
self.indent += 1;
|
||||
|
||||
@@ -99,20 +99,6 @@ impl Lowering {
|
||||
args: Rc::new(Self::transform(args.clone(), false, allocator)),
|
||||
}
|
||||
}
|
||||
NodeKind::Pipe {
|
||||
inputs,
|
||||
lambda,
|
||||
} => {
|
||||
let mut t_inputs = Vec::with_capacity(inputs.len());
|
||||
for input in inputs {
|
||||
t_inputs.push(Rc::new(Self::transform(input.clone(), false, allocator)));
|
||||
}
|
||||
NodeKind::Pipe {
|
||||
inputs: t_inputs,
|
||||
lambda: Rc::new(Self::transform(lambda.clone(), false, allocator)),
|
||||
}
|
||||
}
|
||||
|
||||
NodeKind::If {
|
||||
cond,
|
||||
then_br,
|
||||
|
||||
@@ -154,22 +154,6 @@ impl<E: MacroEvaluator> MacroExpander<E> {
|
||||
})
|
||||
}
|
||||
|
||||
SyntaxKind::Pipe { inputs, lambda } => {
|
||||
let mut expanded_inputs = Vec::with_capacity(inputs.len());
|
||||
for input in inputs {
|
||||
expanded_inputs.push(Rc::new(self.expand_recursive((*input).clone())?));
|
||||
}
|
||||
let expanded_lambda = Rc::new(self.expand_recursive((*lambda).clone())?);
|
||||
Ok(SyntaxNode {
|
||||
identity: node.identity,
|
||||
kind: SyntaxKind::Pipe {
|
||||
inputs: expanded_inputs,
|
||||
lambda: expanded_lambda,
|
||||
},
|
||||
ty: (),
|
||||
})
|
||||
}
|
||||
|
||||
SyntaxKind::Lambda { params, body, .. } => {
|
||||
self.registry.push();
|
||||
let expanded_params = self.expand_recursive((*params).clone())?;
|
||||
@@ -536,22 +520,6 @@ impl<E: MacroEvaluator> MacroExpander<E> {
|
||||
})
|
||||
}
|
||||
|
||||
SyntaxKind::Pipe { inputs, lambda } => {
|
||||
let mut expanded_inputs = Vec::with_capacity(inputs.len());
|
||||
for input in inputs {
|
||||
expanded_inputs.push(Rc::new(self.expand_template((*input).clone(), state)?));
|
||||
}
|
||||
let expanded_lambda = Rc::new(self.expand_template((*lambda).clone(), state)?);
|
||||
Ok(SyntaxNode {
|
||||
identity: node.identity,
|
||||
kind: SyntaxKind::Pipe {
|
||||
inputs: expanded_inputs,
|
||||
lambda: expanded_lambda,
|
||||
},
|
||||
ty: (),
|
||||
})
|
||||
}
|
||||
|
||||
SyntaxKind::Lambda { params, body, .. } => {
|
||||
let expanded_params = self.expand_template((*params).clone(), state)?;
|
||||
let body = self.expand_template((*body).clone(), state)?;
|
||||
|
||||
@@ -455,33 +455,6 @@ impl Optimizer {
|
||||
)
|
||||
}
|
||||
|
||||
NodeKind::Pipe {
|
||||
inputs,
|
||||
lambda,
|
||||
} => {
|
||||
let mut o_inputs = Vec::with_capacity(inputs.len());
|
||||
let mut inputs_changed = false;
|
||||
for input in inputs {
|
||||
let opt = self.visit_node(input.clone(), sub, path);
|
||||
if !Rc::ptr_eq(&opt, input) {
|
||||
inputs_changed = true;
|
||||
}
|
||||
o_inputs.push(opt);
|
||||
}
|
||||
let o_lambda = self.visit_node(lambda.clone(), sub, path);
|
||||
|
||||
if !inputs_changed && Rc::ptr_eq(&o_lambda, lambda) {
|
||||
return node_rc;
|
||||
}
|
||||
|
||||
(
|
||||
NodeKind::Pipe {
|
||||
inputs: o_inputs,
|
||||
lambda: o_lambda,
|
||||
},
|
||||
node.ty.clone(),
|
||||
)
|
||||
}
|
||||
NodeKind::Block { exprs } => {
|
||||
let mut info = UsageInfo::default();
|
||||
if !exprs.is_empty() {
|
||||
|
||||
@@ -158,12 +158,6 @@ impl UsageInfo {
|
||||
NodeKind::Again { args } => {
|
||||
self.collect(args);
|
||||
}
|
||||
NodeKind::Pipe { inputs, lambda, .. } => {
|
||||
for input in inputs {
|
||||
self.collect(input);
|
||||
}
|
||||
self.collect(lambda);
|
||||
}
|
||||
NodeKind::Nop
|
||||
| NodeKind::FieldAccessor(_)
|
||||
| NodeKind::Extension(_)
|
||||
|
||||
@@ -550,42 +550,6 @@ impl TypeChecker {
|
||||
)
|
||||
}
|
||||
|
||||
NodeKind::Pipe { inputs, lambda } => {
|
||||
let mut typed_inputs = Vec::with_capacity(inputs.len());
|
||||
let mut arg_types = Vec::with_capacity(inputs.len());
|
||||
for input in inputs {
|
||||
let typed_input = self.check_node(input, ctx, diag);
|
||||
let arg_ty = if let StaticType::Series(inner) = &typed_input.ty {
|
||||
*inner.clone()
|
||||
} else if let StaticType::Stream(inner) = &typed_input.ty {
|
||||
*inner.clone()
|
||||
} else {
|
||||
StaticType::Any
|
||||
};
|
||||
arg_types.push(arg_ty);
|
||||
typed_inputs.push(Rc::new(typed_input));
|
||||
}
|
||||
|
||||
let typed_lambda = self.check_node_as_bound(lambda.as_ref(), &arg_types, diag);
|
||||
|
||||
let ret_ty = if let StaticType::Function(sig) = &typed_lambda.ty {
|
||||
if let StaticType::Optional(inner) = &sig.ret {
|
||||
*inner.clone()
|
||||
} else {
|
||||
sig.ret.clone()
|
||||
}
|
||||
} else {
|
||||
StaticType::Any
|
||||
};
|
||||
(
|
||||
NodeKind::Pipe {
|
||||
inputs: typed_inputs,
|
||||
lambda: Rc::new(typed_lambda),
|
||||
},
|
||||
StaticType::Stream(Box::new(ret_ty)),
|
||||
)
|
||||
}
|
||||
|
||||
NodeKind::Block { exprs } => {
|
||||
let mut typed_exprs = Vec::new();
|
||||
let mut last_ty = StaticType::Void;
|
||||
|
||||
Reference in New Issue
Block a user