From 1e094542b167ce19f6d268b2f6dcabbc87e70dc3 Mon Sep 17 00:00:00 2001 From: Maximilian Kaul Date: Thu, 30 Nov 2023 19:33:40 +0100 Subject: [PATCH] Cleanup NodeBuilder (#1380) --- .../aisec/cpg/frontends/python/StatementHandler.kt | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cpg-language-python/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/python/StatementHandler.kt b/cpg-language-python/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/python/StatementHandler.kt index e0dbda9bc05..b871376e905 100644 --- a/cpg-language-python/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/python/StatementHandler.kt +++ b/cpg-language-python/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/python/StatementHandler.kt @@ -385,12 +385,8 @@ class StatementHandler(frontend: PythonLanguageFrontend) : return annotations } - private fun makeBlock( - stmts: List, - code: String? = null, - rawNode: Python.AST? = null - ): Block { - val result = newBlock(code, rawNode) + private fun makeBlock(stmts: List, rawNode: Python.AST? = null): Block { + val result = newBlock(rawNode = rawNode) for (stmt in stmts) { result.addStatement(handle(stmt)) } @@ -411,7 +407,7 @@ class StatementHandler(frontend: PythonLanguageFrontend) : * @return The wrapped [decl] */ private fun wrapDeclarationToStatement(decl: Declaration): DeclarationStatement { - val declStmt = newDeclarationStatement(code = decl.code, rawNode = null) // TODO: rawNode + val declStmt = newDeclarationStatement().codeAndLocationFrom(decl) declStmt.addDeclaration(decl) return declStmt }