-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change operator extensions to use adhoc subtyping (#2750)
- Loading branch information
Showing
15 changed files
with
66 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
semanticcpg/src/main/scala/io/shiftleft/semanticcpg/language/modulevariable/OpNodes.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
package io.shiftleft.semanticcpg.language.modulevariable | ||
|
||
import io.shiftleft.codepropertygraph.generated.nodes.{Block, Local, Member} | ||
import io.shiftleft.codepropertygraph.generated.nodes.{Block, Local, Member, StaticType} | ||
|
||
trait ModuleVariableT | ||
object OpNodes { | ||
|
||
/** Represents a module-level global variable. This kind of node behaves like both a local variable and a field access | ||
* and is common in languages such as Python/JavaScript. | ||
*/ | ||
class ModuleVariable(node: Local) extends Local(node.graph(), node.id) | ||
|
||
type ModuleVariable = Local with StaticType[ModuleVariableT] | ||
|
||
} |
8 changes: 4 additions & 4 deletions
8
.../main/scala/io/shiftleft/semanticcpg/language/operatorextension/AssignmentTraversal.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
package io.shiftleft.semanticcpg.language.operatorextension | ||
|
||
import io.shiftleft.codepropertygraph.generated.nodes.Expression | ||
import io.shiftleft.codepropertygraph.generated.nodes | ||
import io.shiftleft.semanticcpg.language.* | ||
import overflowdb.traversal.help | ||
import overflowdb.traversal.help.Doc | ||
|
||
@help.Traversal(elementType = classOf[OpNodes.Assignment]) | ||
@help.Traversal(elementType = classOf[nodes.Call]) | ||
class AssignmentTraversal(val traversal: Iterator[OpNodes.Assignment]) extends AnyVal { | ||
|
||
@Doc(info = "Left-hand sides of assignments") | ||
def target: Iterator[Expression] = traversal.map(_.target) | ||
def target: Iterator[nodes.Expression] = traversal.map(_.target) | ||
|
||
@Doc(info = "Right-hand sides of assignments") | ||
def source: Iterator[Expression] = traversal.map(_.source) | ||
def source: Iterator[nodes.Expression] = traversal.map(_.source) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.