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

io.joern.fuzzyc2cpg.ast.langc.statements.blockstarters.IfStatement Maven / Gradle / Ivy

There is a newer version: 1.1.911
Show newest version
package io.joern.fuzzyc2cpg.ast.langc.statements.blockstarters;

import io.joern.fuzzyc2cpg.ast.AstNode;
import io.joern.fuzzyc2cpg.ast.statements.blockstarters.IfStatementBase;
import io.joern.fuzzyc2cpg.ast.walking.ASTNodeVisitor;

public class IfStatement extends IfStatementBase {

  private ElseStatement elseNode = null;

  public int getChildCount() {
    int childCount = super.getChildCount();

    if (getElseNode() != null) {
      childCount++;
    }
    return childCount;
  }

  public AstNode getChild(int index) {
    if (index == 0) {
      return condition;
    } else if (index == 1) {
      return statement;
    } else if (index == 2) {
      return getElseNode();
    }
    throw new RuntimeException("Invalid IfItem");
  }

  public ElseStatement getElseNode() {
    return elseNode;
  }

  public void setElseNode(ElseStatement elseNode) {
    this.elseNode = elseNode;
  }

  public void accept(ASTNodeVisitor visitor) {
    visitor.visit(this);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy