Skip to content

Commit

Permalink
Moved ResolutionStartHolder from TryStatement directly to CatchClause
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto committed Oct 9, 2023
1 parent f2066a4 commit f87784b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,22 @@ package de.fraunhofer.aisec.cpg.graph.statements
import de.fraunhofer.aisec.cpg.graph.AST
import de.fraunhofer.aisec.cpg.graph.BranchingNode
import de.fraunhofer.aisec.cpg.graph.Node
import de.fraunhofer.aisec.cpg.graph.ResolutionStartHolder
import de.fraunhofer.aisec.cpg.graph.declarations.VariableDeclaration
import de.fraunhofer.aisec.cpg.graph.statements.expressions.Block
import java.util.Objects

class CatchClause : Statement(), BranchingNode {
class CatchClause : Statement(), BranchingNode, ResolutionStartHolder {
@AST var parameter: VariableDeclaration? = null

@AST var body: Block? = null

override val branchedBy: Node?
get() = parameter

override val resolutionStartNodes: List<Node>
get() = listOf(this)

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is CatchClause) return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
package de.fraunhofer.aisec.cpg.graph.statements

import de.fraunhofer.aisec.cpg.graph.AST
import de.fraunhofer.aisec.cpg.graph.Node
import de.fraunhofer.aisec.cpg.graph.ResolutionStartHolder
import de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge
import de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge.Companion.propertyEqualsList
import de.fraunhofer.aisec.cpg.graph.edge.PropertyEdgeDelegate
Expand All @@ -36,7 +34,7 @@ import java.util.*
import org.neo4j.ogm.annotation.Relationship

/** A [Statement] which represents a try/catch block, primarily used for exception handling. */
class TryStatement : Statement(), ResolutionStartHolder {
class TryStatement : Statement() {
@Relationship(value = "RESOURCES", direction = Relationship.Direction.OUTGOING)
@AST
var resourceEdges = mutableListOf<PropertyEdge<Statement>>()
Expand All @@ -52,8 +50,6 @@ class TryStatement : Statement(), ResolutionStartHolder {
var catchClauseEdges = mutableListOf<PropertyEdge<CatchClause>>()

var catchClauses by PropertyEdgeDelegate(TryStatement::catchClauseEdges)
override val resolutionStartNodes: List<Node>
get() = catchClauses

override fun equals(other: Any?): Boolean {
if (this === other) return true
Expand Down

0 comments on commit f87784b

Please sign in to comment.