Struct ObjectCall

Inheritance Relationships

Base Type

Struct Documentation

struct ObjectCall : public AST::ASTNode

Public Functions

ObjectCall(ASTNode *object, ASTNode *next)
~ObjectCall()
void print_original_src(unsigned int indent_depth)
bool check_initialize_before_use(InitializedList &inits, InitializedList *all_inits, bool is_method)

Checks if the initialize before use test passes on the right subexpression.

Return
True if the initialized before use test passes for the right subexpression.
Parameters
  • inits: Set of initialized variables.

void update_initialized_list(InitializedList &inits, bool is_constructor)

Updates the initialized list in the initialized per use check.

Parameters
  • inits: Set of initialized variables.
  • is_constructor: True if the function being checked is a constructor.

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

Processes object calls in the quack program. Object calls take two forms namely: obj.<field> and obj.<method>(…). Dynamic casting is used to determine which of the two applies for this specific case of code generator.

Return
Any object call string.
Parameters
  • settings: Code generator settings
  • indent_lvl: Level of indentation.
  • is_lhs: True if the node corresponds to a left hand side.

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

After the left object is processed, process the right object.

Return
Variable containing the combined results of the object call
Parameters
  • left_obj: Left object of the object call
  • settings: Code generator settings
  • indent_lvl: Level of indentation

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.

bool update_inferred_type(TypeCheck::Settings &settings, Quack::Class *inferred_type, bool is_field)

Updates the symbol table and the nodes using an inferred type

Return
True if the update is successful
Parameters
  • st: Symbol table for the method
  • inferred_type: Type inferred for updating
  • this_class: Class type of the object

Public Members

ASTNode *object_
ASTNode *next_