Skip to content

Commit

Permalink
Adding some nodes to the AST subtree that prob should be there (#1550)
Browse files Browse the repository at this point in the history
* Adding some nodes to the AST subtree that prob should be there. They should not, if thy are already part of the AST at some other place.

* Spotless

* Remove @ast from DeclarationSequences children as for now we use it only as an ephemeral construct that does not make it to persistency or a pass that uses the annotation

* Spotless
  • Loading branch information
konradweiss authored May 3, 2024
1 parent 9cf4cdc commit 11bccdc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/
package de.fraunhofer.aisec.cpg.graph.declarations

import de.fraunhofer.aisec.cpg.graph.AST
import de.fraunhofer.aisec.cpg.graph.HasInitializer
import de.fraunhofer.aisec.cpg.graph.statements.expressions.Expression

Expand All @@ -33,6 +34,5 @@ import de.fraunhofer.aisec.cpg.graph.statements.expressions.Expression
* explicit initializer value.
*/
class EnumConstantDeclaration : ValueDeclaration(), HasInitializer {

override var initializer: Expression? = null
@AST override var initializer: Expression? = null
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/
package de.fraunhofer.aisec.cpg.graph.declarations

import de.fraunhofer.aisec.cpg.graph.AST
import de.fraunhofer.aisec.cpg.graph.edge.Properties
import de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge
import de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge.Companion.propertyEqualsList
Expand All @@ -40,6 +41,7 @@ class FunctionTemplateDeclaration : TemplateDeclaration() {
* expansion pass for each instantiation of the FunctionTemplate there will be a realization
*/
@Relationship(value = "REALIZATION", direction = Relationship.Direction.OUTGOING)
@AST
private val realizationEdges: MutableList<PropertyEdge<FunctionDeclaration>> = ArrayList()

val realization: List<FunctionDeclaration> by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/
package de.fraunhofer.aisec.cpg.graph.statements.expressions

import de.fraunhofer.aisec.cpg.graph.AST
import java.util.*

/**
Expand Down Expand Up @@ -54,17 +55,17 @@ import java.util.*
class RangeExpression : Expression() {

/** The lower bound ("floor") of the range. This index is usually *inclusive*. */
var floor: Expression? = null
@AST var floor: Expression? = null

/** The upper bound ("ceiling") of the range. This index is usually *exclusive*. */
var ceiling: Expression? = null
@AST var ceiling: Expression? = null

/**
* Some languages offer a third value. The meaning depends completely on the language. For
* example, Python allows specifying a step, while Go allows to control the underlying array's
* capacity (not length).
*/
var third: Expression? = null
@AST var third: Expression? = null

/** The operator code that separates the range elements. Common cases are `:` or `...` */
var operatorCode = ":"
Expand Down

0 comments on commit 11bccdc

Please sign in to comment.