Skip to content
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

Cleanup of sample scripts and operator extension #480

Merged
merged 6 commits into from
Nov 14, 2019
Merged

Conversation

fabsx00
Copy link
Contributor

@fabsx00 fabsx00 commented Nov 14, 2019

  • After playing with this for a bit, I decided to not "extend" call nodes via operator nodes for now. Meanwhile, @mpollmeier has fixed the ODB bug, which lead to us using implicit conversions for this purpose.
  • Cleaned up the remainder of the operator classes I brought in yesterday to work like ArrayAccess
  • Adapted sample queries

import gremlin.scala.GremlinScala
import io.shiftleft.semanticcpg.language.Steps

class ArithmeticTrav(raw: GremlinScala[nodes.Arithmetic]) extends Steps[nodes.Arithmetic](raw) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this class be deleted?


import io.shiftleft.codepropertygraph.generated.nodes

class Arithmetic(val call: nodes.Call) extends AnyRef {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto - is there any reason to have an empty class? The extends AnyRef can also be dropped as it is implicit.

@@ -4,12 +4,10 @@ import io.shiftleft.codepropertygraph.generated.nodes
import io.shiftleft.semanticcpg.language._
import io.shiftleft.semanticcpg.language.types.expressions.Identifier

class ArrayAccess(node: nodes.Call) {
class ArrayAccess(val call: nodes.Call) extends AnyRef {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto w/ the AnyRef. There are a few others below, too.

implicit def arrayAccessToCall(
node: operatorextension.nodes.ArrayAccess): io.shiftleft.semanticcpg.language.nodemethods.CallMethods =
node.call
implicit def toOpsAstNodeTrav2[NodeType <: nodes.AstNode](
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth dropping the 2 in the name, I'm not too sure what it means here!

@fabsx00
Copy link
Contributor Author

fabsx00 commented Nov 14, 2019

Concerning empty classes: they are not entirely empty, they do have that call field. The reason I introduce them now already is that it is inconsistent to have some of the classes wrap a type from nodes, while others bring in their own node. Also, methods in these classes will follow very soon. I can hold off on merging this one though until these methods are present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants