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

io.joern.fuzzyc2cpg.ast.expressions.BinaryExpression Maven / Gradle / Ivy

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

import io.joern.fuzzyc2cpg.ast.AstNode;
import io.joern.fuzzyc2cpg.ast.walking.ASTNodeVisitor;

public class BinaryExpression extends Expression {

  Expression leftExpression = null;
  Expression rightExpression = null;

  public Expression getLeft() {
    return this.leftExpression;
  }

  public void setLeft(Expression leftExpression) {
    this.leftExpression = leftExpression;
    super.addChild(leftExpression);
  }

  public Expression getRight() {
    return this.rightExpression;
  }

  public void setRight(Expression rightExpression) {
    this.rightExpression = rightExpression;
    super.addChild(rightExpression);
  }

  @Override
  public void addChild(AstNode item) {
    if (getLeft() == null) {
      setLeft((Expression) item);
    } else if (getRight() == null) {
      setRight((Expression) item);
    } else {
      throw new RuntimeException(
          "Error: attempting to add third child to binary expression");
    }
  }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy