Beispiel #1
0
        public object Visit(Stmt.Return _return)
        {
            object value = null;

            if (_return.value != null)
            {
                value = Evaluate(_return.value);
            }

            throw new Return(value);
        }
Beispiel #2
0
        public object Visit(Stmt.Return _return)
        {
            if (m_CurrentFunction == FunctionType.None)
            {
                m_ErrorHandler.Error(_return.keyword, "Cannot return from top-level code.");
            }

            if (_return.value != null)
            {
                Resolve(_return.value);
            }
            return(null);
        }