Remove empty annotations node from PrintAST

This commit is contained in:
Tamas Vajk
2022-04-12 16:04:29 +02:00
committed by Chris Smowton
parent 3b09cb2224
commit b5ae43a887
2 changed files with 6 additions and 5 deletions

View File

@@ -120,7 +120,12 @@ private newtype TPrintAstNode =
shouldPrint(lvde, _) and lvde.getParent() instanceof SingleLocalVarDeclParent
} or
TAnnotationsNode(Annotatable ann) {
shouldPrint(ann, _) and ann.hasDeclaredAnnotation() and not partOfAnnotation(ann)
shouldPrint(ann, _) and
ann.hasDeclaredAnnotation() and
not partOfAnnotation(ann) and
// The Kotlin compiler might add annotations that are only present in byte code, although the annotatable element is
// present in source code.
exists(Annotation a | a.getAnnotatedElement() = ann and shouldPrint(a, _))
} or
TParametersNode(Callable c) { shouldPrint(c, _) and not c.hasNoParameters() } or
TBaseTypesNode(ClassOrInterface ty) { shouldPrint(ty, _) } or