Example #1
0
        protected virtual EXPR Dispatch(EXPR pExpr)
        {
            switch (pExpr.kind)
            {
                case ExpressionKind.EK_BLOCK:
                    return VisitBLOCK(pExpr as EXPRBLOCK);
                case ExpressionKind.EK_RETURN:
                    return VisitRETURN(pExpr as EXPRRETURN);
                case ExpressionKind.EK_BINOP:
                    return VisitBINOP(pExpr as EXPRBINOP);
                case ExpressionKind.EK_UNARYOP:
                    return VisitUNARYOP(pExpr as EXPRUNARYOP);
                case ExpressionKind.EK_ASSIGNMENT:
                    return VisitASSIGNMENT(pExpr as EXPRASSIGNMENT);
                case ExpressionKind.EK_LIST:
                    return VisitLIST(pExpr as EXPRLIST);
                case ExpressionKind.EK_QUESTIONMARK:
                    return VisitQUESTIONMARK(pExpr as EXPRQUESTIONMARK);
                case ExpressionKind.EK_ARRAYINDEX:
                    return VisitARRAYINDEX(pExpr as EXPRARRAYINDEX);
                case ExpressionKind.EK_ARRAYLENGTH:
                    return VisitARRAYLENGTH(pExpr as EXPRARRAYLENGTH);
                case ExpressionKind.EK_CALL:
                    return VisitCALL(pExpr as EXPRCALL);
                case ExpressionKind.EK_EVENT:
                    return VisitEVENT(pExpr as EXPREVENT);
                case ExpressionKind.EK_FIELD:
                    return VisitFIELD(pExpr as EXPRFIELD);
                case ExpressionKind.EK_LOCAL:
                    return VisitLOCAL(pExpr as EXPRLOCAL);
                case ExpressionKind.EK_THISPOINTER:
                    return VisitTHISPOINTER(pExpr as EXPRTHISPOINTER);
                case ExpressionKind.EK_CONSTANT:
                    return VisitCONSTANT(pExpr as EXPRCONSTANT);
                case ExpressionKind.EK_TYPEARGUMENTS:
                    return VisitTYPEARGUMENTS(pExpr as EXPRTYPEARGUMENTS);
                case ExpressionKind.EK_TYPEORNAMESPACE:
                    return VisitTYPEORNAMESPACE(pExpr as EXPRTYPEORNAMESPACE);
                case ExpressionKind.EK_CLASS:
                    return VisitCLASS(pExpr as EXPRCLASS);
                case ExpressionKind.EK_FUNCPTR:
                    return VisitFUNCPTR(pExpr as EXPRFUNCPTR);
                case ExpressionKind.EK_PROP:
                    return VisitPROP(pExpr as EXPRPROP);
                case ExpressionKind.EK_MULTI:
                    return VisitMULTI(pExpr as EXPRMULTI);
                case ExpressionKind.EK_MULTIGET:
                    return VisitMULTIGET(pExpr as EXPRMULTIGET);
                case ExpressionKind.EK_WRAP:
                    return VisitWRAP(pExpr as EXPRWRAP);
                case ExpressionKind.EK_CONCAT:
                    return VisitCONCAT(pExpr as EXPRCONCAT);
                case ExpressionKind.EK_ARRINIT:
                    return VisitARRINIT(pExpr as EXPRARRINIT);
                case ExpressionKind.EK_CAST:
                    return VisitCAST(pExpr as EXPRCAST);
                case ExpressionKind.EK_USERDEFINEDCONVERSION:
                    return VisitUSERDEFINEDCONVERSION(pExpr as EXPRUSERDEFINEDCONVERSION);
                case ExpressionKind.EK_TYPEOF:
                    return VisitTYPEOF(pExpr as EXPRTYPEOF);
                case ExpressionKind.EK_ZEROINIT:
                    return VisitZEROINIT(pExpr as EXPRZEROINIT);
                case ExpressionKind.EK_USERLOGOP:
                    return VisitUSERLOGOP(pExpr as EXPRUSERLOGOP);
                case ExpressionKind.EK_MEMGRP:
                    return VisitMEMGRP(pExpr as EXPRMEMGRP);
                case ExpressionKind.EK_BOUNDLAMBDA:
                    return VisitBOUNDLAMBDA(pExpr as EXPRBOUNDLAMBDA);
                case ExpressionKind.EK_UNBOUNDLAMBDA:
                    return VisitUNBOUNDLAMBDA(pExpr as EXPRUNBOUNDLAMBDA);
                case ExpressionKind.EK_HOISTEDLOCALEXPR:
                    return VisitHOISTEDLOCALEXPR(pExpr as EXPRHOISTEDLOCALEXPR);
                case ExpressionKind.EK_FIELDINFO:
                    return VisitFIELDINFO(pExpr as EXPRFIELDINFO);
                case ExpressionKind.EK_METHODINFO:
                    return VisitMETHODINFO(pExpr as EXPRMETHODINFO);

                // Binary operators
                case ExpressionKind.EK_EQUALS:
                    return VisitEQUALS(pExpr.asBIN());
                case ExpressionKind.EK_COMPARE:
                    return VisitCOMPARE(pExpr.asBIN());
                case ExpressionKind.EK_NE:
                    return VisitNE(pExpr.asBIN());
                case ExpressionKind.EK_LT:
                    return VisitLT(pExpr.asBIN());
                case ExpressionKind.EK_LE:
                    return VisitLE(pExpr.asBIN());
                case ExpressionKind.EK_GT:
                    return VisitGT(pExpr.asBIN());
                case ExpressionKind.EK_GE:
                    return VisitGE(pExpr.asBIN());
                case ExpressionKind.EK_ADD:
                    return VisitADD(pExpr.asBIN());
                case ExpressionKind.EK_SUB:
                    return VisitSUB(pExpr.asBIN());
                case ExpressionKind.EK_MUL:
                    return VisitMUL(pExpr.asBIN());
                case ExpressionKind.EK_DIV:
                    return VisitDIV(pExpr.asBIN());
                case ExpressionKind.EK_MOD:
                    return VisitMOD(pExpr.asBIN());
                case ExpressionKind.EK_BITAND:
                    return VisitBITAND(pExpr.asBIN());
                case ExpressionKind.EK_BITOR:
                    return VisitBITOR(pExpr.asBIN());
                case ExpressionKind.EK_BITXOR:
                    return VisitBITXOR(pExpr.asBIN());
                case ExpressionKind.EK_LSHIFT:
                    return VisitLSHIFT(pExpr.asBIN());
                case ExpressionKind.EK_RSHIFT:
                    return VisitRSHIFT(pExpr.asBIN());
                case ExpressionKind.EK_LOGAND:
                    return VisitLOGAND(pExpr.asBIN());
                case ExpressionKind.EK_LOGOR:
                    return VisitLOGOR(pExpr.asBIN());
                case ExpressionKind.EK_SEQUENCE:
                    return VisitSEQUENCE(pExpr.asBIN());
                case ExpressionKind.EK_SEQREV:
                    return VisitSEQREV(pExpr.asBIN());
                case ExpressionKind.EK_SAVE:
                    return VisitSAVE(pExpr.asBIN());
                case ExpressionKind.EK_SWAP:
                    return VisitSWAP(pExpr.asBIN());
                case ExpressionKind.EK_INDIR:
                    return VisitINDIR(pExpr.asBIN());
                case ExpressionKind.EK_STRINGEQ:
                    return VisitSTRINGEQ(pExpr.asBIN());
                case ExpressionKind.EK_STRINGNE:
                    return VisitSTRINGNE(pExpr.asBIN());
                case ExpressionKind.EK_DELEGATEEQ:
                    return VisitDELEGATEEQ(pExpr.asBIN());
                case ExpressionKind.EK_DELEGATENE:
                    return VisitDELEGATENE(pExpr.asBIN());
                case ExpressionKind.EK_DELEGATEADD:
                    return VisitDELEGATEADD(pExpr.asBIN());
                case ExpressionKind.EK_DELEGATESUB:
                    return VisitDELEGATESUB(pExpr.asBIN());
                case ExpressionKind.EK_EQ:
                    return VisitEQ(pExpr.asBIN());

                // Unary operators
                case ExpressionKind.EK_TRUE:
                    return VisitTRUE(pExpr.asUnaryOperator());
                case ExpressionKind.EK_FALSE:
                    return VisitFALSE(pExpr.asUnaryOperator());
                case ExpressionKind.EK_INC:
                    return VisitINC(pExpr.asUnaryOperator());
                case ExpressionKind.EK_DEC:
                    return VisitDEC(pExpr.asUnaryOperator());
                case ExpressionKind.EK_LOGNOT:
                    return VisitLOGNOT(pExpr.asUnaryOperator());
                case ExpressionKind.EK_NEG:
                    return VisitNEG(pExpr.asUnaryOperator());
                case ExpressionKind.EK_UPLUS:
                    return VisitUPLUS(pExpr.asUnaryOperator());
                case ExpressionKind.EK_BITNOT:
                    return VisitBITNOT(pExpr.asUnaryOperator());
                case ExpressionKind.EK_ADDR:
                    return VisitADDR(pExpr.asUnaryOperator());
                case ExpressionKind.EK_DECIMALNEG:
                    return VisitDECIMALNEG(pExpr.asUnaryOperator());
                case ExpressionKind.EK_DECIMALINC:
                    return VisitDECIMALINC(pExpr.asUnaryOperator());
                case ExpressionKind.EK_DECIMALDEC:
                    return VisitDECIMALDEC(pExpr.asUnaryOperator());
                default:
                    throw Error.InternalCompilerError();
            }
        }
Example #2
0
        protected virtual EXPR Dispatch(EXPR pExpr)
        {
            switch (pExpr.kind)
            {
            case ExpressionKind.EK_BLOCK:
                return(VisitBLOCK(pExpr as EXPRBLOCK));

            case ExpressionKind.EK_RETURN:
                return(VisitRETURN(pExpr as EXPRRETURN));

            case ExpressionKind.EK_BINOP:
                return(VisitBINOP(pExpr as EXPRBINOP));

            case ExpressionKind.EK_UNARYOP:
                return(VisitUNARYOP(pExpr as EXPRUNARYOP));

            case ExpressionKind.EK_ASSIGNMENT:
                return(VisitASSIGNMENT(pExpr as EXPRASSIGNMENT));

            case ExpressionKind.EK_LIST:
                return(VisitLIST(pExpr as EXPRLIST));

            case ExpressionKind.EK_QUESTIONMARK:
                return(VisitQUESTIONMARK(pExpr as EXPRQUESTIONMARK));

            case ExpressionKind.EK_ARRAYINDEX:
                return(VisitARRAYINDEX(pExpr as EXPRARRAYINDEX));

            case ExpressionKind.EK_ARRAYLENGTH:
                return(VisitARRAYLENGTH(pExpr as EXPRARRAYLENGTH));

            case ExpressionKind.EK_CALL:
                return(VisitCALL(pExpr as EXPRCALL));

            case ExpressionKind.EK_EVENT:
                return(VisitEVENT(pExpr as EXPREVENT));

            case ExpressionKind.EK_FIELD:
                return(VisitFIELD(pExpr as EXPRFIELD));

            case ExpressionKind.EK_LOCAL:
                return(VisitLOCAL(pExpr as EXPRLOCAL));

            case ExpressionKind.EK_THISPOINTER:
                return(VisitTHISPOINTER(pExpr as EXPRTHISPOINTER));

            case ExpressionKind.EK_CONSTANT:
                return(VisitCONSTANT(pExpr as EXPRCONSTANT));

            case ExpressionKind.EK_TYPEARGUMENTS:
                return(VisitTYPEARGUMENTS(pExpr as EXPRTYPEARGUMENTS));

            case ExpressionKind.EK_TYPEORNAMESPACE:
                return(VisitTYPEORNAMESPACE(pExpr as EXPRTYPEORNAMESPACE));

            case ExpressionKind.EK_CLASS:
                return(VisitCLASS(pExpr as EXPRCLASS));

            case ExpressionKind.EK_FUNCPTR:
                return(VisitFUNCPTR(pExpr as EXPRFUNCPTR));

            case ExpressionKind.EK_PROP:
                return(VisitPROP(pExpr as EXPRPROP));

            case ExpressionKind.EK_MULTI:
                return(VisitMULTI(pExpr as EXPRMULTI));

            case ExpressionKind.EK_MULTIGET:
                return(VisitMULTIGET(pExpr as EXPRMULTIGET));

            case ExpressionKind.EK_WRAP:
                return(VisitWRAP(pExpr as EXPRWRAP));

            case ExpressionKind.EK_CONCAT:
                return(VisitCONCAT(pExpr as EXPRCONCAT));

            case ExpressionKind.EK_ARRINIT:
                return(VisitARRINIT(pExpr as EXPRARRINIT));

            case ExpressionKind.EK_CAST:
                return(VisitCAST(pExpr as EXPRCAST));

            case ExpressionKind.EK_USERDEFINEDCONVERSION:
                return(VisitUSERDEFINEDCONVERSION(pExpr as EXPRUSERDEFINEDCONVERSION));

            case ExpressionKind.EK_TYPEOF:
                return(VisitTYPEOF(pExpr as EXPRTYPEOF));

            case ExpressionKind.EK_ZEROINIT:
                return(VisitZEROINIT(pExpr as EXPRZEROINIT));

            case ExpressionKind.EK_USERLOGOP:
                return(VisitUSERLOGOP(pExpr as EXPRUSERLOGOP));

            case ExpressionKind.EK_MEMGRP:
                return(VisitMEMGRP(pExpr as EXPRMEMGRP));

            case ExpressionKind.EK_BOUNDLAMBDA:
                return(VisitBOUNDLAMBDA(pExpr as EXPRBOUNDLAMBDA));

            case ExpressionKind.EK_UNBOUNDLAMBDA:
                return(VisitUNBOUNDLAMBDA(pExpr as EXPRUNBOUNDLAMBDA));

            case ExpressionKind.EK_HOISTEDLOCALEXPR:
                return(VisitHOISTEDLOCALEXPR(pExpr as EXPRHOISTEDLOCALEXPR));

            case ExpressionKind.EK_FIELDINFO:
                return(VisitFIELDINFO(pExpr as EXPRFIELDINFO));

            case ExpressionKind.EK_METHODINFO:
                return(VisitMETHODINFO(pExpr as EXPRMETHODINFO));

            // Binary operators
            case ExpressionKind.EK_EQUALS:
                return(VisitEQUALS(pExpr.asBIN()));

            case ExpressionKind.EK_COMPARE:
                return(VisitCOMPARE(pExpr.asBIN()));

            case ExpressionKind.EK_NE:
                return(VisitNE(pExpr.asBIN()));

            case ExpressionKind.EK_LT:
                return(VisitLT(pExpr.asBIN()));

            case ExpressionKind.EK_LE:
                return(VisitLE(pExpr.asBIN()));

            case ExpressionKind.EK_GT:
                return(VisitGT(pExpr.asBIN()));

            case ExpressionKind.EK_GE:
                return(VisitGE(pExpr.asBIN()));

            case ExpressionKind.EK_ADD:
                return(VisitADD(pExpr.asBIN()));

            case ExpressionKind.EK_SUB:
                return(VisitSUB(pExpr.asBIN()));

            case ExpressionKind.EK_MUL:
                return(VisitMUL(pExpr.asBIN()));

            case ExpressionKind.EK_DIV:
                return(VisitDIV(pExpr.asBIN()));

            case ExpressionKind.EK_MOD:
                return(VisitMOD(pExpr.asBIN()));

            case ExpressionKind.EK_BITAND:
                return(VisitBITAND(pExpr.asBIN()));

            case ExpressionKind.EK_BITOR:
                return(VisitBITOR(pExpr.asBIN()));

            case ExpressionKind.EK_BITXOR:
                return(VisitBITXOR(pExpr.asBIN()));

            case ExpressionKind.EK_LSHIFT:
                return(VisitLSHIFT(pExpr.asBIN()));

            case ExpressionKind.EK_RSHIFT:
                return(VisitRSHIFT(pExpr.asBIN()));

            case ExpressionKind.EK_LOGAND:
                return(VisitLOGAND(pExpr.asBIN()));

            case ExpressionKind.EK_LOGOR:
                return(VisitLOGOR(pExpr.asBIN()));

            case ExpressionKind.EK_SEQUENCE:
                return(VisitSEQUENCE(pExpr.asBIN()));

            case ExpressionKind.EK_SEQREV:
                return(VisitSEQREV(pExpr.asBIN()));

            case ExpressionKind.EK_SAVE:
                return(VisitSAVE(pExpr.asBIN()));

            case ExpressionKind.EK_SWAP:
                return(VisitSWAP(pExpr.asBIN()));

            case ExpressionKind.EK_INDIR:
                return(VisitINDIR(pExpr.asBIN()));

            case ExpressionKind.EK_STRINGEQ:
                return(VisitSTRINGEQ(pExpr.asBIN()));

            case ExpressionKind.EK_STRINGNE:
                return(VisitSTRINGNE(pExpr.asBIN()));

            case ExpressionKind.EK_DELEGATEEQ:
                return(VisitDELEGATEEQ(pExpr.asBIN()));

            case ExpressionKind.EK_DELEGATENE:
                return(VisitDELEGATENE(pExpr.asBIN()));

            case ExpressionKind.EK_DELEGATEADD:
                return(VisitDELEGATEADD(pExpr.asBIN()));

            case ExpressionKind.EK_DELEGATESUB:
                return(VisitDELEGATESUB(pExpr.asBIN()));

            case ExpressionKind.EK_EQ:
                return(VisitEQ(pExpr.asBIN()));

            // Unary operators
            case ExpressionKind.EK_TRUE:
                return(VisitTRUE(pExpr.asUnaryOperator()));

            case ExpressionKind.EK_FALSE:
                return(VisitFALSE(pExpr.asUnaryOperator()));

            case ExpressionKind.EK_INC:
                return(VisitINC(pExpr.asUnaryOperator()));

            case ExpressionKind.EK_DEC:
                return(VisitDEC(pExpr.asUnaryOperator()));

            case ExpressionKind.EK_LOGNOT:
                return(VisitLOGNOT(pExpr.asUnaryOperator()));

            case ExpressionKind.EK_NEG:
                return(VisitNEG(pExpr.asUnaryOperator()));

            case ExpressionKind.EK_UPLUS:
                return(VisitUPLUS(pExpr.asUnaryOperator()));

            case ExpressionKind.EK_BITNOT:
                return(VisitBITNOT(pExpr.asUnaryOperator()));

            case ExpressionKind.EK_ADDR:
                return(VisitADDR(pExpr.asUnaryOperator()));

            case ExpressionKind.EK_DECIMALNEG:
                return(VisitDECIMALNEG(pExpr.asUnaryOperator()));

            case ExpressionKind.EK_DECIMALINC:
                return(VisitDECIMALINC(pExpr.asUnaryOperator()));

            case ExpressionKind.EK_DECIMALDEC:
                return(VisitDECIMALDEC(pExpr.asUnaryOperator()));

            default:
                throw Error.InternalCompilerError();
            }
        }