Class ScopeManager
- java.lang.Object
-
- de.fraunhofer.aisec.cpg.passes.scopes.ScopeManager
-
public class ScopeManager extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ScopeManager(LanguageFrontend lang)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBreakStatment(BreakStatement breakStatement)voidaddContinueStatment(ContinueStatement continueStatement)voidaddGlobal(VariableDeclaration global)voidaddLabelStatement(LabelStatement labelStatement)voidaddValueDeclaration(FieldDeclaration fieldDeclaration)voidaddValueDeclaration(FunctionDeclaration functionDeclaration)voidaddValueDeclaration(ParamVariableDeclaration paramDeclaration)voidaddValueDeclaration(VariableDeclaration variableDeclaration)voidconnectToLocal(DeclaredReferenceExpression referenceExpression)voidenterScope(Node nodeToScope)voidenterScopeIfExists(Node nodeToScope)CompoundStatementgetCurrentBlock()FunctionDeclarationgetCurrentFunction()java.lang.StringgetCurrentNamePrefix()ScopegetCurrentScope()DeclarationgetDeclarationForName(java.lang.String name)ScopegetFirstScopeThat(Scope searchScope, java.util.function.Predicate<Scope> predicate)ScopegetFirstScopeThat(java.util.function.Predicate<Scope> predicate)java.lang.StringgetFullNamePrefix()java.util.List<ValueDeclaration>getGlobals()LabelStatementgetLabelStatement(java.lang.String labelString)ScopegetScopeOfStatment(Node node)java.util.List<Scope>getScopesThat(java.util.function.Predicate<Scope> predicate)<T> java.util.List<Scope>getUniqueScopesThat(java.util.function.Predicate<Scope> predicate, java.util.function.Function<Scope,T> uniqueProperty)booleanisBreakable(Scope scope)booleanisContinuable(Scope scope)ScopeleaveScope(Node nodeToLeave)Remove all scopes above the specified one including the specified one.ScopeleaveScopeIfExists(Node nodeToLeave)ValueDeclarationresolve(DeclaredReferenceExpression ref)
-
-
-
Constructor Detail
-
ScopeManager
public ScopeManager(LanguageFrontend lang)
-
-
Method Detail
-
getCurrentBlock
public CompoundStatement getCurrentBlock()
-
getCurrentFunction
public FunctionDeclaration getCurrentFunction()
-
getGlobals
public java.util.List<ValueDeclaration> getGlobals()
-
getCurrentScope
public Scope getCurrentScope()
-
addGlobal
public void addGlobal(VariableDeclaration global)
-
enterScopeIfExists
public void enterScopeIfExists(Node nodeToScope)
-
enterScope
public void enterScope(Node nodeToScope)
-
isBreakable
public boolean isBreakable(Scope scope)
-
isContinuable
public boolean isContinuable(Scope scope)
-
leaveScope
public Scope leaveScope(Node nodeToLeave)
Remove all scopes above the specified one including the specified one.- Parameters:
nodeToLeave- - The scope is defined by its astNode- Returns:
- the scope is returned for processing
-
getFirstScopeThat
public Scope getFirstScopeThat(Scope searchScope, java.util.function.Predicate<Scope> predicate)
-
getScopesThat
public java.util.List<Scope> getScopesThat(java.util.function.Predicate<Scope> predicate)
-
getUniqueScopesThat
public <T> java.util.List<Scope> getUniqueScopesThat(java.util.function.Predicate<Scope> predicate, java.util.function.Function<Scope,T> uniqueProperty)
-
addBreakStatment
public void addBreakStatment(BreakStatement breakStatement)
-
addContinueStatment
public void addContinueStatment(ContinueStatement continueStatement)
-
addLabelStatement
public void addLabelStatement(LabelStatement labelStatement)
-
getLabelStatement
public LabelStatement getLabelStatement(java.lang.String labelString)
-
addValueDeclaration
public void addValueDeclaration(VariableDeclaration variableDeclaration)
-
addValueDeclaration
public void addValueDeclaration(ParamVariableDeclaration paramDeclaration)
-
addValueDeclaration
public void addValueDeclaration(FieldDeclaration fieldDeclaration)
-
addValueDeclaration
public void addValueDeclaration(FunctionDeclaration functionDeclaration)
-
getCurrentNamePrefix
public java.lang.String getCurrentNamePrefix()
-
getFullNamePrefix
public java.lang.String getFullNamePrefix()
-
resolve
public ValueDeclaration resolve(DeclaredReferenceExpression ref)
-
connectToLocal
public void connectToLocal(DeclaredReferenceExpression referenceExpression)
-
getDeclarationForName
public Declaration getDeclarationForName(java.lang.String name)
-
-