move the consistency predicates where they should be

This commit is contained in:
Erik Krogh Kristensen
2022-06-16 09:13:09 +02:00
parent 4be969ca3b
commit 14b5f8410f
2 changed files with 10 additions and 9 deletions

View File

@@ -311,4 +311,8 @@ module ModConsistency {
c > 1 and
resolveModuleExpr(me, m)
}
query predicate noName(Module mod) { not exists(mod.getName()) }
query predicate nonUniqueName(Module mod) { count(mod.getName()) >= 2 }
}

View File

@@ -31,7 +31,7 @@ where
TypeConsistency::multiplePrimitivesExpr(node, _, _) and
msg = "TypeConsistency::multiplePrimitivesExpr"
or
AstConsistency::nonTotalGetParent(node) and msg = "AstConsistency::nonTotalGetParent"
AstConsistency::nonTotalGetParent(node) and msg = "AstConsistency::nonTotalGetParent" // TODO: unique parent
or
TypeConsistency::noResolve(node) and msg = "TypeConsistency::noResolve"
or
@@ -39,15 +39,12 @@ where
or
ModConsistency::noResolveModuleExpr(node) and msg = "ModConsistency::noResolveModuleExpr"
or
ModConsistency::noName(node) and msg = "ModConsistency::noName"
or
ModConsistency::nonUniqueName(node) and msg = "ModConsistency::nonUniqueName"
or
VarConsistency::noFieldDef(node) and msg = "VarConsistency::noFieldDef"
or
VarConsistency::noVarDef(node) and msg = "VarConsistency::noVarDef"
or
node instanceof ModuleExpr and
not exists(node.(ModuleExpr).getName()) and
msg = "exists(ModuleExpr::getName)"
or
node instanceof ModuleExpr and
count(node.(ModuleExpr).getName()) >= 2 and
msg = "unique(ModuleExpr::getName)"
select node, msg
// TODO: vardef consistency.