Skip to content

Commit

Permalink
Remove binding path cartesian product
Browse files Browse the repository at this point in the history
`source` was not bound within MkConstBindingPathComponentList, and
was semantically unused outside the class itself.
  • Loading branch information
lcartey committed Nov 27, 2024
1 parent e715c35 commit 761c638
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -839,18 +839,18 @@ module BindingStringParser<BindingStringReaderSig BindingStringReader> {
then
exists(BindingPathComponentList tail |
mkBindingPathComponentList(getNextSkippingWhitespace(nextToken), tail, last) and
list = MkConstBindingPathComponentList(name, tail, first)
list = MkConstBindingPathComponentList(name, tail)
)
else (
list = MkConstBindingPathComponentList(name, MkEmptyBindingPathComponentList(), first) and
list = MkConstBindingPathComponentList(name, MkEmptyBindingPathComponentList()) and
last = name
)
)
}

private newtype TBindingPathComponentList =
MkEmptyBindingPathComponentList() or
MkConstBindingPathComponentList(NameToken headToken, BindingPathComponentList tail, Token source) {
MkConstBindingPathComponentList(NameToken headToken, BindingPathComponentList tail) {
exists(Token nextToken | nextToken = getNextSkippingWhitespace(headToken) |
if nextToken instanceof ForwardSlashToken or nextToken instanceof DotToken
then mkBindingPathComponentList(getNextSkippingWhitespace(nextToken), tail, _)
Expand All @@ -863,18 +863,16 @@ module BindingStringParser<BindingStringReaderSig BindingStringReader> {
this = MkEmptyBindingPathComponentList() and result = ""
or
exists(NameToken head, BindingPathComponentList tail |
this = MkConstBindingPathComponentList(head, tail, _) and
this = MkConstBindingPathComponentList(head, tail) and
if tail instanceof MkEmptyBindingPathComponentList
then result = head.toString()
else result = head.toString() + "/" + tail.toString()
)
}

NameToken getHead() { this = MkConstBindingPathComponentList(result, _, _) }
NameToken getHead() { this = MkConstBindingPathComponentList(result, _) }

BindingPathComponentList getTail() { this = MkConstBindingPathComponentList(_, result, _) }

Token getSource() { this = MkConstBindingPathComponentList(_, _, result) }
BindingPathComponentList getTail() { this = MkConstBindingPathComponentList(_, result) }
}

predicate mkAbsoluteBindingPath(Token first, BindingPath path, Token last) {
Expand Down

0 comments on commit 761c638

Please sign in to comment.