Struct Ident

Inheritance Relationships

Base Type

Struct Documentation

struct Ident : public AST::ASTNode

Public Functions

Ident(const char *txt)
void print_original_src(unsigned int indent_depth = 0)
bool check_initialize_before_use(InitializedList &inits, InitializedList *all_inits, bool is_method)
bool check_ident_initialized(InitializedList &inits, InitializedList *all_inits, bool is_field = false)

Generalized function for checking identifiers including constructor identifiers.

Return
True if the identifier is initialized
Parameters
  • inits: Initialized variable set
  • all_inits: All initialized variables so far
  • is_field: True if the identifier corresponds to a field

void update_initialized_list(InitializedList &inits, bool is_constructor)

Adds the implicit identifier to the initialized variable list. If this function is called directly, the initialized variable is marked as not a field of the class.

Parameters
  • inits: Set of initialized variables.
  • is_constructor: True if the function is a constructor. It has no effect in this function.

void add_identifier_to_initialized(InitializedList &inits, bool is_field)

Add the identifier to the initialized variable list.

Parameters
  • inits: Set of initialized variables
  • is_field: True if the identifier corresponds to a field.

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

Updates the symbol table and the node of the symbol in the symbol table and the AST>

Return
True if the inferred type was successfully updated
Parameters
  • st: Symbol table
  • inferred_type: Inferred type of the symbol

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.

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

Simply prints the identifier name.

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

Public Members

const std::string text_

Identifier name