Search in sources :

Example 1 with Graph

use of com.android.tools.idea.experimental.codeanalysis.datastructs.graph.Graph in project android by JetBrains.

the class CFGBuilder method resolveParam.

/**
   * Resolve the parameter at the current context.
   * @param param The parameter
   * @return The PsiCFG wrapper for the parameter
   */
@Nullable
private Param resolveParam(@NotNull PsiParameter param) {
    Graph graph = this.mGraph;
    if (graph instanceof BlockGraph) {
        Param p = ((BlockGraph) graph).getParamFromPsiParameter(param);
        if (p == null) {
            if (graph instanceof MethodGraph) {
                MethodGraph methodGraph = (MethodGraph) graph;
                PsiCFGDebugUtil.LOG.warning("Parameter " + param.getName() + " does not exist in method " + methodGraph.getPsiCFGMethod().getName() + " in class " + this.containerClass.getQualifiedClassName());
            } else {
                PsiStatement psiStmt = ((BlockGraph) graph).getParentStmt();
                PsiCFGDebugUtil.LOG.warning("Parameter " + param.getName() + " does not exist in context " + psiStmt.getText() + " in class " + this.containerClass.getQualifiedClassName());
            }
        }
        return p;
    }
    PsiCFGDebugUtil.LOG.warning("Parameter " + param.getName() + " does not exist, the graph is not" + " a block graph");
    return null;
}
Also used : SwitchCaseGraph(com.android.tools.idea.experimental.codeanalysis.datastructs.graph.SwitchCaseGraph) MethodGraph(com.android.tools.idea.experimental.codeanalysis.datastructs.graph.MethodGraph) BlockGraph(com.android.tools.idea.experimental.codeanalysis.datastructs.graph.BlockGraph) Graph(com.android.tools.idea.experimental.codeanalysis.datastructs.graph.Graph) MethodGraph(com.android.tools.idea.experimental.codeanalysis.datastructs.graph.MethodGraph) BlockGraph(com.android.tools.idea.experimental.codeanalysis.datastructs.graph.BlockGraph) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

BlockGraph (com.android.tools.idea.experimental.codeanalysis.datastructs.graph.BlockGraph)1 Graph (com.android.tools.idea.experimental.codeanalysis.datastructs.graph.Graph)1 MethodGraph (com.android.tools.idea.experimental.codeanalysis.datastructs.graph.MethodGraph)1 SwitchCaseGraph (com.android.tools.idea.experimental.codeanalysis.datastructs.graph.SwitchCaseGraph)1 Nullable (org.jetbrains.annotations.Nullable)1