-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GoSrc2Cpg : AST generation for switch case #3018
GoSrc2Cpg : AST generation for switch case #3018
Conversation
README.md
Outdated
@@ -1,5 +1,5 @@ | |||
Joern - The Bug Hunter's Workbench | |||
=== | |||
=== |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
random Js test case was failing, so this space was to retrigger checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be removed, it pollutes the diff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, removing this
@@ -100,7 +107,7 @@ trait AstForStatementsCreator { this: AstCreator => | |||
private def astForConditionExpression(condStmt: ParserNodeInfo): Ast = { | |||
condStmt.node match { | |||
case ParenExpr => astForNode(condStmt.json(ParserKeys.X)).head | |||
case _ => Ast() | |||
case _ => astsForStatement(condStmt).head |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please guarantee that astForStatement(condStmt)
is always non-empty to avoid NoSuchElementException
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, will take that precaution
README.md
Outdated
@@ -1,5 +1,5 @@ | |||
Joern - The Bug Hunter's Workbench | |||
=== | |||
=== |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be removed, it pollutes the diff
@@ -100,7 +107,7 @@ trait AstForStatementsCreator { this: AstCreator => | |||
private def astForConditionExpression(condStmt: ParserNodeInfo): Ast = { | |||
condStmt.node match { | |||
case ParenExpr => astForNode(condStmt.json(ParserKeys.X)).head | |||
case _ => Ast() | |||
case _ => astsForStatement(condStmt).head |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case _ => astsForStatement(condStmt).head | |
case _ => astsForStatement(condStmt).headOption.getOrElse(Ast()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DavidBakerEffendi Have made the suggested changes
@khemrajrathore take the latest updates from the master and lets get this merged |
@DavidBakerEffendi Can we get this merged? |
The PR covers the following
local
node in the condition of switch it throws an error