Example #1
0
        public override void OnReturnStatement(ReturnStatement stmt)
        {
            // First normalize the statement
            normalizer.Visit(stmt);
            //empty return, so error
            if (stmt.Expression == null)
            {
                throw new Exception("An empty return statement on a method with output attribute");
            }
            found = true;
            var block = (Block)stmt.ParentNode;
            int index = 0;

            while (block.Statements[index] != stmt)
            {
                index++;
            }

            MethodInvocationExpression invocation = mie.CloneNode();

            invocation.Arguments.Add(stmt.Expression);

            stmt.Expression = invocation;
        }