inspec type of expression instead of the type of the assignment, since the assignment type is always null

This commit is contained in:
2020-03-05 16:40:31 +01:00
parent ebeabfe930
commit 150e18e05b

View File

@@ -577,14 +577,15 @@ public class GenASM implements Visitor<Void> {
public Void visit(VariableAssignment e) { public Void visit(VariableAssignment e) {
e.expression.welcome(this); e.expression.welcome(this);
int offset = this.env.get(e.name); int offset = this.env.get(e.name);
// TODO: Check why e.type is null
// x = (x - 1) // Determine where the result of this expression was placed into
// if (e.type.equals(Type.getFloatType())) { // and move it onto the stack from there
// this.ex.write(" movq %xmm0, " + offset + "(%rbp)\n"); if (e.expression.type.equals(Type.getFloatType())) {
// } else { this.ex.write(" movq %xmm0, " + offset + "(%rbp)\n");
// this.ex.write(" movq %rax, " + offset + "(%rbp)\n"); } else {
// } this.ex.write(" movq %rax, " + offset + "(%rbp)\n");
this.ex.write(" movq %rax, " + offset + "(%rbp)\n"); }
return null; return null;
} }