void SemanticAnalyzer::append_block(CodeBlockPtr new_block) { if (new_block != nullptr) { // child of top block stack parent this->block_stack->top()->append(new_block); // parent is the top of the block stack new_block->set_parent(this->block_stack->top()); // push this block to the stack top this->block_stack->push(new_block); // set this block's analyzer parent if null new_block->set_analyzer(SemanticAnalyzerPtr(this)); } }