public bool VisitNode(ReturnStatement node)
        {
            // return expression;
            Write("return");
            if (node.Value != null)
            {
                Append(" ");
                node.Value.AcceptVisitor(this);
            }

            return true;
        }
 public bool VisitNode(ReturnStatement node)
 {
     throw new NotImplementedException();
 }
Exemple #3
0
        public ReturnStatement DecompileReturn()
        {
            PopByte();

            Expression expr = null;
            if (CurrentIs(StandardByteCodes.ReturnNullValue))
            {
                // TODO: research this a bit, seems to be the zero-equivalent value for the return type.
                PopByte();
                var retVal = ReadObject();
                expr = new SymbolReference(null, null, null, "null"); // TODO: faulty obv, kind of illustrates the thing though.
            }
            else if(CurrentIs(StandardByteCodes.Nothing))
            {
                PopByte();
            }
            else
            {
                expr = DecompileExpression();
                if (expr == null && PopByte() != (byte)StandardByteCodes.Nothing)
                    return null; //ERROR ?
            }

            var statement = new ReturnStatement(null, null, expr);
            StatementLocations.Add(StartPositions.Pop(), statement);
            return statement;
        }