Skip to content
Snippets Groups Projects
Commit 082f8443 authored by Julien Lopez's avatar Julien Lopez
Browse files

Fix handling of QIRNot

parent 2c3dc4dc
Branches
No related tags found
No related merge requests found
......@@ -107,6 +107,10 @@ public class QIRSQLVisitor implements IQIRVisitor<String> {
return "(" + qirNotEqual.getLeft().accept(this) + ") != (" + qirNotEqual.getRight().accept(this) + ")";
}
public String visit(QIRNot qirNot) {
return "NOT (" + qirNot.getChild().accept(this) + ")";
}
public String visit(QIRTable qirTable) {
return qirTable.getTableName();
}
......
......@@ -134,6 +134,11 @@ public final class QIRGreedyReduceVisitor implements IQIRVisitor<QIRNode> {
return new QIRNotEqual(qirNotEqual.getSourceSection(), qirNotEqual.getLeft().accept(this), qirNotEqual.getRight().accept(this));
}
@Override
public QIRNode visit(QIRNot qirNot) {
return new QIRNot(qirNot.getSourceSection(), qirNot.getChild().accept(this));
}
@Override
public QIRNode visit(QIRVariable qirVariable) {
if (env.containsKey(qirVariable.getId())) {
......
......@@ -64,6 +64,8 @@ public interface IQIRVisitor<T> {
public abstract T visit(QIRNotEqual qirNotEqual);
public abstract T visit(QIRNot qirNot);
public abstract T visit(QIRTable qirTable);
public default T visit(QIRList qirList) {
......
......@@ -142,6 +142,11 @@ public final class QIRFreeVarsVisitor implements IQIRVisitor<HashMap<String, QIR
return qirNotEqual.getRight().accept(this);
}
@Override
public HashMap<String, QIRVariable> visit(QIRNot qirNot) {
return qirNot.getChild().accept(this);
}
@Override
public HashMap<String, QIRVariable> visit(QIRTable qirTable) {
return freeVariables;
......
......@@ -109,6 +109,11 @@ public final class QIRPrintVisitor implements IQIRVisitor<String> {
return "(" + qirNotEqual.getLeft().accept(this) + ") != (" + qirNotEqual.getRight().accept(this) + ")";
}
@Override
public String visit(QIRNot qirNot) {
return "!(" + qirNot.getChild().accept(this) + ")";
}
@Override
public String visit(QIRTable qirTable) {
return "Table(" + qirTable.getTableName() + ")";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment