public void Push(StackEntry entry) { if (entry.Type.Code == StackTypeCode.Void) { _writer.Ident(Ident).WriteLine($"{entry.Expression};"); } else { //var id = $"_v{_paramIndex++}"; //_writer.Ident(Ident).WriteLine($"auto {id} = {entry.Expression};"); //_stackValues.Push(new StackEntry { Type = entry.Type, Expression = id }); _stackValues.Push(entry); } }
public void Compute() { var entry = _stackValues.Peek(); if (!entry.Computed) { _stackValues.Pop(); var id = $"_v{_paramIndex++}"; _writer.Ident(Ident).WriteLine($"auto {id} = {entry.Expression};"); var newEntry = new StackEntry { Type = entry.Type, Expression = id, Computed = true }; _stackValues.Push(newEntry); } }