All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.joern.x2cpg.Imports.scala Maven / Gradle / Ivy

There is a newer version: 4.0.131
Show newest version
package io.joern.x2cpg

import io.shiftleft.codepropertygraph.generated.EdgeTypes
import io.shiftleft.codepropertygraph.generated.nodes.{CallBase, NewImport}
import io.shiftleft.codepropertygraph.generated.DiffGraphBuilder

object Imports {

  def createImportNodeAndLink(
    importedEntity: String,
    importedAs: String,
    call: Option[CallBase],
    diffGraph: DiffGraphBuilder
  ): NewImport = {
    val importNode = NewImport()
      .importedAs(importedAs)
      .importedEntity(importedEntity)
    diffGraph.addNode(importNode)
    call.foreach { c => diffGraph.addEdge(c, importNode, EdgeTypes.IS_CALL_FOR_IMPORT) }
    importNode
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy