Skip to content

Commit

Permalink
Generate code of simple assignment expression
Browse files Browse the repository at this point in the history
  • Loading branch information
Lai-YT committed Sep 14, 2023
1 parent 37c17bb commit 98b8a79
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,12 @@ std::string NotEqualToExprNode::Op_() const {
return "!=";
}

int SimpleAssignmentExprNode::CodeGen() const {}
int SimpleAssignmentExprNode::CodeGen() const {
int expr_num = expr_->CodeGen();
output << "storew " << PrefixSigil(expr_num) << ", "
<< PrefixSigil(id_to_num.at(id_)) << std::endl;
return expr_num;
}

void SimpleAssignmentExprNode::Dump(int pad) const {
std::cout << Pad(pad) << '(' << '=' << std::endl;
Expand Down

0 comments on commit 98b8a79

Please sign in to comment.