From d80fb41e07a8419a20d85a569c89ba54cbc87a57 Mon Sep 17 00:00:00 2001 From: David Baker Effendi Date: Fri, 6 Sep 2024 14:12:41 +0200 Subject: [PATCH] [ruby] Fix Duplicate `self` References (#4902) --- .../joern/rubysrc2cpg/astcreation/AstForFunctionsCreator.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/joern-cli/frontends/rubysrc2cpg/src/main/scala/io/joern/rubysrc2cpg/astcreation/AstForFunctionsCreator.scala b/joern-cli/frontends/rubysrc2cpg/src/main/scala/io/joern/rubysrc2cpg/astcreation/AstForFunctionsCreator.scala index bee3d4a4ef72..5897374ae267 100644 --- a/joern-cli/frontends/rubysrc2cpg/src/main/scala/io/joern/rubysrc2cpg/astcreation/AstForFunctionsCreator.scala +++ b/joern-cli/frontends/rubysrc2cpg/src/main/scala/io/joern/rubysrc2cpg/astcreation/AstForFunctionsCreator.scala @@ -180,7 +180,7 @@ trait AstForFunctionsCreator(implicit withSchemaValidation: ValidationMode) { th private def transformAsClosureBody(refs: List[Ast], baseStmtBlockAst: Ast) = { // Determine which locals are captured val capturedLocalNodes = baseStmtBlockAst.nodes - .collect { case x: NewIdentifier => x } + .collect { case x: NewIdentifier if x.name != Defines.Self => x } // Self identifiers are handled separately .distinctBy(_.name) .map(i => scope.lookupVariableInOuterScope(i.name)) .filter(_.nonEmpty)