diff --git a/build.sbt b/build.sbt index 293880a71..e9805771b 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,7 @@ name := "codepropertygraph" // parsed by project/Versions.scala, updated by updateDependencies.sh -val flatgraphVersion = "0.1.32" +val flatgraphVersion = "0.1.31" inThisBuild( List( diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/GraphSchema.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/GraphSchema.scala index b54abea53..d213f35c8 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/GraphSchema.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/GraphSchema.scala @@ -789,7 +789,7 @@ object GraphSchema extends flatgraph.Schema { nodePropertyDescriptors(1514) = FormalQtyType.StringType // METHOD_PARAMETER_IN.EVALUATION_STRATEGY nodePropertyDescriptors(1515) = FormalQtyType.QtyOne nodePropertyDescriptors(2288) = FormalQtyType.IntType // METHOD_PARAMETER_IN.INDEX - nodePropertyDescriptors(2289) = FormalQtyType.QtyOption + nodePropertyDescriptors(2289) = FormalQtyType.QtyOne nodePropertyDescriptors(2718) = FormalQtyType.BoolType // METHOD_PARAMETER_IN.IS_VARIADIC nodePropertyDescriptors(2719) = FormalQtyType.QtyOne nodePropertyDescriptors(3062) = FormalQtyType.IntType // METHOD_PARAMETER_IN.LINE_NUMBER @@ -813,7 +813,7 @@ object GraphSchema extends flatgraph.Schema { nodePropertyDescriptors(1516) = FormalQtyType.StringType // METHOD_PARAMETER_OUT.EVALUATION_STRATEGY nodePropertyDescriptors(1517) = FormalQtyType.QtyOne nodePropertyDescriptors(2290) = FormalQtyType.IntType // METHOD_PARAMETER_OUT.INDEX - nodePropertyDescriptors(2291) = FormalQtyType.QtyOption + nodePropertyDescriptors(2291) = FormalQtyType.QtyOne nodePropertyDescriptors(2720) = FormalQtyType.BoolType // METHOD_PARAMETER_OUT.IS_VARIADIC nodePropertyDescriptors(2721) = FormalQtyType.QtyOne nodePropertyDescriptors(3064) = FormalQtyType.IntType // METHOD_PARAMETER_OUT.LINE_NUMBER diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/Properties.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/Properties.scala index a8a2cf81d..0ac593be6 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/Properties.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/Properties.scala @@ -152,7 +152,7 @@ object Properties { /** Specifies an index, e.g., for a parameter or argument. Explicit parameters are numbered from 1 to N, while index 0 * is reserved for implicit self / this parameter. */ - val Index = flatgraph.OptionalPropertyKey[Int](kind = 26, name = "INDEX") + val Index = flatgraph.SinglePropertyKey[Int](kind = 26, name = "INDEX", default = -1: Int) /** The static types a TYPE_DECL inherits from. This property is matched against the FULL_NAME of TYPE nodes and thus * it is required to have at least one TYPE node for each TYPE_FULL_NAME diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/PropertyDefaults.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/PropertyDefaults.scala index 6184f99c7..56a894a24 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/PropertyDefaults.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/PropertyDefaults.scala @@ -14,6 +14,7 @@ object PropertyDefaults { val Filename = "" val FullName = "" val GenericSignature = "" + val Index = -1: Int val IsExternal = false val IsVariadic = false val Key = "" diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/accessors/Accessors.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/accessors/Accessors.scala index d42bce825..f55d5fde2 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/accessors/Accessors.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/accessors/Accessors.scala @@ -177,8 +177,13 @@ object Accessors { .getNodePropertyOption[String](node.graph, nodeKind = node.nodeKind, propertyKind = 25, seq = node.seq) } final class AccessPropertyIndex(val node: nodes.StoredNode) extends AnyVal { - def index: Option[Int] = flatgraph.Accessors - .getNodePropertyOption[Int](node.graph, nodeKind = node.nodeKind, propertyKind = 26, seq = node.seq) + def index: Int = flatgraph.Accessors.getNodePropertySingle( + node.graph, + nodeKind = node.nodeKind, + propertyKind = 26, + seq = node.seq(), + default = -1: Int + ) } final class AccessPropertyInheritsFromTypeFullName(val node: nodes.StoredNode) extends AnyVal { def inheritsFromTypeFullName: IndexedSeq[String] = flatgraph.Accessors @@ -728,7 +733,7 @@ object Accessors { case stored: nodes.StoredNode => new AccessPropertyEvaluationStrategy(stored).evaluationStrategy case newNode: nodes.NewMethodParameterIn => newNode.evaluationStrategy } - def index: Option[Int] = node match { + def index: Int = node match { case stored: nodes.StoredNode => new AccessPropertyIndex(stored).index case newNode: nodes.NewMethodParameterIn => newNode.index } @@ -750,7 +755,7 @@ object Accessors { case stored: nodes.StoredNode => new AccessPropertyEvaluationStrategy(stored).evaluationStrategy case newNode: nodes.NewMethodParameterOut => newNode.evaluationStrategy } - def index: Option[Int] = node match { + def index: Int = node match { case stored: nodes.StoredNode => new AccessPropertyIndex(stored).index case newNode: nodes.NewMethodParameterOut => newNode.index } diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterIn.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterIn.scala index f17d4109e..3b84ba223 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterIn.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterIn.scala @@ -34,7 +34,7 @@ trait MethodParameterInBase val tmpDynamicTypeHintFullName = this.dynamicTypeHintFullName; if (tmpDynamicTypeHintFullName.nonEmpty) res.put("DYNAMIC_TYPE_HINT_FULL_NAME", tmpDynamicTypeHintFullName) if (("": String) != this.evaluationStrategy) res.put("EVALUATION_STRATEGY", this.evaluationStrategy) - this.index.foreach { p => res.put("INDEX", p) } + if ((-1: Int) != this.index) res.put("INDEX", this.index) if ((false: Boolean) != this.isVariadic) res.put("IS_VARIADIC", this.isVariadic) this.lineNumber.foreach { p => res.put("LINE_NUMBER", p) } if (("": String) != this.name) res.put("NAME", this.name) @@ -72,8 +72,9 @@ object MethodParameterIn { * passed by value, that is, a copy is made, 3) `BY_SHARING` the parameter is a pointer/reference and it is shared with * the caller/callee. While a copy of the pointer is made, a copy of the object that it points to is not made. * - * ▸ Index (Int); Cardinality `ZeroOrOne` (optional); Specifies an index, e.g., for a parameter or argument. Explicit - * parameters are numbered from 1 to N, while index 0 is reserved for implicit self / this parameter. + * ▸ Index (Int); Cardinality `one` (mandatory with default value `-1`); Specifies an index, e.g., for a parameter or + * argument. Explicit parameters are numbered from 1 to N, while index 0 is reserved for implicit self / this + * parameter. * * ▸ IsVariadic (Boolean); Cardinality `one` (mandatory with default value `false`); Specifies whether a parameter is * the variadic argument handling parameter of a variadic method. Only one parameter of a method is allowed to have diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterOut.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterOut.scala index 84e8a63b5..a9be28c74 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterOut.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/MethodParameterOut.scala @@ -28,7 +28,7 @@ trait MethodParameterOutBase if (("": String) != this.code) res.put("CODE", this.code) this.columnNumber.foreach { p => res.put("COLUMN_NUMBER", p) } if (("": String) != this.evaluationStrategy) res.put("EVALUATION_STRATEGY", this.evaluationStrategy) - this.index.foreach { p => res.put("INDEX", p) } + if ((-1: Int) != this.index) res.put("INDEX", this.index) if ((false: Boolean) != this.isVariadic) res.put("IS_VARIADIC", this.isVariadic) this.lineNumber.foreach { p => res.put("LINE_NUMBER", p) } if (("": String) != this.name) res.put("NAME", this.name) @@ -58,8 +58,9 @@ object MethodParameterOut { * passed by value, that is, a copy is made, 3) `BY_SHARING` the parameter is a pointer/reference and it is shared with * the caller/callee. While a copy of the pointer is made, a copy of the object that it points to is not made. * - * ▸ Index (Int); Cardinality `ZeroOrOne` (optional); Specifies an index, e.g., for a parameter or argument. Explicit - * parameters are numbered from 1 to N, while index 0 is reserved for implicit self / this parameter. + * ▸ Index (Int); Cardinality `one` (mandatory with default value `-1`); Specifies an index, e.g., for a parameter or + * argument. Explicit parameters are numbered from 1 to N, while index 0 is reserved for implicit self / this + * parameter. * * ▸ IsVariadic (Boolean); Cardinality `one` (mandatory with default value `false`); Specifies whether a parameter is * the variadic argument handling parameter of a variadic method. Only one parameter of a method is allowed to have diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NewMethodParameterIn.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NewMethodParameterIn.scala index 8878b4695..83cfd88c0 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NewMethodParameterIn.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NewMethodParameterIn.scala @@ -2151,12 +2151,8 @@ object NewMethodParameterIn { val nn = newNodes(idx) nn match { case generated: NewMethodParameterIn => - generated.index match { - case Some(item) => - dstCast(offset) = item - offset += 1 - case _ => - } + dstCast(offset) = generated.index + offset += 1 case _ => } assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") @@ -2403,7 +2399,7 @@ class NewMethodParameterIn var columnNumber: Option[Int] = None var dynamicTypeHintFullName: IndexedSeq[String] = ArraySeq.empty var evaluationStrategy: String = "": String - var index: Option[Int] = None + var index: Int = -1: Int var isVariadic: Boolean = false: Boolean var lineNumber: Option[Int] = None var name: String = "": String @@ -2421,8 +2417,7 @@ class NewMethodParameterIn this.dynamicTypeHintFullName = value.iterator.to(ArraySeq); this } def evaluationStrategy(value: String): this.type = { this.evaluationStrategy = value; this } - def index(value: Int): this.type = { this.index = Option(value); this } - def index(value: Option[Int]): this.type = { this.index = value; this } + def index(value: Int): this.type = { this.index = value; this } def isVariadic(value: Boolean): this.type = { this.isVariadic = value; this } def lineNumber(value: Int): this.type = { this.lineNumber = Option(value); this } def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } @@ -2440,7 +2435,7 @@ class NewMethodParameterIn interface.countProperty(this, 9, columnNumber.size) interface.countProperty(this, 16, dynamicTypeHintFullName.size) interface.countProperty(this, 17, 1) - interface.countProperty(this, 26, index.size) + interface.countProperty(this, 26, 1) interface.countProperty(this, 31, 1) interface.countProperty(this, 35, lineNumber.size) interface.countProperty(this, 39, 1) diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NewMethodParameterOut.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NewMethodParameterOut.scala index 33d0cf29f..6eea4e4ad 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NewMethodParameterOut.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/nodes/NewMethodParameterOut.scala @@ -2095,12 +2095,8 @@ object NewMethodParameterOut { val nn = newNodes(idx) nn match { case generated: NewMethodParameterOut => - generated.index match { - case Some(item) => - dstCast(offset) = item - offset += 1 - case _ => - } + dstCast(offset) = generated.index + offset += 1 case _ => } assert(seq + idx == nn.storedRef.get.seq(), "internal consistency check") @@ -2318,7 +2314,7 @@ class NewMethodParameterOut var code: String = "": String var columnNumber: Option[Int] = None var evaluationStrategy: String = "": String - var index: Option[Int] = None + var index: Int = -1: Int var isVariadic: Boolean = false: Boolean var lineNumber: Option[Int] = None var name: String = "": String @@ -2330,8 +2326,7 @@ class NewMethodParameterOut def columnNumber(value: Int): this.type = { this.columnNumber = Option(value); this } def columnNumber(value: Option[Int]): this.type = { this.columnNumber = value; this } def evaluationStrategy(value: String): this.type = { this.evaluationStrategy = value; this } - def index(value: Int): this.type = { this.index = Option(value); this } - def index(value: Option[Int]): this.type = { this.index = value; this } + def index(value: Int): this.type = { this.index = value; this } def isVariadic(value: Boolean): this.type = { this.isVariadic = value; this } def lineNumber(value: Int): this.type = { this.lineNumber = Option(value); this } def lineNumber(value: Option[Int]): this.type = { this.lineNumber = value; this } @@ -2346,7 +2341,7 @@ class NewMethodParameterOut interface.countProperty(this, 8, 1) interface.countProperty(this, 9, columnNumber.size) interface.countProperty(this, 17, 1) - interface.countProperty(this, 26, index.size) + interface.countProperty(this, 26, 1) interface.countProperty(this, 31, 1) interface.countProperty(this, 35, lineNumber.size) interface.countProperty(this, 39, 1) diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalAstnodeBase.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalAstnodeBase.scala index 649c4ae60..9b0e1200e 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalAstnodeBase.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalAstnodeBase.scala @@ -84,19 +84,6 @@ final class TraversalAstnodeBase[NodeType <: nodes.AstNodeBase](val traversal: I val tmp = node.columnNumber; tmp.isDefined && tmp.get == value } - /** Traverse to nodes where the columnNumber equals the given `value`. If `value` is None, only nodes where - * columnNumber is not set are included. - */ - def columnNumber(value: Option[Int]): Iterator[NodeType] = - value match { - case Some(_val) => columnNumber(_val); case None => traversal.filter { node => node.columnNumber.isEmpty } - } - - /** Traverse to nodes where the columnNumber equals the given `value`, or no results if `value` is None. - */ - def columnNumberIfPresent(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => columnNumber(_val); case None => Iterator.empty } - /** Traverse to nodes where the columnNumber equals at least one of the given `values` */ def columnNumber(values: Int*): Iterator[NodeType] = { @@ -161,19 +148,6 @@ final class TraversalAstnodeBase[NodeType <: nodes.AstNodeBase](val traversal: I val tmp = node.lineNumber; tmp.isDefined && tmp.get == value } - /** Traverse to nodes where the lineNumber equals the given `value`. If `value` is None, only nodes where lineNumber - * is not set are included. - */ - def lineNumber(value: Option[Int]): Iterator[NodeType] = - value match { - case Some(_val) => lineNumber(_val); case None => traversal.filter { node => node.lineNumber.isEmpty } - } - - /** Traverse to nodes where the lineNumber equals the given `value`, or no results if `value` is None. - */ - def lineNumberIfPresent(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => lineNumber(_val); case None => Iterator.empty } - /** Traverse to nodes where the lineNumber equals at least one of the given `values` */ def lineNumber(values: Int*): Iterator[NodeType] = { @@ -238,17 +212,6 @@ final class TraversalAstnodeBase[NodeType <: nodes.AstNodeBase](val traversal: I val tmp = node.offset; tmp.isDefined && tmp.get == value } - /** Traverse to nodes where the offset equals the given `value`. If `value` is None, only nodes where offset is not - * set are included. - */ - def offset(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => offset(_val); case None => traversal.filter { node => node.offset.isEmpty } } - - /** Traverse to nodes where the offset equals the given `value`, or no results if `value` is None. - */ - def offsetIfPresent(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => offset(_val); case None => Iterator.empty } - /** Traverse to nodes where the offset equals at least one of the given `values` */ def offset(values: Int*): Iterator[NodeType] = { @@ -313,17 +276,6 @@ final class TraversalAstnodeBase[NodeType <: nodes.AstNodeBase](val traversal: I val tmp = node.offsetEnd; tmp.isDefined && tmp.get == value } - /** Traverse to nodes where the offsetEnd equals the given `value`. If `value` is None, only nodes where offsetEnd is - * not set are included. - */ - def offsetEnd(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => offsetEnd(_val); case None => traversal.filter { node => node.offsetEnd.isEmpty } } - - /** Traverse to nodes where the offsetEnd equals the given `value`, or no results if `value` is None. - */ - def offsetEndIfPresent(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => offsetEnd(_val); case None => Iterator.empty } - /** Traverse to nodes where the offsetEnd equals at least one of the given `values` */ def offsetEnd(values: Int*): Iterator[NodeType] = { @@ -386,11 +338,6 @@ final class TraversalAstnodeBase[NodeType <: nodes.AstNodeBase](val traversal: I def order(value: Int): Iterator[NodeType] = traversal.filter { _.order == value } - /** Traverse to nodes where the order equals the given `value`, or no results if `value` is None - */ - def order(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => order(_val); case None => Iterator.empty } - /** Traverse to nodes where the order equals at least one of the given `values` */ def order(values: Int*): Iterator[NodeType] = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalExpressionBase.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalExpressionBase.scala index f08a66d9f..a273d810d 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalExpressionBase.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalExpressionBase.scala @@ -15,11 +15,6 @@ final class TraversalExpressionBase[NodeType <: nodes.ExpressionBase](val traver def argumentIndex(value: Int): Iterator[NodeType] = traversal.filter { _.argumentIndex == value } - /** Traverse to nodes where the argumentIndex equals the given `value`, or no results if `value` is None - */ - def argumentIndex(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => argumentIndex(_val); case None => Iterator.empty } - /** Traverse to nodes where the argumentIndex equals at least one of the given `values` */ def argumentIndex(values: Int*): Iterator[NodeType] = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalJumptargetBase.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalJumptargetBase.scala index 2f3da05e2..a95d2cb8f 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalJumptargetBase.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalJumptargetBase.scala @@ -15,11 +15,6 @@ final class TraversalJumptargetBase[NodeType <: nodes.JumpTargetBase](val traver def argumentIndex(value: Int): Iterator[NodeType] = traversal.filter { _.argumentIndex == value } - /** Traverse to nodes where the argumentIndex equals the given `value`, or no results if `value` is None - */ - def argumentIndex(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => argumentIndex(_val); case None => Iterator.empty } - /** Traverse to nodes where the argumentIndex equals at least one of the given `values` */ def argumentIndex(values: Int*): Iterator[NodeType] = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalMethodBase.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalMethodBase.scala index 562c5aa48..695decf2b 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalMethodBase.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalMethodBase.scala @@ -152,19 +152,6 @@ final class TraversalMethodBase[NodeType <: nodes.MethodBase](val traversal: Ite val tmp = node.columnNumberEnd; tmp.isDefined && tmp.get == value } - /** Traverse to nodes where the columnNumberEnd equals the given `value`. If `value` is None, only nodes where - * columnNumberEnd is not set are included. - */ - def columnNumberEnd(value: Option[Int]): Iterator[NodeType] = - value match { - case Some(_val) => columnNumberEnd(_val); case None => traversal.filter { node => node.columnNumberEnd.isEmpty } - } - - /** Traverse to nodes where the columnNumberEnd equals the given `value`, or no results if `value` is None. - */ - def columnNumberEndIfPresent(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => columnNumberEnd(_val); case None => Iterator.empty } - /** Traverse to nodes where the columnNumberEnd equals at least one of the given `values` */ def columnNumberEnd(values: Int*): Iterator[NodeType] = { @@ -515,19 +502,6 @@ final class TraversalMethodBase[NodeType <: nodes.MethodBase](val traversal: Ite val tmp = node.lineNumberEnd; tmp.isDefined && tmp.get == value } - /** Traverse to nodes where the lineNumberEnd equals the given `value`. If `value` is None, only nodes where - * lineNumberEnd is not set are included. - */ - def lineNumberEnd(value: Option[Int]): Iterator[NodeType] = - value match { - case Some(_val) => lineNumberEnd(_val); case None => traversal.filter { node => node.lineNumberEnd.isEmpty } - } - - /** Traverse to nodes where the lineNumberEnd equals the given `value`, or no results if `value` is None. - */ - def lineNumberEndIfPresent(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => lineNumberEnd(_val); case None => Iterator.empty } - /** Traverse to nodes where the lineNumberEnd equals at least one of the given `values` */ def lineNumberEnd(values: Int*): Iterator[NodeType] = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalMethodparameterinBase.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalMethodparameterinBase.scala index e29153717..27deac755 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalMethodparameterinBase.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalMethodparameterinBase.scala @@ -153,78 +153,51 @@ final class TraversalMethodparameterinBase[NodeType <: nodes.MethodParameterInBa /** Traverse to index property */ def index: Iterator[Int] = - traversal.flatMap(_.index) + traversal.map(_.index) /** Traverse to nodes where the index equals the given `value` */ def index(value: Int): Iterator[NodeType] = - traversal.filter { node => - val tmp = node.index; tmp.isDefined && tmp.get == value - } - - /** Traverse to nodes where the index equals the given `value`. If `value` is None, only nodes where index is not set - * are included. - */ - def index(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => index(_val); case None => traversal.filter { node => node.index.isEmpty } } - - /** Traverse to nodes where the index equals the given `value`, or no results if `value` is None. - */ - def indexIfPresent(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => index(_val); case None => Iterator.empty } + traversal.filter { _.index == value } /** Traverse to nodes where the index equals at least one of the given `values` */ def index(values: Int*): Iterator[NodeType] = { val vset = values.toSet - traversal.filter { node => - val tmp = node.index; tmp.isDefined && vset.contains(tmp.get) - } + traversal.filter { node => vset.contains(node.index) } } /** Traverse to nodes where the index is not equal to the given `value` */ def indexNot(value: Int): Iterator[NodeType] = - traversal.filter { node => - val tmp = node.index; tmp.isEmpty || tmp.get != value - } + traversal.filter { _.index != value } - /** Traverse to nodes where the index does not equal any one of the given `values` + /** Traverse to nodes where the index is not equal to any of the given `values` */ def indexNot(values: Int*): Iterator[NodeType] = { val vset = values.toSet - traversal.filter { node => - val tmp = node.index; tmp.isEmpty || !vset.contains(tmp.get) - } + traversal.filter { node => !vset.contains(node.index) } } /** Traverse to nodes where the index is greater than the given `value` */ def indexGt(value: Int): Iterator[NodeType] = - traversal.filter { node => - val tmp = node.index; tmp.isDefined && tmp.get > value - } + traversal.filter { _.index > value } /** Traverse to nodes where the index is greater than or equal the given `value` */ def indexGte(value: Int): Iterator[NodeType] = - traversal.filter { node => - val tmp = node.index; tmp.isDefined && tmp.get >= value - } + traversal.filter { _.index >= value } /** Traverse to nodes where the index is less than the given `value` */ def indexLt(value: Int): Iterator[NodeType] = - traversal.filter { node => - val tmp = node.index; tmp.isDefined && tmp.get < value - } + traversal.filter { _.index < value } /** Traverse to nodes where the index is less than or equal the given `value` */ def indexLte(value: Int): Iterator[NodeType] = - traversal.filter { node => - val tmp = node.index; tmp.isDefined && tmp.get <= value - } + traversal.filter { _.index <= value } /** Traverse to isVariadic property */ def isVariadic: Iterator[Boolean] = diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalMethodparameteroutBase.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalMethodparameteroutBase.scala index 99a7f50f7..94ed8f7c7 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalMethodparameteroutBase.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalMethodparameteroutBase.scala @@ -76,78 +76,51 @@ final class TraversalMethodparameteroutBase[NodeType <: nodes.MethodParameterOut /** Traverse to index property */ def index: Iterator[Int] = - traversal.flatMap(_.index) + traversal.map(_.index) /** Traverse to nodes where the index equals the given `value` */ def index(value: Int): Iterator[NodeType] = - traversal.filter { node => - val tmp = node.index; tmp.isDefined && tmp.get == value - } - - /** Traverse to nodes where the index equals the given `value`. If `value` is None, only nodes where index is not set - * are included. - */ - def index(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => index(_val); case None => traversal.filter { node => node.index.isEmpty } } - - /** Traverse to nodes where the index equals the given `value`, or no results if `value` is None. - */ - def indexIfPresent(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => index(_val); case None => Iterator.empty } + traversal.filter { _.index == value } /** Traverse to nodes where the index equals at least one of the given `values` */ def index(values: Int*): Iterator[NodeType] = { val vset = values.toSet - traversal.filter { node => - val tmp = node.index; tmp.isDefined && vset.contains(tmp.get) - } + traversal.filter { node => vset.contains(node.index) } } /** Traverse to nodes where the index is not equal to the given `value` */ def indexNot(value: Int): Iterator[NodeType] = - traversal.filter { node => - val tmp = node.index; tmp.isEmpty || tmp.get != value - } + traversal.filter { _.index != value } - /** Traverse to nodes where the index does not equal any one of the given `values` + /** Traverse to nodes where the index is not equal to any of the given `values` */ def indexNot(values: Int*): Iterator[NodeType] = { val vset = values.toSet - traversal.filter { node => - val tmp = node.index; tmp.isEmpty || !vset.contains(tmp.get) - } + traversal.filter { node => !vset.contains(node.index) } } /** Traverse to nodes where the index is greater than the given `value` */ def indexGt(value: Int): Iterator[NodeType] = - traversal.filter { node => - val tmp = node.index; tmp.isDefined && tmp.get > value - } + traversal.filter { _.index > value } /** Traverse to nodes where the index is greater than or equal the given `value` */ def indexGte(value: Int): Iterator[NodeType] = - traversal.filter { node => - val tmp = node.index; tmp.isDefined && tmp.get >= value - } + traversal.filter { _.index >= value } /** Traverse to nodes where the index is less than the given `value` */ def indexLt(value: Int): Iterator[NodeType] = - traversal.filter { node => - val tmp = node.index; tmp.isDefined && tmp.get < value - } + traversal.filter { _.index < value } /** Traverse to nodes where the index is less than or equal the given `value` */ def indexLte(value: Int): Iterator[NodeType] = - traversal.filter { node => - val tmp = node.index; tmp.isDefined && tmp.get <= value - } + traversal.filter { _.index <= value } /** Traverse to isVariadic property */ def isVariadic: Iterator[Boolean] = diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyArgumentIndex.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyArgumentIndex.scala index 9e26684f8..ad03b6999 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyArgumentIndex.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyArgumentIndex.scala @@ -16,11 +16,6 @@ final class TraversalPropertyArgumentIndex[NodeType <: nodes.StoredNode & nodes. def argumentIndex(value: Int): Iterator[NodeType] = traversal.filter { _.argumentIndex == value } - /** Traverse to nodes where the argumentIndex equals the given `value`, or no results if `value` is None - */ - def argumentIndex(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => argumentIndex(_val); case None => Iterator.empty } - /** Traverse to nodes where the argumentIndex equals at least one of the given `values` */ def argumentIndex(values: Int*): Iterator[NodeType] = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyColumnNumber.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyColumnNumber.scala index 56e839f56..1515469ee 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyColumnNumber.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyColumnNumber.scala @@ -18,19 +18,6 @@ final class TraversalPropertyColumnNumber[NodeType <: nodes.StoredNode & nodes.S val tmp = node.columnNumber; tmp.isDefined && tmp.get == value } - /** Traverse to nodes where the columnNumber equals the given `value`. If `value` is None, only nodes where - * columnNumber is not set are included. - */ - def columnNumber(value: Option[Int]): Iterator[NodeType] = - value match { - case Some(_val) => columnNumber(_val); case None => traversal.filter { node => node.columnNumber.isEmpty } - } - - /** Traverse to nodes where the columnNumber equals the given `value`, or no results if `value` is None. - */ - def columnNumberIfPresent(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => columnNumber(_val); case None => Iterator.empty } - /** Traverse to nodes where the columnNumber equals at least one of the given `values` */ def columnNumber(values: Int*): Iterator[NodeType] = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyColumnNumberEnd.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyColumnNumberEnd.scala index 0657ee5bc..0b85562b9 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyColumnNumberEnd.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyColumnNumberEnd.scala @@ -19,19 +19,6 @@ final class TraversalPropertyColumnNumberEnd[ val tmp = node.columnNumberEnd; tmp.isDefined && tmp.get == value } - /** Traverse to nodes where the columnNumberEnd equals the given `value`. If `value` is None, only nodes where - * columnNumberEnd is not set are included. - */ - def columnNumberEnd(value: Option[Int]): Iterator[NodeType] = - value match { - case Some(_val) => columnNumberEnd(_val); case None => traversal.filter { node => node.columnNumberEnd.isEmpty } - } - - /** Traverse to nodes where the columnNumberEnd equals the given `value`, or no results if `value` is None. - */ - def columnNumberEndIfPresent(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => columnNumberEnd(_val); case None => Iterator.empty } - /** Traverse to nodes where the columnNumberEnd equals at least one of the given `values` */ def columnNumberEnd(values: Int*): Iterator[NodeType] = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyIndex.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyIndex.scala index 0b1615e5b..bd910af0a 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyIndex.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyIndex.scala @@ -9,77 +9,50 @@ final class TraversalPropertyIndex[NodeType <: nodes.StoredNode & nodes.StaticTy /** Traverse to index property */ def index: Iterator[Int] = - traversal.flatMap(_.index) + traversal.map(_.index) /** Traverse to nodes where the index equals the given `value` */ def index(value: Int): Iterator[NodeType] = - traversal.filter { node => - val tmp = node.index; tmp.isDefined && tmp.get == value - } - - /** Traverse to nodes where the index equals the given `value`. If `value` is None, only nodes where index is not set - * are included. - */ - def index(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => index(_val); case None => traversal.filter { node => node.index.isEmpty } } - - /** Traverse to nodes where the index equals the given `value`, or no results if `value` is None. - */ - def indexIfPresent(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => index(_val); case None => Iterator.empty } + traversal.filter { _.index == value } /** Traverse to nodes where the index equals at least one of the given `values` */ def index(values: Int*): Iterator[NodeType] = { val vset = values.toSet - traversal.filter { node => - val tmp = node.index; tmp.isDefined && vset.contains(tmp.get) - } + traversal.filter { node => vset.contains(node.index) } } /** Traverse to nodes where the index is not equal to the given `value` */ def indexNot(value: Int): Iterator[NodeType] = - traversal.filter { node => - val tmp = node.index; tmp.isEmpty || tmp.get != value - } + traversal.filter { _.index != value } - /** Traverse to nodes where the index does not equal any one of the given `values` + /** Traverse to nodes where the index is not equal to any of the given `values` */ def indexNot(values: Int*): Iterator[NodeType] = { val vset = values.toSet - traversal.filter { node => - val tmp = node.index; tmp.isEmpty || !vset.contains(tmp.get) - } + traversal.filter { node => !vset.contains(node.index) } } /** Traverse to nodes where the index is greater than the given `value` */ def indexGt(value: Int): Iterator[NodeType] = - traversal.filter { node => - val tmp = node.index; tmp.isDefined && tmp.get > value - } + traversal.filter { _.index > value } /** Traverse to nodes where the index is greater than or equal the given `value` */ def indexGte(value: Int): Iterator[NodeType] = - traversal.filter { node => - val tmp = node.index; tmp.isDefined && tmp.get >= value - } + traversal.filter { _.index >= value } /** Traverse to nodes where the index is less than the given `value` */ def indexLt(value: Int): Iterator[NodeType] = - traversal.filter { node => - val tmp = node.index; tmp.isDefined && tmp.get < value - } + traversal.filter { _.index < value } /** Traverse to nodes where the index is less than or equal the given `value` */ def indexLte(value: Int): Iterator[NodeType] = - traversal.filter { node => - val tmp = node.index; tmp.isDefined && tmp.get <= value - } + traversal.filter { _.index <= value } } diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyLineNumber.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyLineNumber.scala index 35ddc7039..8278e70cf 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyLineNumber.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyLineNumber.scala @@ -18,19 +18,6 @@ final class TraversalPropertyLineNumber[NodeType <: nodes.StoredNode & nodes.Sta val tmp = node.lineNumber; tmp.isDefined && tmp.get == value } - /** Traverse to nodes where the lineNumber equals the given `value`. If `value` is None, only nodes where lineNumber - * is not set are included. - */ - def lineNumber(value: Option[Int]): Iterator[NodeType] = - value match { - case Some(_val) => lineNumber(_val); case None => traversal.filter { node => node.lineNumber.isEmpty } - } - - /** Traverse to nodes where the lineNumber equals the given `value`, or no results if `value` is None. - */ - def lineNumberIfPresent(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => lineNumber(_val); case None => Iterator.empty } - /** Traverse to nodes where the lineNumber equals at least one of the given `values` */ def lineNumber(values: Int*): Iterator[NodeType] = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyLineNumberEnd.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyLineNumberEnd.scala index 2b75d18e6..5fc5533b6 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyLineNumberEnd.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyLineNumberEnd.scala @@ -18,19 +18,6 @@ final class TraversalPropertyLineNumberEnd[NodeType <: nodes.StoredNode & nodes. val tmp = node.lineNumberEnd; tmp.isDefined && tmp.get == value } - /** Traverse to nodes where the lineNumberEnd equals the given `value`. If `value` is None, only nodes where - * lineNumberEnd is not set are included. - */ - def lineNumberEnd(value: Option[Int]): Iterator[NodeType] = - value match { - case Some(_val) => lineNumberEnd(_val); case None => traversal.filter { node => node.lineNumberEnd.isEmpty } - } - - /** Traverse to nodes where the lineNumberEnd equals the given `value`, or no results if `value` is None. - */ - def lineNumberEndIfPresent(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => lineNumberEnd(_val); case None => Iterator.empty } - /** Traverse to nodes where the lineNumberEnd equals at least one of the given `values` */ def lineNumberEnd(values: Int*): Iterator[NodeType] = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyOffset.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyOffset.scala index a8a30d5c7..2f6097027 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyOffset.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyOffset.scala @@ -18,17 +18,6 @@ final class TraversalPropertyOffset[NodeType <: nodes.StoredNode & nodes.StaticT val tmp = node.offset; tmp.isDefined && tmp.get == value } - /** Traverse to nodes where the offset equals the given `value`. If `value` is None, only nodes where offset is not - * set are included. - */ - def offset(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => offset(_val); case None => traversal.filter { node => node.offset.isEmpty } } - - /** Traverse to nodes where the offset equals the given `value`, or no results if `value` is None. - */ - def offsetIfPresent(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => offset(_val); case None => Iterator.empty } - /** Traverse to nodes where the offset equals at least one of the given `values` */ def offset(values: Int*): Iterator[NodeType] = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyOffsetEnd.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyOffsetEnd.scala index ef51197b3..57291c7d1 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyOffsetEnd.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyOffsetEnd.scala @@ -18,17 +18,6 @@ final class TraversalPropertyOffsetEnd[NodeType <: nodes.StoredNode & nodes.Stat val tmp = node.offsetEnd; tmp.isDefined && tmp.get == value } - /** Traverse to nodes where the offsetEnd equals the given `value`. If `value` is None, only nodes where offsetEnd is - * not set are included. - */ - def offsetEnd(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => offsetEnd(_val); case None => traversal.filter { node => node.offsetEnd.isEmpty } } - - /** Traverse to nodes where the offsetEnd equals the given `value`, or no results if `value` is None. - */ - def offsetEndIfPresent(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => offsetEnd(_val); case None => Iterator.empty } - /** Traverse to nodes where the offsetEnd equals at least one of the given `values` */ def offsetEnd(values: Int*): Iterator[NodeType] = { diff --git a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyOrder.scala b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyOrder.scala index 6a8737f83..e0305796f 100644 --- a/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyOrder.scala +++ b/domainClasses/src/main/generated/io/shiftleft/codepropertygraph/generated/traversals/TraversalPropertyOrder.scala @@ -16,11 +16,6 @@ final class TraversalPropertyOrder[NodeType <: nodes.StoredNode & nodes.StaticTy def order(value: Int): Iterator[NodeType] = traversal.filter { _.order == value } - /** Traverse to nodes where the order equals the given `value`, or no results if `value` is None - */ - def order(value: Option[Int]): Iterator[NodeType] = - value match { case Some(_val) => order(_val); case None => Iterator.empty } - /** Traverse to nodes where the order equals at least one of the given `values` */ def order(values: Int*): Iterator[NodeType] = { diff --git a/schema/src/main/scala/io/shiftleft/codepropertygraph/schema/Base.scala b/schema/src/main/scala/io/shiftleft/codepropertygraph/schema/Base.scala index ee3cbb0ef..d2ea1fddf 100644 --- a/schema/src/main/scala/io/shiftleft/codepropertygraph/schema/Base.scala +++ b/schema/src/main/scala/io/shiftleft/codepropertygraph/schema/Base.scala @@ -73,6 +73,7 @@ object Base extends SchemaBase { | self / this parameter. |""".stripMargin ) + .mandatory(PropertyDefaults.Int) .protoId(ProtoIds.Index) val name = builder