From 3a8e582da86d5af30d313fa3d06a5e0417069096 Mon Sep 17 00:00:00 2001 From: teocollin1995 Date: Mon, 5 Dec 2022 15:58:00 -0500 Subject: [PATCH] Don't use match_type; only use egg_head with egg_args --- src/util.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/util.rs b/src/util.rs index 62b329c..aedd7d2 100644 --- a/src/util.rs +++ b/src/util.rs @@ -28,11 +28,8 @@ pub fn build_node(egraph: &mut EGraph, expr: &PyAny) egraph.add(enode) } else if let Ok(args) = expr.getattr("__match_args__") { let args = args.downcast::().unwrap(); - let class = if let Ok(class) = expr.getattr("__egg_head__") { - class.downcast::().unwrap() - } else { - expr.get_type() - }; + let class = expr.get_type(); + //let children = args.iter().map(|arg| expr.getattr(arg).unwrap()); let enode = PythonNode::op(class, args.iter().map(|child| build_node(egraph, expr.getattr(child).unwrap()))); egraph.add(enode) @@ -65,11 +62,8 @@ pub fn build_pattern(ast: &mut PatternAst, tree: &PyAny) -> Id { ast.add(ENodeOrVar::ENode(enode)) } else if let Ok(args) = tree.getattr("__match_args__") { let args = args.downcast::().unwrap(); - let class = if let Ok(class) = tree.getattr("__egg_head__") { - class.downcast::().unwrap() - } else { - tree.get_type() - }; + let class = tree.get_type(); + //let children = args.iter().map(|arg| tree.getattr(arg).unwrap()); let enode = PythonNode::op(class, args.iter().map(|child| build_pattern(ast, tree.getattr(child).unwrap()))); ast.add(ENodeOrVar::ENode(enode))