Package icyllis.arc3d.compiler.analysis

# Class SymbolUsage

java.lang.Object
icyllis.arc3d.compiler.tree.TreeVisitor
icyllis.arc3d.compiler.analysis.SymbolUsage

public final class SymbolUsage extends TreeVisitor
Counts the number of usages of a symbol.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `SymbolUsage.Count`
  `static class`
  `SymbolUsage.VariableCounts`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final IdentityHashMap<FunctionDecl,SymbolUsage.Count>`
  `mFunctionCounts`
  `final IdentityHashMap<Type,SymbolUsage.Count>`
  `mStructCounts`
  `final IdentityHashMap<Variable,SymbolUsage.VariableCounts>`
  `mVariableCounts`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SymbolUsage()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `add(Node node)`
  `SymbolUsage.Count`
  `computeFunctionCount(FunctionDecl functionSymbol)`
  `SymbolUsage.Count`
  `computeStructCount(Type typeSymbol)`
  `SymbolUsage.VariableCounts`
  `computeVariableCounts(Variable varSymbol)`
  `SymbolUsage.Count`
  `findFunctionCount(FunctionDecl functionSymbol)`
  `SymbolUsage.Count`
  `findStructCount(Type typeSymbol)`
  `SymbolUsage.VariableCounts`
  `findVariableCounts(Variable varSymbol)`
  `int`
  `getFunctionCount(FunctionDecl functionSymbol)`
  `int`
  `getStructCount(Type typeSymbol)`
  `void`
  `remove(Node node)`
  `String`
  `toString()`
  `protected boolean`
  `visitExpression(Expression expr)`
  Fallback method for any expression kind that has not been overridden.
  `boolean`
  `visitFunctionCall(FunctionCall expr)`
  `boolean`
  `visitFunctionDefinition(FunctionDefinition definition)`
  `boolean`
  `visitInterfaceBlock(InterfaceBlock interfaceBlock)`
  `boolean`
  `visitVariableDecl(VariableDecl variableDecl)`
  `boolean`
  `visitVariableReference(VariableReference expr)`

  ### Methods inherited from class icyllis.arc3d.compiler.tree.TreeVisitor

  `visitBinary, visitBlock, visitBreak, visitConditional, visitConstructorCall, visitContinue, visitDiscard, visitEmpty, visitExpression, visitFieldAccess, visitForLoop, visitFunctionPrototype, visitFunctionReference, visitGlobalVariableDecl, visitIf, visitIndex, visitLiteral, visitPostfix, visitPrefix, visitReturn, visitStatement, visitStructDefinition, visitSwitch, visitSwitchCase, visitSwizzle, visitTopLevelElement, visitTypeReference`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### mStructCounts

    public final IdentityHashMap<Type,SymbolUsage.Count> mStructCounts

  - ### mFunctionCounts

    public final IdentityHashMap<FunctionDecl,SymbolUsage.Count> mFunctionCounts

  - ### mVariableCounts

    public final IdentityHashMap<Variable,SymbolUsage.VariableCounts> mVariableCounts

- ## Constructor Details

  - ### SymbolUsage

    public SymbolUsage()

- ## Method Details

  - ### computeStructCount

    @Nonnull public SymbolUsage.Count computeStructCount(Type typeSymbol)

  - ### findStructCount

    @Nullable public SymbolUsage.Count findStructCount(Type typeSymbol)

  - ### getStructCount

    public int getStructCount(Type typeSymbol)

  - ### computeFunctionCount

    @Nonnull public SymbolUsage.Count computeFunctionCount(FunctionDecl functionSymbol)

  - ### findFunctionCount

    @Nullable public SymbolUsage.Count findFunctionCount(FunctionDecl functionSymbol)

  - ### getFunctionCount

    public int getFunctionCount(FunctionDecl functionSymbol)

  - ### computeVariableCounts

    @Nonnull public SymbolUsage.VariableCounts computeVariableCounts(Variable varSymbol)

  - ### findVariableCounts

    @Nullable public SymbolUsage.VariableCounts findVariableCounts(Variable varSymbol)

  - ### add

    public void add(@Nonnull Node node)

  - ### remove

    public void remove(@Nonnull Node node)

  - ### visitFunctionDefinition

    public boolean visitFunctionDefinition(FunctionDefinition definition)
    Overrides:
      `visitFunctionDefinition` in class `TreeVisitor`

  - ### visitInterfaceBlock

    public boolean visitInterfaceBlock(InterfaceBlock interfaceBlock)
    Overrides:
      `visitInterfaceBlock` in class `TreeVisitor`

  - ### visitFunctionCall

    public boolean visitFunctionCall(FunctionCall expr)
    Overrides:
      `visitFunctionCall` in class `TreeVisitor`

  - ### visitVariableReference

    public boolean visitVariableReference(VariableReference expr)
    Overrides:
      `visitVariableReference` in class `TreeVisitor`

  - ### visitExpression

    protected boolean visitExpression(Expression expr)
    Description copied from class: `TreeVisitor`
    Fallback method for any expression kind that has not been overridden.
    Overrides:
      `visitExpression` in class `TreeVisitor`

  - ### visitVariableDecl

    public boolean visitVariableDecl(VariableDecl variableDecl)
    Overrides:
      `visitVariableDecl` in class `TreeVisitor`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`