Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate property defaults #103

Merged
merged 1 commit into from
Nov 14, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,13 @@ class DomainClassesGenerator(schema: Schema) {
}
.mkString("\n")

val propertyDefaults = nodeType.properties
.collect {
case p if p.hasDefault =>
s"""val ${p.className} = ${Helpers.defaultValueImpl(p.default.get)}"""
}
.mkString("\n")

val newNode =
s"""object New${nodeType.className}{def apply(): New${nodeType.className} = new New${nodeType.className}}
|class New${nodeType.className} extends NewNode(${nodeKindByNodeType(nodeType)}.toShort) with ${nodeType.className}Base {
Expand Down Expand Up @@ -422,6 +429,9 @@ class DomainClassesGenerator(schema: Schema) {
| object PropertyKinds {
| $propertyKinds
| }
| object PropertyDefaults {
| $propertyDefaults
| }
|}
|
|$storedNode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ object Annotation {
val Name = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.NAME
val Order = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.ORDER
}
object PropertyDefaults {
val ArgumentIndex = -1: Int
val Code = "<empty>"
val FullName = "<empty>"
val Name = "<empty>"
val Order = -1: Int
}
}

class Annotation(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ object AnnotationLiteral {
val Name = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.NAME
val Order = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.ORDER
}
object PropertyDefaults {
val ArgumentIndex = -1: Int
val Code = "<empty>"
val Name = "<empty>"
val Order = -1: Int
}
}

class AnnotationLiteral(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ object AnnotationParameter {
val LineNumber = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.LINE_NUMBER
val Order = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.ORDER
}
object PropertyDefaults {
val Code = "<empty>"
val Order = -1: Int
}
}

class AnnotationParameter(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ object AnnotationParameterAssign {
val LineNumber = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.LINE_NUMBER
val Order = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.ORDER
}
object PropertyDefaults {
val Code = "<empty>"
val Order = -1: Int
}
}

class AnnotationParameterAssign(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ object ArrayInitializer {
val LineNumber = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.LINE_NUMBER
val Order = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.ORDER
}
object PropertyDefaults {
val ArgumentIndex = -1: Int
val Code = "<empty>"
val Order = -1: Int
}
}

class ArrayInitializer(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ object Binding {
val Name = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.NAME
val Signature = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.SIGNATURE
}
object PropertyDefaults {
val MethodFullName = "<empty>"
val Name = "<empty>"
val Signature = ""
}
}

class Binding(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ object Block {
val PossibleTypes = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.POSSIBLE_TYPES
val TypeFullName = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.TYPE_FULL_NAME
}
object PropertyDefaults {
val ArgumentIndex = -1: Int
val Code = "<empty>"
val Order = -1: Int
val TypeFullName = "<empty>"
}
}

class Block(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ object Call {
val Signature = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.SIGNATURE
val TypeFullName = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.TYPE_FULL_NAME
}
object PropertyDefaults {
val ArgumentIndex = -1: Int
val Code = "<empty>"
val DispatchType = "<empty>"
val MethodFullName = "<empty>"
val Name = "<empty>"
val Order = -1: Int
val Signature = ""
val TypeFullName = "<empty>"
}
}

class Call(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ object ClosureBinding {
val ClosureOriginalName = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.CLOSURE_ORIGINAL_NAME
val EvaluationStrategy = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.EVALUATION_STRATEGY
}
object PropertyDefaults {
val EvaluationStrategy = "<empty>"
}
}

class ClosureBinding(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ object Comment {
val LineNumber = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.LINE_NUMBER
val Order = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.ORDER
}
object PropertyDefaults {
val Code = "<empty>"
val Filename = "<empty>"
val Order = -1: Int
}
}

class Comment(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ object ConfigFile {
val Content = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.CONTENT
val Name = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.NAME
}
object PropertyDefaults {
val Content = "<empty>"
val Name = "<empty>"
}
}

class ConfigFile(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ object ControlStructure {
val Order = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.ORDER
val ParserTypeName = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.PARSER_TYPE_NAME
}
object PropertyDefaults {
val ArgumentIndex = -1: Int
val Code = "<empty>"
val ControlStructureType = "<empty>"
val Order = -1: Int
val ParserTypeName = "<empty>"
}
}

class ControlStructure(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ object Dependency {
val Name = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.NAME
val Version = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.VERSION
}
object PropertyDefaults {
val Name = "<empty>"
val Version = "<empty>"
}
}

class Dependency(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ object FieldIdentifier {
val LineNumber = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.LINE_NUMBER
val Order = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.ORDER
}
object PropertyDefaults {
val ArgumentIndex = -1: Int
val CanonicalName = "<empty>"
val Code = "<empty>"
val Order = -1: Int
}
}

class FieldIdentifier(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ object File {
val Name = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.NAME
val Order = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.ORDER
}
object PropertyDefaults {
val Code = "<empty>"
val Name = "<empty>"
val Order = -1: Int
}
}

class File(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ trait FindingBase extends AbstractNode with StaticType[FindingEMT] {

object Finding {
val Label = "FINDING"
object PropertyKinds {}
object PropertyKinds {}
object PropertyDefaults {}
}

class Finding(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ object Identifier {
val PossibleTypes = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.POSSIBLE_TYPES
val TypeFullName = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.TYPE_FULL_NAME
}
object PropertyDefaults {
val ArgumentIndex = -1: Int
val Code = "<empty>"
val Name = "<empty>"
val Order = -1: Int
val TypeFullName = "<empty>"
}
}

class Identifier(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ object Import {
val LineNumber = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.LINE_NUMBER
val Order = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.ORDER
}
object PropertyDefaults {
val Code = "<empty>"
val Order = -1: Int
}
}

class Import(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ object JumpLabel {
val Order = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.ORDER
val ParserTypeName = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.PARSER_TYPE_NAME
}
object PropertyDefaults {
val Code = "<empty>"
val Name = "<empty>"
val Order = -1: Int
val ParserTypeName = "<empty>"
}
}

class JumpLabel(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ object JumpTarget {
val Order = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.ORDER
val ParserTypeName = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.PARSER_TYPE_NAME
}
object PropertyDefaults {
val ArgumentIndex = -1: Int
val Code = "<empty>"
val Name = "<empty>"
val Order = -1: Int
val ParserTypeName = "<empty>"
}
}

class JumpTarget(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ object KeyValuePair {
val Key = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.KEY
val Value = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.VALUE
}
object PropertyDefaults {
val Key = "<empty>"
val Value = ""
}
}

class KeyValuePair(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ object Literal {
val PossibleTypes = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.POSSIBLE_TYPES
val TypeFullName = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.TYPE_FULL_NAME
}
object PropertyDefaults {
val ArgumentIndex = -1: Int
val Code = "<empty>"
val Order = -1: Int
val TypeFullName = "<empty>"
}
}

class Literal(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ object Local {
val PossibleTypes = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.POSSIBLE_TYPES
val TypeFullName = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.TYPE_FULL_NAME
}
object PropertyDefaults {
val Code = "<empty>"
val Name = "<empty>"
val Order = -1: Int
val TypeFullName = "<empty>"
}
}

class Local(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ object Location {
val PackageName = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.PACKAGE_NAME
val Symbol = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.SYMBOL
}
object PropertyDefaults {
val ClassName = "<empty>"
val ClassShortName = "<empty>"
val Filename = "<empty>"
val MethodFullName = "<empty>"
val MethodShortName = "<empty>"
val NodeLabel = "<empty>"
val PackageName = "<empty>"
val Symbol = "<empty>"
}
}

class Location(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ object Member {
val PossibleTypes = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.POSSIBLE_TYPES
val TypeFullName = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.TYPE_FULL_NAME
}
object PropertyDefaults {
val Code = "<empty>"
val Name = "<empty>"
val Order = -1: Int
val TypeFullName = "<empty>"
}
}

class Member(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ object MetaData {
val Root = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.ROOT
val Version = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.VERSION
}
object PropertyDefaults {
val Language = "<empty>"
val Root = "<empty>"
val Version = "<empty>"
}
}

class MetaData(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ object Method {
val Order = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.ORDER
val Signature = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.SIGNATURE
}
object PropertyDefaults {
val AstParentFullName = "<empty>"
val AstParentType = "<empty>"
val Code = "<empty>"
val Filename = "<empty>"
val FullName = "<empty>"
val IsExternal = false
val Name = "<empty>"
val Order = -1: Int
val Signature = ""
}
}

class Method(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ object MethodParameterIn {
val PossibleTypes = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.POSSIBLE_TYPES
val TypeFullName = io.shiftleft.codepropertygraph.generated.v2.PropertyKinds.TYPE_FULL_NAME
}
object PropertyDefaults {
val Code = "<empty>"
val EvaluationStrategy = "<empty>"
val Index = -1: Int
val IsVariadic = false
val Name = "<empty>"
val Order = -1: Int
val TypeFullName = "<empty>"
}
}

class MethodParameterIn(graph_4762: odb2.Graph, seq_4762: Int)
Expand Down
Loading
Loading