Skip to content

Commit

Permalink
Add to EOG
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto committed Mar 2, 2023
1 parent 0d8d859 commit 8e13410
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ open class EvaluationOrderGraphPass : Pass() {
}
map[ReturnStatement::class.java] = { handleReturnStatement(it as ReturnStatement) }
map[BinaryOperator::class.java] = { handleBinaryOperator(it as BinaryOperator) }
map[AssignExpression::class.java] = { handleAssignExpression(it as AssignExpression) }
map[UnaryOperator::class.java] = { handleUnaryOperator(it as UnaryOperator) }
map[CompoundStatement::class.java] = { handleCompoundStatement(it as CompoundStatement) }
map[CompoundStatementExpression::class.java] = {
Expand Down Expand Up @@ -474,6 +475,16 @@ open class EvaluationOrderGraphPass : Pass() {
pushToEOG(node)
}

protected fun handleAssignExpression(node: AssignExpression) {
// Handle left hand side(s) first
node.lhs.forEach { createEOG(it) }

// Then the right side(s)
node.rhs.forEach { createEOG(it) }

pushToEOG(node)
}

protected fun handleCompoundStatement(node: CompoundStatement) {
// not all language handle compound statements as scoping blocks, so we need to avoid
// creating new scopes here
Expand Down
2 changes: 1 addition & 1 deletion cpg-language-go/src/test/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</Console>
</Appenders>
<Loggers>
<Logger level="DEBUG" name="de.fraunhofer.aisec.cpg"/>
<Logger level="TRACE" name="de.fraunhofer.aisec.cpg"/>
<Root level="DEBUG">
<AppenderRef ref="STDOUT"/>
</Root>
Expand Down

0 comments on commit 8e13410

Please sign in to comment.