Struct BoolOp

Inheritance Relationships

Base Type

Struct Documentation

struct BoolOp : public AST::BinOp

Public Functions

BoolOp(const std::string &sym, ASTNode *l, ASTNode *r)

Boolean operator constructor

std::string generate_code(CodeGen::Settings &settings, unsigned indent_lvl, bool is_lhs) const

Binary operators are syntactic sugar for function cals. Therefore, turn a binary operator node in the tree into an object call.

Parameters
  • settings: Code generator settings
  • indent_lvl: Level of indentation

void generate_eval_bool_op(CodeGen::Settings settings, const unsigned indent_lvl, const std::string &true_label, const std::string &false_label)

Special handling of the short circuit Boolean operators

Parameters
  • settings: Code generator settings
  • indent_lvl: Level of indentaiton
  • true_label: Label to jump to if the Boolean operator evaluates to true
  • false_label: Label to jump to if the Boolean operator evaluates to false

bool perform_type_inference(TypeCheck::Settings &settings, Quack::Class *parent_type)

Implements type inference for a single note in the AST.

Return
True if type inference was successful.
Parameters
  • st: Symbol table for the method
  • return_type: Return type from the block
  • parent_type: Type of the parent node. If parent node has no type, then BASE_CLASS.