private string GenerateInternal(Instruction first, Instruction last, TextWriter specific, ref EvaluationStack unhandled) { int evaluationStackPreviousCount = evaluationStack.Count; var writer = this.writer; this.writer = specific; for (var instruction = first; instruction != last.Next;) { try { instruction = instruction.Step(last, this); } catch (System.Reflection.TargetInvocationException e) { Debug.LogFormat("Inner exception \"{0}\" occured in {1}, when generating the following codes:", e.InnerException, instruction); var f = first; while (f.Previous != null) { f = f.Previous; } var l = last; while (l.Next != null) { l = l.Next; } for (var i = f; i != l.Next; i = i.Next) { Console.WriteLine(i); } throw new NotImplementedException(); } } this.writer = writer; int evaluationStackCount = evaluationStack.Count; if (evaluationStackCount > evaluationStackPreviousCount) { int count = evaluationStackCount - evaluationStackPreviousCount; unhandled = new EvaluationStack(); Stack <Value> tmp = new Stack <Value>(); while ((count--) != 0) { tmp.Push(evaluationStack.Pop()); } while (tmp.Count != 0) { unhandled.Push(tmp.Pop()); } } else { unhandled = null; } return(specific.ToString()); }
public Value Push(TypeReference type, object name) { return(evaluationStack.Push(type, name)); }