pass test 11_add2
This commit is contained in:
@@ -623,7 +623,7 @@ std::any SysYIRGenerator::visitMulExp(SysYParser::MulExpContext *ctx) {
|
|||||||
cout << "unaryExp().size() > 1\n";
|
cout << "unaryExp().size() > 1\n";
|
||||||
for(size_t i = 1; i < ctx->unaryExp().size(); i++){
|
for(size_t i = 1; i < ctx->unaryExp().size(); i++){
|
||||||
Value* rhs = any_cast<Value *>(ctx->unaryExp(i)->accept(this));
|
Value* rhs = any_cast<Value *>(ctx->unaryExp(i)->accept(this));
|
||||||
auto opNode = dynamic_cast<antlr4::tree::TerminalNode *>(ctx->children[2 * i + 1]);
|
auto opNode = dynamic_cast<antlr4::tree::TerminalNode *>(ctx->children[2 * i - 1]);
|
||||||
|
|
||||||
if(opNode->getText() == "*"){
|
if(opNode->getText() == "*"){
|
||||||
res = builder.createMulInst(lhs, rhs, lhs->getName() + "*" + rhs->getName());
|
res = builder.createMulInst(lhs, rhs, lhs->getName() + "*" + rhs->getName());
|
||||||
|
|||||||
Reference in New Issue
Block a user