Ejemplo n.º 1
0
        public override object VisitCheckStatement([NotNull] CheckStatementContext context)
        {
            if (context.checkErrorStatement().Length == 0 && context.checkFinallyStatment() == null)
            {
                var obj = "using (";
                obj += Visit(context.usingExpression()) + ")" + BlockLeft + Wrap;
                obj += ProcessFunctionSupport(context.functionSupportStatement());
                obj += BlockRight + Wrap;
                return(obj);
            }
            else
            {
                var obj = $"try {BlockLeft} {Wrap}";
                obj += ProcessFunctionSupport(context.functionSupportStatement());
                obj += BlockRight + Wrap;
                foreach (var item in context.checkErrorStatement())
                {
                    obj += Visit(item) + Wrap;
                }

                if (context.checkFinallyStatment() != null)
                {
                    obj += Visit(context.checkFinallyStatment());
                }
                if (context.usingExpression() != null)
                {
                    obj  = $"using ({ Visit(context.usingExpression())}) {BlockLeft} {Wrap} {obj} ";
                    obj += BlockRight + Wrap;
                }
                return(obj);
            }
        }
Ejemplo n.º 2
0
        public override object VisitCheckStatement(CheckStatementContext context)
        {
            var obj = (new System.Text.StringBuilder().Append("try ").Append(BlockLeft).Append(Wrap)).to_str();

            this.add_current_set();
            obj += ProcessFunctionSupport(context.functionSupportStatement());
            this.delete_current_set();
            obj += BlockRight;
            foreach (var item in context.checkErrorStatement())
            {
                obj += Visit(item) + Wrap;
            }
            if (context.checkFinallyStatment() != null)
            {
                obj += Visit(context.checkFinallyStatment());
            }
            return(obj);
        }