From 467013f2063e388f68807c2fd68d85f13fb9428a Mon Sep 17 00:00:00 2001 From: Christian Banse Date: Mon, 7 Oct 2024 16:15:44 +0200 Subject: [PATCH] `implicit()` only triggers code/location update now if its not empty (#1784) 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 cf7e12e01e..ffa70363df 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