public override void ExitUsingStatement([NotNull] SBP.UsingStatementContext context)
        {
            var subStatements = m_scopeStack.Peek().GetSubExpressions();

            Expression scopeCode = null;

            if (subStatements[0].Type == ProcedureParsingScope.ScopeType.Block)
            {
                scopeCode = subStatements[0].GetBlockCode(null, null);
            }
            else
            {
                scopeCode = subStatements[0].GetOnlyStatementCode();
            }

            var usingVariable           = m_scopeStack.Peek().AddVariable("usingVariable_" + context.Start.Line.ToString(), new TypeReference(typeof(IDisposable)), null, EntryModifiers.Private);
            var variableAssignment      = m_scopeStack.Peek().UsingVariableAssignment;
            var usingVariableAssignment = Expression.Assign(usingVariable.VariableExpression, variableAssignment);

            var disposeHelper = typeof(ExecutionHelperMethods).GetMethod(
                nameof(ExecutionHelperMethods.DisposeObject));

            var usingCode = Expression.TryFinally(
                Expression.Block(
                    usingVariableAssignment,
                    scopeCode
                    ),
                Expression.Call(disposeHelper, m_currentProcedure.ContextReferenceInternal, usingVariable.VariableExpression));

            m_scopeStack.Peek().AddStatementCode(usingCode);

            var statementBlock = m_scopeStack.Pop();

            m_scopeStack.Peek().AddStatementCode(statementBlock.GetBlockCode());
        }
        public override void EnterUsingStatement([NotNull] SBP.UsingStatementContext context)
        {
            // Create a sub-scope in case the using statement contains a variable declaraton. That variable
            // should only be visible within this statement scope.
            m_scopeStack.Push(new ProcedureParsingScope(m_scopeStack.Peek(), "UsingStatement", ProcedureParsingScope.ScopeType.Block));

            this.AddEnterStatement(context);
        }