Package iota

Class IExpression

Direct Known Subclasses:
IBinaryExpression, ILiteralBoolean, ILiteralInt, IMessageExpression, IUnaryExpression, IVariable, IWildExpression

abstract class IExpression extends IStatement
The AST node for an expression. Every expression has a type and a flag indicating whether or not it's a statement-expression.
  • Field Details

    • type

      protected Type type
      Expression type.
    • isStatementExpression

      protected boolean isStatementExpression
      Whether or not this expression is a statement.
  • Constructor Details

    • IExpression

      protected IExpression(int line)
      Constructs an AST node for an expression.
      Parameters:
      line - line in which the expression occurs in the source file.
  • Method Details

    • type

      public Type type()
      Returns the expression type.
      Returns:
      the expression type.
    • analyze

      public abstract IExpression analyze(Context context)
      Analyzes and returns an IExpression.
      Specified by:
      analyze in class IAST
      Parameters:
      context - context in which names are resolved.
      Returns:
      the analyzed (and possibly rewritten) AST subtree.
    • codegen

      public void codegen(CLEmitter output, String targetLabel, boolean onTrue)
      Performs short-circuit code generation for a boolean expression, given the code emitter, a target label, and whether we branch to that label on true or on false.
      Parameters:
      output - the code emitter.
      targetLabel - the label to which we should branch.
      onTrue - do we branch on true?