Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ object PropertyDefaults {
val Filename = "<empty>"
val FullName = "<empty>"
val GenericSignature = "<empty>"
val Index = -1: Int
val IsExternal = false
val IsVariadic = false
val Key = "<empty>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ trait MethodParameterInBase
val tmpDynamicTypeHintFullName = this.dynamicTypeHintFullName;
if (tmpDynamicTypeHintFullName.nonEmpty) res.put("DYNAMIC_TYPE_HINT_FULL_NAME", tmpDynamicTypeHintFullName)
if (("<empty>": 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 (("<empty>": String) != this.name) res.put("NAME", this.name)
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ trait MethodParameterOutBase
if (("<empty>": String) != this.code) res.put("CODE", this.code)
this.columnNumber.foreach { p => res.put("COLUMN_NUMBER", p) }
if (("<empty>": 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 (("<empty>": String) != this.name) res.put("NAME", this.name)
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -2403,7 +2399,7 @@ class NewMethodParameterIn
var columnNumber: Option[Int] = None
var dynamicTypeHintFullName: IndexedSeq[String] = ArraySeq.empty
var evaluationStrategy: String = "<empty>": String
var index: Option[Int] = None
var index: Int = -1: Int
var isVariadic: Boolean = false: Boolean
var lineNumber: Option[Int] = None
var name: String = "<empty>": String
Expand All @@ -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 }
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -2318,7 +2314,7 @@ class NewMethodParameterOut
var code: String = "<empty>": String
var columnNumber: Option[Int] = None
var evaluationStrategy: String = "<empty>": String
var index: Option[Int] = None
var index: Int = -1: Int
var isVariadic: Boolean = false: Boolean
var lineNumber: Option[Int] = None
var name: String = "<empty>": String
Expand All @@ -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 }
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down Expand Up @@ -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] = {
Expand Down Expand Up @@ -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] = {
Expand Down Expand Up @@ -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] = {
Expand Down Expand Up @@ -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] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down Expand Up @@ -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] = {
Expand Down
Loading
Loading