Verified Commit b7174282 authored by Amin Bandali's avatar Amin Bandali
Browse files

Instead of adding all Sigs then rulling them out, only add in joins

Instead of marking every Sig as a candidate initially, only mark those
as candidates that are actually involved in a “field-access” dot-join.

There might still be false positives, or perhaps some false negatives,
but this should weed out some more false positives.
parent 0772a738
...@@ -66,10 +66,10 @@ public class SSRVisitor extends VisitReturn { ...@@ -66,10 +66,10 @@ public class SSRVisitor extends VisitReturn {
// `var in sig', discard candidate // `var in sig', discard candidate
if (x.op == ExprBinary.Op.JOIN) { if (x.op == ExprBinary.Op.JOIN) {
if (x.left instanceof ExprUnary && x.right instanceof ExprUnary) if (x.left instanceof ExprUnary && x.right instanceof ExprUnary)
if (!isFieldAccess(x)) { if (isFieldAccess(x)) {
PrimSig s = getFirstPrimSig(x.left); PrimSig s = getFirstPrimSig(x.left);
if (!builtins.contains(s)) if (!builtins.contains(s))
candidates.put(s, false); candidates.put(s, true);
} }
} }
else { else {
...@@ -150,8 +150,16 @@ public class SSRVisitor extends VisitReturn { ...@@ -150,8 +150,16 @@ public class SSRVisitor extends VisitReturn {
candidates.put((PrimSig)subsub, false); candidates.put((PrimSig)subsub, false);
} }
} }
else if (s instanceof PrimSig) else if (s instanceof PrimSig) {
System.out.println("no :( " + (PrimSig)s); if (((PrimSig)s).getFieldDecls().size() > 1)
if (!builtins.contains((PrimSig)s))
candidates.put((PrimSig)s, false);
}
/**
* else: mostly `ExprVar's with empty type which we don't
* care about at all, or `ExprBinary's, which I think we
* handle well enough in their own visit(ExprBinary) call.
*/
} }
for (Decl d : x.decls) for (Decl d : x.decls)
visitThis(d.expr); visitThis(d.expr);
...@@ -205,8 +213,10 @@ public class SSRVisitor extends VisitReturn { ...@@ -205,8 +213,10 @@ public class SSRVisitor extends VisitReturn {
// add the sig as a candidate if we haven't seen it before // add the sig as a candidate if we haven't seen it before
if (x instanceof PrimSig) { if (x instanceof PrimSig) {
PrimSig px = (PrimSig)x; PrimSig px = (PrimSig)x;
/*
if (!builtins.contains(px) && !candidates.containsKey(px)) if (!builtins.contains(px) && !candidates.containsKey(px))
candidates.put(px, true); candidates.put(px, true);
*/
if (px.isMeta != null) if (px.isMeta != null)
candidates.put(px, false); candidates.put(px, false);
if (px.isAbstract != null) if (px.isAbstract != null)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment