Struct Typing

Inheritance Relationships

Base Type

Struct Documentation

struct Typing : public AST::ASTNode

Public Functions

Typing(ASTNode *expr, const std::string &type_name)
~Typing()
void print_original_src(unsigned int indent_depth)
std::string generate_code(CodeGen::Settings &settings, unsigned indent_lvl, bool is_lhs) const
bool check_initialize_before_use(InitializedList &inits, InitializedList *all_inits, bool is_method)

Helper function used to check if the specified type name actually exists.

Return
True if the type_name_ is a valid class.
Parameters
  • type_name: Name of the type used

void update_initialized_list(InitializedList &inits, bool is_constructor)

Used in an assignment statement to update the set of initialized variables.

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

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

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.

Public Members

ASTNode *expr_
std::string type_name_