Template Struct Literal

Inheritance Relationships

Base Type

Struct Documentation

template <typename _T>
struct Literal : public AST::ASTNode

Public Functions

Literal(const _T &v)
bool check_initialize_before_use(InitializedList &inits, InitializedList *all_inits, bool is_method)

No initialization before use check for a literal. This function simply returns true.

Return
True always.
Parameters
  • inits: Set of initialized variables. Not changed in the funciton.

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

const _T value_

Value of the literal

Protected Functions

std::string generate_lit_code(CodeGen::Settings &settings, unsigned indent_lvl, const std::string &gen_func_name_) const

Helper function that standardizes code generation for all literals.

Parameters
  • settings: Code generator settings object
  • indent_lvl: Indention level
  • gen_func_name_: Function used to generate objects of a given type