From c01167d2665fd3c5bbb1e3b6398a4a274868689e Mon Sep 17 00:00:00 2001 From: Michael Pollmeier Date: Thu, 16 Feb 2023 11:49:09 +0100 Subject: [PATCH] rip custom productElementLabel - use standard productElementName instead 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... --- .../src/main/scala/overflowdb/codegen/CodeGen.scala | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/codegen/src/main/scala/overflowdb/codegen/CodeGen.scala b/codegen/src/main/scala/overflowdb/codegen/CodeGen.scala index 7a93e613..458a60a3 100644 --- a/codegen/src/main/scala/overflowdb/codegen/CodeGen.scala +++ b/codegen/src/main/scala/overflowdb/codegen/CodeGen.scala @@ -398,9 +398,6 @@ class CodeGen(schema: Schema) { | * since this is a StoredNode, this is always set */ | def underlying: Node = this | - | /** labels of product elements, used e.g. for pretty-printing */ - | def productElementLabel(n: Int): String - | | /* all properties plus label and id */ | def toMap: Map[String, Any] = { | val map = propertiesMap() @@ -889,7 +886,7 @@ class CodeGen(schema: Schema) { forId +: (forKeys ++ forContainedNodes) } - val productElementLabels = + val productElementNames = productElements.map { case ProductElement(name, _, index) => s"""case $index => "$name" """ }.mkString(lineSeparator) @@ -973,9 +970,9 @@ class CodeGen(schema: Schema) { | $className.Label | } | - | override def productElementLabel(n: Int): String = + | override def productElementName(n: Int): String = | n match { - | $productElementLabels + | $productElementNames | } | | override def productElement(n: Int): Any = @@ -1121,9 +1118,9 @@ class CodeGen(schema: Schema) { | $className.Label | } | - | override def productElementLabel(n: Int): String = + | override def productElementName(n: Int): String = | n match { - | $productElementLabels + | $productElementNames | } | | override def productElement(n: Int): Any =