Skip to content

Commit c514e90

Browse files
authored
rip custom productElementLabel - use standard productElementName instead (#204)
Not sure about the exact history, but I guess back in the days we simply didn't notice that `Product.productElementName` exists, and therefor added `StoredNode.productElementLabel` and tweaked the pretty printer in joern. This can be done much simpler...
1 parent 2a0168f commit c514e90

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

codegen/src/main/scala/overflowdb/codegen/CodeGen.scala

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,6 @@ class CodeGen(schema: Schema) {
398398
| * since this is a StoredNode, this is always set */
399399
| def underlying: Node = this
400400
|
401-
| /** labels of product elements, used e.g. for pretty-printing */
402-
| def productElementLabel(n: Int): String
403-
|
404401
| /* all properties plus label and id */
405402
| def toMap: Map[String, Any] = {
406403
| val map = propertiesMap()
@@ -889,7 +886,7 @@ class CodeGen(schema: Schema) {
889886
forId +: (forKeys ++ forContainedNodes)
890887
}
891888

892-
val productElementLabels =
889+
val productElementNames =
893890
productElements.map { case ProductElement(name, _, index) =>
894891
s"""case $index => "$name" """
895892
}.mkString(lineSeparator)
@@ -973,9 +970,9 @@ class CodeGen(schema: Schema) {
973970
| $className.Label
974971
| }
975972
|
976-
| override def productElementLabel(n: Int): String =
973+
| override def productElementName(n: Int): String =
977974
| n match {
978-
| $productElementLabels
975+
| $productElementNames
979976
| }
980977
|
981978
| override def productElement(n: Int): Any =
@@ -1121,9 +1118,9 @@ class CodeGen(schema: Schema) {
11211118
| $className.Label
11221119
| }
11231120
|
1124-
| override def productElementLabel(n: Int): String =
1121+
| override def productElementName(n: Int): String =
11251122
| n match {
1126-
| $productElementLabels
1123+
| $productElementNames
11271124
| }
11281125
|
11291126
| override def productElement(n: Int): Any =

0 commit comments

Comments
 (0)