public ReturnStatement DecompileReturn() { PopByte(); Expression expr = null; if (CurrentIs(OpCodes.ReturnNullValue)) { PopByte(); var retVal = ReadObject(); var returnNothingStatement = new ReturnNothingStatement(); StatementLocations.Add(StartPositions.Pop(), returnNothingStatement); return(returnNothingStatement); } else if (CurrentIs(OpCodes.Nothing)) { PopByte(); } else { expr = DecompileExpression(); if (expr == null && PopByte() != (byte)OpCodes.Nothing) { return(null); //ERROR ? } } if (ReturnType is Enumeration enm && expr is IntegerLiteral intLit && intLit.Value >= 0 && intLit.Value < enm.Values.Count) { expr = new CompositeSymbolRef(new SymbolReference(enm, enm.Name), new SymbolReference(null, enm.Values[intLit.Value].Name)); } var statement = new ReturnStatement(expr); StatementLocations.Add(StartPositions.Pop(), statement); return(statement); }
public bool VisitNode(ReturnNothingStatement node) { //an implementation detail. no textual representation return(false); }
public virtual object Visit(ReturnNothingStatement that, object value) { throw new System.NotImplementedException(); }