Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiDreyer committed Mar 20, 2024
1 parent c2b4863 commit a8d2a2a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ trait AstForFunctionsCreator(implicit withSchemaValidation: ValidationMode) { th
val fullName = computeMethodFullName(node.methodName)
scope.pushNewScope(MethodScope(fullName, procParamGen.fresh))

val (astParentType, astParentFullName, thisParamName, addEdge) = targetNode match {
val (astParentType, astParentFullName, thisParamCode, addEdge) = targetNode match {
case _: SelfIdentifier =>
(scope.surroundingAstLabel, scope.surroundingScopeFullName, Defines.This, false)
case _: SimpleIdentifier =>
Expand Down Expand Up @@ -297,8 +297,7 @@ trait AstForFunctionsCreator(implicit withSchemaValidation: ValidationMode) { th

val thisParameterAst = Ast(
newThisParameterNode(
name = thisParamName,
code = thisParamName,
code = thisParamCode,
typeFullName = astParentFullName.getOrElse(Defines.Any),
line = method.lineNumber,
column = method.columnNumber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ class MethodTests extends RubyCode2CpgFixture {
case bar :: baz :: Nil =>
inside(bar.parameter.l) {
case thisParam :: xParam :: Nil =>
thisParam.name shouldBe "F"
thisParam.name shouldBe "this"
thisParam.code shouldBe "F"
thisParam.typeFullName shouldBe "Test0.rb:<global>::program.F"

xParam.name shouldBe "x"
Expand All @@ -285,10 +286,12 @@ class MethodTests extends RubyCode2CpgFixture {

inside(baz.parameter.l) {
case thisParam :: xParam :: Nil =>
thisParam.name shouldBe "F"
thisParam.name shouldBe "this"
thisParam.code shouldBe "F"
thisParam.typeFullName shouldBe "Test0.rb:<global>::program.F"

xParam.name shouldBe "x"
xParam.code shouldBe "x"
case xs => fail(s"Expected two parameters, got ${xs.name.mkString(", ")}")
}
case xs => fail(s"Expected bar and baz to exist under F, instead got ${xs.code.mkString(", ")}")
Expand Down

0 comments on commit a8d2a2a

Please sign in to comment.