Ignore synthesised reads for jump-to-definition

We synthesise variables for things like tuple patterns. For example,
this Ruby code:

    a, b = ...

becomes:

    __synth__0 = ...
    a = __synth__0[0]
    b = __synth__0[1]

The `__synth__` variables should be ignored when calculating
jump-to-definition information, since they don't appear in the original
source code.
This commit is contained in:
Harry Maclean
2021-08-05 14:54:38 +01:00
parent a814010665
commit a16cd8967b
3 changed files with 14 additions and 6 deletions

View File

@@ -43,7 +43,9 @@ newtype DefLoc =
exists(Ssa::WriteDefinition w |
write = w.getWriteAccess() and
read = w.getARead().getExpr() and
not read.getLocation() = write.getLocation()
not read.getLocation() = write.getLocation() and
not read.isSynthesized()
)
)
}