public EXPRBLOCK CreateBlock(EXPRBLOCK pOptionalCurrentBlock, EXPRSTMT pOptionalStatements, Scope pOptionalScope)
        {
            EXPRBLOCK rval = new EXPRBLOCK();

            rval.kind  = ExpressionKind.EK_BLOCK;
            rval.type  = null;
            rval.flags = 0;
            rval.SetOptionalStatements(pOptionalStatements);
            rval.OptionalScopeSymbol = pOptionalScope;
            Debug.Assert(rval != null);
            return(rval);
        }
Ejemplo n.º 2
0
        /////////////////////////////////////////////////////////////////////////////////

        protected EXPRSTMT DispatchStatementList(EXPRSTMT expr)
        {
            Debug.Assert(expr != null);

            EXPRSTMT first = expr;
            EXPRSTMT pexpr = first;

            while (pexpr != null)
            {
                // If the processor replaces the statement -- potentially with
                // null, another statement, or a list of statements -- then we
                // make sure that the statement list is hooked together correctly.

                EXPRSTMT next = pexpr.GetOptionalNextStatement();
                EXPRSTMT old = pexpr;

                // Unhook the next one.
                pexpr.SetOptionalNextStatement(null);

                EXPR result = Dispatch(pexpr);
                Debug.Assert(result == null || result.isSTMT());

                if (pexpr == first)
                {
                    first = (result == null) ? null : result.asSTMT();
                }
                else
                {
                    pexpr.SetOptionalNextStatement((result == null) ? null : result.asSTMT());
                }

                // A transformation may return back a list of statements (or
                // if the statements have been determined to be unnecessary,
                // perhaps it has simply returned null.)
                //
                // Skip visiting the new list, then hook the tail of the old list
                // up to the end of the new list.

                while (pexpr.GetOptionalNextStatement() != null)
                {
                    pexpr = pexpr.GetOptionalNextStatement();
                }

                // Re-hook the next pointer.
                pexpr.SetOptionalNextStatement(next);
            }
            return first;
        }
Ejemplo n.º 3
0
        /////////////////////////////////////////////////////////////////////////////////

        protected EXPRSTMT DispatchStatementList(EXPRSTMT expr)
        {
            Debug.Assert(expr != null);

            EXPRSTMT first = expr;
            EXPRSTMT pexpr = first;

            while (pexpr != null)
            {
                // If the processor replaces the statement -- potentially with
                // null, another statement, or a list of statements -- then we
                // make sure that the statement list is hooked together correctly.

                EXPRSTMT next = pexpr.GetOptionalNextStatement();
                EXPRSTMT old  = pexpr;

                // Unhook the next one.
                pexpr.SetOptionalNextStatement(null);

                EXPR result = Dispatch(pexpr);
                Debug.Assert(result == null || result.isSTMT());

                if (pexpr == first)
                {
                    first = (result == null) ? null : result.asSTMT();
                }
                else
                {
                    pexpr.SetOptionalNextStatement((result == null) ? null : result.asSTMT());
                }

                // A transformation may return back a list of statements (or
                // if the statements have been determined to be unnecessary,
                // perhaps it has simply returned null.)
                //
                // Skip visiting the new list, then hook the tail of the old list
                // up to the end of the new list.

                while (pexpr.GetOptionalNextStatement() != null)
                {
                    pexpr = pexpr.GetOptionalNextStatement();
                }

                // Re-hook the next pointer.
                pexpr.SetOptionalNextStatement(next);
            }
            return(first);
        }
Ejemplo n.º 4
0
 protected virtual EXPR VisitSTMT(EXPRSTMT pExpr)
 {
     return VisitEXPR(pExpr);
 }
Ejemplo n.º 5
0
 protected virtual EXPR VisitSTMT(EXPRSTMT pExpr)
 {
     return(VisitEXPR(pExpr));
 }
Ejemplo n.º 6
0
 public EXPRBLOCK CreateBlock(EXPRBLOCK pOptionalCurrentBlock, EXPRSTMT pOptionalStatements, Scope pOptionalScope)
 {
     EXPRBLOCK rval = new EXPRBLOCK();
     rval.kind = ExpressionKind.EK_BLOCK;
     rval.type = null;
     rval.flags = 0;
     rval.SetOptionalStatements(pOptionalStatements);
     rval.OptionalScopeSymbol = pOptionalScope;
     Debug.Assert(rval != null);
     return (rval);
 }