Ruby: use overlayChangedFiles extensional in discard predicates

This commit is contained in:
Nick Rolfe
2025-06-27 12:19:52 +01:00
parent ba01a70e0a
commit d8574a6919
4 changed files with 33 additions and 67 deletions

View File

@@ -60,10 +60,6 @@ module QL {
)
}
/** Holds if `file` was extracted as part of the overlay database. */
overlay[local]
private predicate discardFile(@file file) { isOverlay() and file = getNodeFile(_) }
/** Holds if `node` is in the `file` and is part of the overlay base database. */
overlay[local]
private predicate discardableAstNode(@file file, @ql_ast_node node) {
@@ -73,7 +69,9 @@ module QL {
/** Holds if `node` should be discarded, because it is part of the overlay base and is in a file that was also extracted as part of the overlay database. */
overlay[discard_entity]
private predicate discardAstNode(@ql_ast_node node) {
exists(@file file | discardableAstNode(file, node) and discardFile(file))
exists(@file file, string path | files(file, path) |
discardableAstNode(file, node) and overlayChangedFiles(path)
)
}
/** A class representing `add_expr` nodes. */
@@ -1354,10 +1352,6 @@ module Dbscheme {
)
}
/** Holds if `file` was extracted as part of the overlay database. */
overlay[local]
private predicate discardFile(@file file) { isOverlay() and file = getNodeFile(_) }
/** Holds if `node` is in the `file` and is part of the overlay base database. */
overlay[local]
private predicate discardableAstNode(@file file, @dbscheme_ast_node node) {
@@ -1367,7 +1361,9 @@ module Dbscheme {
/** Holds if `node` should be discarded, because it is part of the overlay base and is in a file that was also extracted as part of the overlay database. */
overlay[discard_entity]
private predicate discardAstNode(@dbscheme_ast_node node) {
exists(@file file | discardableAstNode(file, node) and discardFile(file))
exists(@file file, string path | files(file, path) |
discardableAstNode(file, node) and overlayChangedFiles(path)
)
}
/** A class representing `annotName` tokens. */
@@ -1714,10 +1710,6 @@ module Blame {
)
}
/** Holds if `file` was extracted as part of the overlay database. */
overlay[local]
private predicate discardFile(@file file) { isOverlay() and file = getNodeFile(_) }
/** Holds if `node` is in the `file` and is part of the overlay base database. */
overlay[local]
private predicate discardableAstNode(@file file, @blame_ast_node node) {
@@ -1727,7 +1719,9 @@ module Blame {
/** Holds if `node` should be discarded, because it is part of the overlay base and is in a file that was also extracted as part of the overlay database. */
overlay[discard_entity]
private predicate discardAstNode(@blame_ast_node node) {
exists(@file file | discardableAstNode(file, node) and discardFile(file))
exists(@file file, string path | files(file, path) |
discardableAstNode(file, node) and overlayChangedFiles(path)
)
}
/** A class representing `blame_entry` nodes. */
@@ -1851,10 +1845,6 @@ module JSON {
)
}
/** Holds if `file` was extracted as part of the overlay database. */
overlay[local]
private predicate discardFile(@file file) { isOverlay() and file = getNodeFile(_) }
/** Holds if `node` is in the `file` and is part of the overlay base database. */
overlay[local]
private predicate discardableAstNode(@file file, @json_ast_node node) {
@@ -1864,7 +1854,9 @@ module JSON {
/** Holds if `node` should be discarded, because it is part of the overlay base and is in a file that was also extracted as part of the overlay database. */
overlay[discard_entity]
private predicate discardAstNode(@json_ast_node node) {
exists(@file file | discardableAstNode(file, node) and discardFile(file))
exists(@file file, string path | files(file, path) |
discardableAstNode(file, node) and overlayChangedFiles(path)
)
}
class UnderscoreValue extends @json_underscore_value, AstNode { }