Skip to content

Commit

Permalink
add "isInline" method for "CallMethods" (#5032)
Browse files Browse the repository at this point in the history
* minor changes: code format

* add "isInline" method for "CallMethods"

* add a method "isInline" for CallTraversal
  • Loading branch information
canliture authored Oct 28, 2024
1 parent b200a36 commit 9ee0a39
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ import io.shiftleft.semanticcpg.language.*
class CallMethods(val node: Call) extends AnyVal with NodeExtension with HasLocation {

def isStatic: Boolean =
node.dispatchType == "STATIC_DISPATCH"
node.dispatchType == DispatchTypes.STATIC_DISPATCH

def isDynamic: Boolean =
node.dispatchType == "DYNAMIC_DISPATCH"
node.dispatchType == DispatchTypes.DYNAMIC_DISPATCH

def isInline: Boolean =
node.dispatchType == DispatchTypes.INLINED

def receiver: Iterator[Expression] =
node.receiverOut.collectAll[Expression]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class CallTraversal(val traversal: Iterator[Call]) extends AnyVal {
def isDynamic: Iterator[Call] =
traversal.filter(_.isDynamic)

/** Only dispatched calls inline */
def isInline: Iterator[Call] =
traversal.filter(_.isInline)

/** Only assignment calls
*/
def isAssignment: Iterator[Assignment] =
Expand Down

0 comments on commit 9ee0a39

Please sign in to comment.