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 {
// `var in sig', discard candidate
if (x.op == ExprBinary.Op.JOIN) {
if (x.left instanceof ExprUnary && x.right instanceof ExprUnary)
if (!isFieldAccess(x)) {
if (isFieldAccess(x)) {
PrimSig s = getFirstPrimSig(x.left);
if (!builtins.contains(s))
candidates.put(s, false);
candidates.put(s, true);
else {
......@@ -150,8 +150,16 @@ public class SSRVisitor extends VisitReturn {
candidates.put((PrimSig)subsub, false);
else if (s instanceof PrimSig)
System.out.println("no :( " + (PrimSig)s);
else if (s instanceof PrimSig) {
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)
......@@ -205,8 +213,10 @@ public class SSRVisitor extends VisitReturn {
// add the sig as a candidate if we haven't seen it before
if (x instanceof PrimSig) {
PrimSig px = (PrimSig)x;
if (!builtins.contains(px) && !candidates.containsKey(px))
candidates.put(px, true);
if (px.isMeta != null)
candidates.put(px, false);
if (px.isAbstract != null)
Supports Markdown
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