Scope

io.joern.javasrc2cpg.scope.Scope
See theScope companion object
class Scope(implicit val withSchemaValidation: ValidationMode, val disableTypeFallback: Boolean)

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def addDeclBinding(name: String, declBindingInfo: JavaparserBindingDeclType): Unit
def addInnerType(name: String, typeFullName: String, internalName: String): Unit
def addLambdaMethod(method: Ast): Unit
def addLocalDecl(decl: Ast): Unit
def addLocalsForPatternsToEnclosingBlock(patterns: List[TypePatternExpr]): Unit
def addTopLevelType(name: String, typeFullName: String): Unit
def addTypeParameter(name: String, typeFullName: String): Unit
def addWildcardImport(prefix: String): Unit
def enclosingBlock: Option[BlockScope]
def getCapturesForNewScope(isStaticScope: Boolean): Map[String, CapturedVariable]
def getDeclBinding(name: String): Option[JavaparserBindingDeclType]
def getHoistedPatternLocals: List[NewLocal]
def getMangledName(variableName: String): String
def isEnclosingScopeStatic: Boolean
def lambdaMethodsInScope: List[Ast]
def localDeclsInScope: List[Ast]
def lookupMethodName(name: String): List[NewTypeDecl]
def lookupScopeType(simpleName: String): Option[ScopeType]
def lookupScopeType(simpleName: String, includeWildcards: Boolean): Option[ScopeType]
def lookupType(simpleName: String, includeWildcards: Boolean): Option[String]
def lookupVariableOrType(name: String): Option[String]

In the lowering for pattern match expressions, locals for pattern variables are hoisted into the enclosing block scope and these need to be kept track of to be able to tell when local names need to be mangled.

In the lowering for pattern match expressions, locals for pattern variables are hoisted into the enclosing block scope and these need to be kept track of to be able to tell when local names need to be mangled.

In most cases, these pattern variable names need to be added to the block scope for more than one level.

One example is when lowering if (o instanceof Foo f), an extra block scope is pushed while processing the o instanceof Foo f condition to allow more control for where pattern locals are added to the scope. But, the f local is hoisted into the block containing the if, so this must be recorded both in the block scope for o instanceof ... and be propagated up into the enclosing block. This method is simply a helper method which takes care of the propagation.

Attributes

def pushBlockScope(): Unit
def pushFieldDeclScope(isStatic: Boolean, name: String): Unit
def pushMethodScope(method: NewMethod, returnType: ExpectedType, isStatic: Boolean): Unit
def pushNamespaceScope(namespace: NewNamespaceBlock): Unit
def pushTypeDeclScope(typeDecl: NewTypeDecl, isStatic: Boolean, outerClassGenericSignature: Option[String], methodNames: Set[String], recordParameters: List[Parameter]): Unit
def registerCaptureUse(capturedVariable: CapturedVariable): Unit
def scopeFullName(dropScopeCount: Int): Option[String]

Implicits

Implicits

implicit val disableTypeFallback: Boolean
implicit val withSchemaValidation: ValidationMode