Skip to content

Commit

Permalink
codegen: newnodes: propertiesMap should not contain default value pro…
Browse files Browse the repository at this point in the history
…perties (#174)

this is now the same behaviour as for OverflowDB
  • Loading branch information
mpollmeier authored Apr 17, 2024
1 parent a74eeb3 commit 370b541
Show file tree
Hide file tree
Showing 43 changed files with 174 additions and 174 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ class DomainClassesGenerator(schema: Schema) {
case one: Cardinality.One[?] =>
newNodeProps.append(s"var $pname: $ptyp = ${unpackDefault(p.valueType, one.default)}")
newNodeFluent.append(s"def $pname(value: $ptyp): this.type = {this.$pname = value; this }")
propDictItems.append(s"""res.put("${p.name}", this.$pname )""")
propDictItems.append(s"""if ((${unpackDefault(p.valueType, one.default)}) != this.$pname) res.put("${p.name}", this.$pname )""")
flattenItems.append(s"""interface.insertProperty(this, ${propertyKindByProperty(p)}, Iterator(this.$pname))""")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ trait AnnotationBase extends AbstractNode with ExpressionBase with StaticType[An
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("ARGUMENT_INDEX", this.argumentIndex)
if ((-1: Int) != this.argumentIndex) res.put("ARGUMENT_INDEX", this.argumentIndex)
this.argumentName.foreach { p => res.put("ARGUMENT_NAME", p) }
res.put("CODE", this.code)
if (("<empty>": String) != this.code) res.put("CODE", this.code)
this.columnNumber.foreach { p => res.put("COLUMN_NUMBER", p) }
res.put("FULL_NAME", this.fullName)
if (("<empty>": String) != this.fullName) res.put("FULL_NAME", this.fullName)
this.lineNumber.foreach { p => res.put("LINE_NUMBER", p) }
res.put("NAME", this.name)
res.put("ORDER", this.order)
if (("<empty>": String) != this.name) res.put("NAME", this.name)
if ((-1: Int) != this.order) res.put("ORDER", this.order)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ trait AnnotationLiteralBase extends AbstractNode with ExpressionBase with Static
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("ARGUMENT_INDEX", this.argumentIndex)
if ((-1: Int) != this.argumentIndex) res.put("ARGUMENT_INDEX", this.argumentIndex)
this.argumentName.foreach { p => res.put("ARGUMENT_NAME", p) }
res.put("CODE", this.code)
if (("<empty>": String) != this.code) res.put("CODE", this.code)
this.columnNumber.foreach { p => res.put("COLUMN_NUMBER", p) }
this.lineNumber.foreach { p => res.put("LINE_NUMBER", p) }
res.put("NAME", this.name)
res.put("ORDER", this.order)
if (("<empty>": String) != this.name) res.put("NAME", this.name)
if ((-1: Int) != this.order) res.put("ORDER", this.order)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ trait AnnotationParameterBase extends AbstractNode with AstNodeBase with StaticT
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("CODE", this.code)
if (("<empty>": String) != this.code) res.put("CODE", this.code)
this.columnNumber.foreach { p => res.put("COLUMN_NUMBER", p) }
this.lineNumber.foreach { p => res.put("LINE_NUMBER", p) }
res.put("ORDER", this.order)
if ((-1: Int) != this.order) res.put("ORDER", this.order)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ trait AnnotationParameterAssignBase
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("CODE", this.code)
if (("<empty>": String) != this.code) res.put("CODE", this.code)
this.columnNumber.foreach { p => res.put("COLUMN_NUMBER", p) }
this.lineNumber.foreach { p => res.put("LINE_NUMBER", p) }
res.put("ORDER", this.order)
if ((-1: Int) != this.order) res.put("ORDER", this.order)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ trait ArrayInitializerBase extends AbstractNode with ExpressionBase with StaticT
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("ARGUMENT_INDEX", this.argumentIndex)
if ((-1: Int) != this.argumentIndex) res.put("ARGUMENT_INDEX", this.argumentIndex)
this.argumentName.foreach { p => res.put("ARGUMENT_NAME", p) }
res.put("CODE", this.code)
if (("<empty>": String) != this.code) res.put("CODE", this.code)
this.columnNumber.foreach { p => res.put("COLUMN_NUMBER", p) }
this.lineNumber.foreach { p => res.put("LINE_NUMBER", p) }
res.put("ORDER", this.order)
if ((-1: Int) != this.order) res.put("ORDER", this.order)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ trait BindingBase extends AbstractNode with StaticType[BindingEMT] {
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("METHOD_FULL_NAME", this.methodFullName)
res.put("NAME", this.name)
res.put("SIGNATURE", this.signature)
if (("<empty>": String) != this.methodFullName) res.put("METHOD_FULL_NAME", this.methodFullName)
if (("<empty>": String) != this.name) res.put("NAME", this.name)
if (("": String) != this.signature) res.put("SIGNATURE", this.signature)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ trait BlockBase extends AbstractNode with ExpressionBase with StaticType[BlockEM
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("ARGUMENT_INDEX", this.argumentIndex)
if ((-1: Int) != this.argumentIndex) res.put("ARGUMENT_INDEX", this.argumentIndex)
this.argumentName.foreach { p => res.put("ARGUMENT_NAME", p) }
res.put("CODE", this.code)
if (("<empty>": String) != this.code) res.put("CODE", this.code)
this.columnNumber.foreach { p => res.put("COLUMN_NUMBER", p) }
val tmpDynamicTypeHintFullName = this.dynamicTypeHintFullName;
if (tmpDynamicTypeHintFullName.nonEmpty) res.put("DYNAMIC_TYPE_HINT_FULL_NAME", tmpDynamicTypeHintFullName)
this.lineNumber.foreach { p => res.put("LINE_NUMBER", p) }
res.put("ORDER", this.order)
if ((-1: Int) != this.order) res.put("ORDER", this.order)
val tmpPossibleTypes = this.possibleTypes;
if (tmpPossibleTypes.nonEmpty) res.put("POSSIBLE_TYPES", tmpPossibleTypes)
res.put("TYPE_FULL_NAME", this.typeFullName)
if (("<empty>": String) != this.typeFullName) res.put("TYPE_FULL_NAME", this.typeFullName)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ trait CallBase extends AbstractNode with CallReprBase with ExpressionBase with S
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("ARGUMENT_INDEX", this.argumentIndex)
if ((-1: Int) != this.argumentIndex) res.put("ARGUMENT_INDEX", this.argumentIndex)
this.argumentName.foreach { p => res.put("ARGUMENT_NAME", p) }
res.put("CODE", this.code)
if (("<empty>": String) != this.code) res.put("CODE", this.code)
this.columnNumber.foreach { p => res.put("COLUMN_NUMBER", p) }
res.put("DISPATCH_TYPE", this.dispatchType)
if (("<empty>": String) != this.dispatchType) res.put("DISPATCH_TYPE", this.dispatchType)
val tmpDynamicTypeHintFullName = this.dynamicTypeHintFullName;
if (tmpDynamicTypeHintFullName.nonEmpty) res.put("DYNAMIC_TYPE_HINT_FULL_NAME", tmpDynamicTypeHintFullName)
this.lineNumber.foreach { p => res.put("LINE_NUMBER", p) }
res.put("METHOD_FULL_NAME", this.methodFullName)
res.put("NAME", this.name)
res.put("ORDER", this.order)
if (("<empty>": String) != this.methodFullName) res.put("METHOD_FULL_NAME", this.methodFullName)
if (("<empty>": String) != this.name) res.put("NAME", this.name)
if ((-1: Int) != this.order) res.put("ORDER", this.order)
val tmpPossibleTypes = this.possibleTypes;
if (tmpPossibleTypes.nonEmpty) res.put("POSSIBLE_TYPES", tmpPossibleTypes)
res.put("SIGNATURE", this.signature)
res.put("TYPE_FULL_NAME", this.typeFullName)
if (("": String) != this.signature) res.put("SIGNATURE", this.signature)
if (("<empty>": String) != this.typeFullName) res.put("TYPE_FULL_NAME", this.typeFullName)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ trait ClosureBindingBase extends AbstractNode with StaticType[ClosureBindingEMT]
val res = new java.util.HashMap[String, Any]()
this.closureBindingId.foreach { p => res.put("CLOSURE_BINDING_ID", p) }
this.closureOriginalName.foreach { p => res.put("CLOSURE_ORIGINAL_NAME", p) }
res.put("EVALUATION_STRATEGY", this.evaluationStrategy)
if (("<empty>": String) != this.evaluationStrategy) res.put("EVALUATION_STRATEGY", this.evaluationStrategy)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ trait CommentBase extends AbstractNode with AstNodeBase with StaticType[CommentE
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("CODE", this.code)
if (("<empty>": String) != this.code) res.put("CODE", this.code)
this.columnNumber.foreach { p => res.put("COLUMN_NUMBER", p) }
res.put("FILENAME", this.filename)
if (("<empty>": String) != this.filename) res.put("FILENAME", this.filename)
this.lineNumber.foreach { p => res.put("LINE_NUMBER", p) }
res.put("ORDER", this.order)
if ((-1: Int) != this.order) res.put("ORDER", this.order)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ trait ConfigFileBase extends AbstractNode with StaticType[ConfigFileEMT] {
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("CONTENT", this.content)
res.put("NAME", this.name)
if (("<empty>": String) != this.content) res.put("CONTENT", this.content)
if (("<empty>": String) != this.name) res.put("NAME", this.name)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ trait ControlStructureBase extends AbstractNode with ExpressionBase with StaticT
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("ARGUMENT_INDEX", this.argumentIndex)
if ((-1: Int) != this.argumentIndex) res.put("ARGUMENT_INDEX", this.argumentIndex)
this.argumentName.foreach { p => res.put("ARGUMENT_NAME", p) }
res.put("CODE", this.code)
if (("<empty>": String) != this.code) res.put("CODE", this.code)
this.columnNumber.foreach { p => res.put("COLUMN_NUMBER", p) }
res.put("CONTROL_STRUCTURE_TYPE", this.controlStructureType)
if (("<empty>": String) != this.controlStructureType) res.put("CONTROL_STRUCTURE_TYPE", this.controlStructureType)
this.lineNumber.foreach { p => res.put("LINE_NUMBER", p) }
res.put("ORDER", this.order)
res.put("PARSER_TYPE_NAME", this.parserTypeName)
if ((-1: Int) != this.order) res.put("ORDER", this.order)
if (("<empty>": String) != this.parserTypeName) res.put("PARSER_TYPE_NAME", this.parserTypeName)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ trait DependencyBase extends AbstractNode with StaticType[DependencyEMT] {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
this.dependencyGroupId.foreach { p => res.put("DEPENDENCY_GROUP_ID", p) }
res.put("NAME", this.name)
res.put("VERSION", this.version)
if (("<empty>": String) != this.name) res.put("NAME", this.name)
if (("<empty>": String) != this.version) res.put("VERSION", this.version)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ trait FieldIdentifierBase extends AbstractNode with ExpressionBase with StaticTy
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("ARGUMENT_INDEX", this.argumentIndex)
if ((-1: Int) != this.argumentIndex) res.put("ARGUMENT_INDEX", this.argumentIndex)
this.argumentName.foreach { p => res.put("ARGUMENT_NAME", p) }
res.put("CANONICAL_NAME", this.canonicalName)
res.put("CODE", this.code)
if (("<empty>": String) != this.canonicalName) res.put("CANONICAL_NAME", this.canonicalName)
if (("<empty>": String) != this.code) res.put("CODE", this.code)
this.columnNumber.foreach { p => res.put("COLUMN_NUMBER", p) }
this.lineNumber.foreach { p => res.put("LINE_NUMBER", p) }
res.put("ORDER", this.order)
if ((-1: Int) != this.order) res.put("ORDER", this.order)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ trait FileBase extends AbstractNode with AstNodeBase with StaticType[FileEMT] {
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("CODE", this.code)
if (("<empty>": String) != this.code) res.put("CODE", this.code)
this.columnNumber.foreach { p => res.put("COLUMN_NUMBER", p) }
res.put("CONTENT", this.content)
if (("<empty>": String) != this.content) res.put("CONTENT", this.content)
this.hash.foreach { p => res.put("HASH", p) }
this.lineNumber.foreach { p => res.put("LINE_NUMBER", p) }
res.put("NAME", this.name)
res.put("ORDER", this.order)
if (("<empty>": String) != this.name) res.put("NAME", this.name)
if ((-1: Int) != this.order) res.put("ORDER", this.order)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ trait IdentifierBase extends AbstractNode with ExpressionBase with StaticType[Id
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("ARGUMENT_INDEX", this.argumentIndex)
if ((-1: Int) != this.argumentIndex) res.put("ARGUMENT_INDEX", this.argumentIndex)
this.argumentName.foreach { p => res.put("ARGUMENT_NAME", p) }
res.put("CODE", this.code)
if (("<empty>": String) != this.code) res.put("CODE", this.code)
this.columnNumber.foreach { p => res.put("COLUMN_NUMBER", p) }
val tmpDynamicTypeHintFullName = this.dynamicTypeHintFullName;
if (tmpDynamicTypeHintFullName.nonEmpty) res.put("DYNAMIC_TYPE_HINT_FULL_NAME", tmpDynamicTypeHintFullName)
this.lineNumber.foreach { p => res.put("LINE_NUMBER", p) }
res.put("NAME", this.name)
res.put("ORDER", this.order)
if (("<empty>": String) != this.name) res.put("NAME", this.name)
if ((-1: Int) != this.order) res.put("ORDER", this.order)
val tmpPossibleTypes = this.possibleTypes;
if (tmpPossibleTypes.nonEmpty) res.put("POSSIBLE_TYPES", tmpPossibleTypes)
res.put("TYPE_FULL_NAME", this.typeFullName)
if (("<empty>": String) != this.typeFullName) res.put("TYPE_FULL_NAME", this.typeFullName)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ trait ImportBase extends AbstractNode with AstNodeBase with StaticType[ImportEMT
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("CODE", this.code)
if (("<empty>": String) != this.code) res.put("CODE", this.code)
this.columnNumber.foreach { p => res.put("COLUMN_NUMBER", p) }
this.explicitAs.foreach { p => res.put("EXPLICIT_AS", p) }
this.importedAs.foreach { p => res.put("IMPORTED_AS", p) }
this.importedEntity.foreach { p => res.put("IMPORTED_ENTITY", p) }
this.isExplicit.foreach { p => res.put("IS_EXPLICIT", p) }
this.isWildcard.foreach { p => res.put("IS_WILDCARD", p) }
this.lineNumber.foreach { p => res.put("LINE_NUMBER", p) }
res.put("ORDER", this.order)
if ((-1: Int) != this.order) res.put("ORDER", this.order)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ trait JumpLabelBase extends AbstractNode with AstNodeBase with StaticType[JumpLa
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("CODE", this.code)
if (("<empty>": String) != this.code) res.put("CODE", this.code)
this.columnNumber.foreach { p => res.put("COLUMN_NUMBER", p) }
this.lineNumber.foreach { p => res.put("LINE_NUMBER", p) }
res.put("NAME", this.name)
res.put("ORDER", this.order)
res.put("PARSER_TYPE_NAME", this.parserTypeName)
if (("<empty>": String) != this.name) res.put("NAME", this.name)
if ((-1: Int) != this.order) res.put("ORDER", this.order)
if (("<empty>": String) != this.parserTypeName) res.put("PARSER_TYPE_NAME", this.parserTypeName)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ trait JumpTargetBase extends AbstractNode with CfgNodeBase with StaticType[JumpT
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("ARGUMENT_INDEX", this.argumentIndex)
res.put("CODE", this.code)
if ((-1: Int) != this.argumentIndex) res.put("ARGUMENT_INDEX", this.argumentIndex)
if (("<empty>": String) != this.code) res.put("CODE", this.code)
this.columnNumber.foreach { p => res.put("COLUMN_NUMBER", p) }
this.lineNumber.foreach { p => res.put("LINE_NUMBER", p) }
res.put("NAME", this.name)
res.put("ORDER", this.order)
res.put("PARSER_TYPE_NAME", this.parserTypeName)
if (("<empty>": String) != this.name) res.put("NAME", this.name)
if ((-1: Int) != this.order) res.put("ORDER", this.order)
if (("<empty>": String) != this.parserTypeName) res.put("PARSER_TYPE_NAME", this.parserTypeName)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ trait KeyValuePairBase extends AbstractNode with StaticType[KeyValuePairEMT] {
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("KEY", this.key)
res.put("VALUE", this.value)
if (("<empty>": String) != this.key) res.put("KEY", this.key)
if (("": String) != this.value) res.put("VALUE", this.value)
res
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ trait LiteralBase extends AbstractNode with ExpressionBase with StaticType[Liter
override def propertiesMap: java.util.Map[String, Any] = {
import io.shiftleft.codepropertygraph.generated.accessors.Lang.*
val res = new java.util.HashMap[String, Any]()
res.put("ARGUMENT_INDEX", this.argumentIndex)
if ((-1: Int) != this.argumentIndex) res.put("ARGUMENT_INDEX", this.argumentIndex)
this.argumentName.foreach { p => res.put("ARGUMENT_NAME", p) }
res.put("CODE", this.code)
if (("<empty>": String) != this.code) res.put("CODE", this.code)
this.columnNumber.foreach { p => res.put("COLUMN_NUMBER", p) }
val tmpDynamicTypeHintFullName = this.dynamicTypeHintFullName;
if (tmpDynamicTypeHintFullName.nonEmpty) res.put("DYNAMIC_TYPE_HINT_FULL_NAME", tmpDynamicTypeHintFullName)
this.lineNumber.foreach { p => res.put("LINE_NUMBER", p) }
res.put("ORDER", this.order)
if ((-1: Int) != this.order) res.put("ORDER", this.order)
val tmpPossibleTypes = this.possibleTypes;
if (tmpPossibleTypes.nonEmpty) res.put("POSSIBLE_TYPES", tmpPossibleTypes)
res.put("TYPE_FULL_NAME", this.typeFullName)
if (("<empty>": String) != this.typeFullName) res.put("TYPE_FULL_NAME", this.typeFullName)
res
}
}
Expand Down
Loading

0 comments on commit 370b541

Please sign in to comment.