Skip to content

Commit

Permalink
remove allocateNodeProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrehm committed Feb 14, 2024
1 parent 0859f32 commit fdf72dc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,6 @@ class DomainClassesGenerator(schema: Schema) {
| override def allocateEdgeProperty(nodeKind: Int, direction: flatgraph.Edge.Direction, edgeKind: Int, size: Int): Array[?] = edgePropertyAllocators(edgeKind)(size)
| override def getNodePropertyFormalType(nodeKind: Int, propertyKind: Int): FormalQtyType.FormalType = nodePropertyDescriptors(propertyOffsetArrayIndex(nodeKind, propertyKind)).asInstanceOf[FormalQtyType.FormalType]
| override def getNodePropertyFormalQuantity(nodeKind: Int, propertyKind: Int): FormalQtyType.FormalQuantity = nodePropertyDescriptors(1 + propertyOffsetArrayIndex(nodeKind, propertyKind)).asInstanceOf[FormalQtyType.FormalQuantity]
| override def allocateNodeProperty(nodeKind: Int, propertyKind: Int, size: Int): Array[?] = nodePropertyAllocators(propertyKind)(size)
|}""".stripMargin
}
os.write(outputDir0 / "GraphSchema.scala", schemaFile)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
package io.shiftleft.codepropertygraph.generated
import flatgraph.DiffGraphBuilder
import flatgraph.help.DocSearchPackages
import flatgraph.help.Table.AvailableWidthProvider
import Language.*

object Cpg {
val defaultDocSearchPackage =
flatgraph.help.DocSearchPackages.default.withAdditionalPackage(getClass.getPackage.getName)
val defaultDocSearchPackage = DocSearchPackages.default.withAdditionalPackage(getClass.getPackage.getName)

@scala.annotation.implicitNotFound("""If you're using flatgraph purely without a schema and associated generated domain classes, you can
|start with `given DocSearchPackages = DocSearchPackages.default`.
|If you have generated domain classes, use `given DocSearchPackages = MyDomain.defaultDocSearchPackage`.
|If you have additional custom extension steps that specify help texts via @Doc annotations, use `given DocSearchPackages = MyDomain.defaultDocSearchPackage.withAdditionalPackage("my.custom.package)"`
|""".stripMargin)
def help(implicit searchPackageNames: flatgraph.help.DocSearchPackages) =
def help(implicit searchPackageNames: DocSearchPackages, availableWidthProvider: AvailableWidthProvider) =
flatgraph.help.TraversalHelp(searchPackageNames).forTraversalSources(verbose = false)

@scala.annotation.implicitNotFound("""If you're using flatgraph purely without a schema and associated generated domain classes, you can
|start with `given DocSearchPackages = DocSearchPackages.default`.
|If you have generated domain classes, use `given DocSearchPackages = MyDomain.defaultDocSearchPackage`.
|If you have additional custom extension steps that specify help texts via @Doc annotations, use `given DocSearchPackages = MyDomain.defaultDocSearchPackage.withAdditionalPackage("my.custom.package)"`
|""".stripMargin)
def helpVerbose(implicit searchPackageNames: flatgraph.help.DocSearchPackages) =
def helpVerbose(implicit searchPackageNames: DocSearchPackages, availableWidthProvider: AvailableWidthProvider) =
flatgraph.help.TraversalHelp(searchPackageNames).forTraversalSources(verbose = true)

def empty: Cpg = new Cpg(new flatgraph.Graph(GraphSchema))
Expand All @@ -39,10 +40,10 @@ object Cpg {
class Cpg(private val _graph: flatgraph.Graph = new flatgraph.Graph(GraphSchema)) extends AutoCloseable {
def graph: flatgraph.Graph = _graph

def help(implicit searchPackageNames: flatgraph.help.DocSearchPackages) =
Cpg.help(searchPackageNames)
def helpVerbose(implicit searchPackageNames: flatgraph.help.DocSearchPackages) =
Cpg.helpVerbose(searchPackageNames)
def help(implicit searchPackageNames: DocSearchPackages, availableWidthProvider: AvailableWidthProvider) =
Cpg.help
def helpVerbose(implicit searchPackageNames: DocSearchPackages, availableWidthProvider: AvailableWidthProvider) =
Cpg.helpVerbose

override def close(): Unit =
_graph.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5532,6 +5532,4 @@ object GraphSchema extends flatgraph.Schema {
override def getNodePropertyFormalQuantity(nodeKind: Int, propertyKind: Int): FormalQtyType.FormalQuantity =
nodePropertyDescriptors(1 + propertyOffsetArrayIndex(nodeKind, propertyKind))
.asInstanceOf[FormalQtyType.FormalQuantity]
override def allocateNodeProperty(nodeKind: Int, propertyKind: Int, size: Int): Array[?] =
nodePropertyAllocators(propertyKind)(size)
}

0 comments on commit fdf72dc

Please sign in to comment.