public string Visit(CIL_GetAttr node) { string solve = ""; solve += $"\t lw $t1, {context_function[node.Instanc]}\n"; solve += $"\t lw $t0, {offset_attrs[node.StaticType][node.Attr] + 8}($t1)\n"; solve += $"\t sw $t0 {context_function[node.Result]}\n"; return(solve); }
public string Visit(CIL_GetAttr node) { int idx = mem.GetValue(variableaddr.Peek()[node.Instanc]); idx++; int typedir = mem.GetValue(idx++); string type = GetTypeFromDir(typedir); idx += OffSetAttr[type][node.Attr]; int s = mem.GetValue(idx); int valorreturn = variableaddr.Peek()[node.Result]; mem.SetValue(valorreturn, s); return(""); }