From f08aa3e10169b7dbdb1ee27d8840d10b787c40ba Mon Sep 17 00:00:00 2001 From: Christian Banse Date: Mon, 7 Oct 2024 15:42:13 +0200 Subject: [PATCH] `implicit()` only triggers code/location update now if its not empty Otherwise, we override the code/location again. --- .../kotlin/de/fraunhofer/aisec/cpg/graph/NodeBuilder.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/NodeBuilder.kt b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/NodeBuilder.kt index cf7e12e01ee..ffa70363dfe 100644 --- a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/NodeBuilder.kt +++ b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/NodeBuilder.kt @@ -256,8 +256,12 @@ interface RawNodeTypeProvider : MetadataProvider * This also sets [Node.isImplicit] to true. */ fun T.implicit(code: String? = null, location: PhysicalLocation? = null): T { - this.code = code - this.location = location + if (code != null) { + this.code = code + } + if (location != null) { + this.location = location + } this.isImplicit = true return this