Ejemplo n.º 1
0
				public override void Visit(ICodeNode node)
				{
					if (!this.isSafe || node == null)
					{
						return;
					}
					if (node.get_CodeNodeType() == 23)
					{
						V_0 = node as UnaryExpression;
						if (V_0.get_Operator() == 8 && this.includePointers || V_0.get_Operand().get_HasType() && !V_0.get_Operand().get_ExpressionType().get_IsPointer())
						{
							this.Visit(node);
							return;
						}
					}
					V_1 = node.get_CodeNodeType();
					if (V_1 > 49)
					{
						if (V_1 != 66 && V_1 - 83 > 1 && V_1 != 87)
						{
							goto Label0;
						}
					}
					else
					{
						switch (V_1 - 22)
						{
							case 0:
							case 3:
							case 4:
							case 6:
							case 7:
							case 8:
							case 9:
							{
								break;
							}
							case 1:
							case 2:
							case 5:
							{
								goto Label0;
							}
							default:
							{
								if (V_1 == 39 || V_1 == 49)
								{
									break;
								}
								goto Label0;
							}
						}
					}
					this.Visit(node);
					return;
				Label0:
					this.isSafe = false;
					return;
				}
        public static bool HasSideEffects(ICodeNode node)
        {
            if (node == null)
            {
                return(false);
            }
            V_1 = node.get_CodeNodeType();
            if (V_1 > 21)
            {
                if (V_1 == 24)
                {
                    V_0 = node as BinaryExpression;
                    if (V_0.get_IsChecked() || V_0.get_Operator() == 7)
                    {
                        return(true);
                    }
                    return(V_0.get_Operator() == 24);
                }
                switch (V_1 - 30)
                {
                case 0:
                {
                    return(!(node as FieldReferenceExpression).get_IsSimpleStore());
                }

                case 1:
                {
                    return(!(node as ExplicitCastExpression).get_IsExplicitInterfaceCast());
                }

                case 2:
                case 3:
                case 4:
                case 6:
                case 7:
                case 11:
                case 13:
                case 14:
                case 16:
                case 17:
                case 19:
                case 24:
                case 25:
                case 26:
                case 27:
                case 28:
                case 33:
                case 34:
                {
                    goto Label0;
                }

                case 5:
                case 8:
                case 10:
                case 15:
                case 18:
                case 20:
                case 21:
                case 22:
                case 23:
                case 29:
                case 30:
                case 31:
                case 32:
                case 35:
                case 36:
                {
                    break;
                }

                case 9:
                {
                    return(!(node as ArrayIndexerExpression).get_IsSimpleStore());
                }

                case 12:
                {
                    return(!(node as PropertyReferenceExpression).get_IsSetter());
                }

                default:
                {
                    if (V_1 != 72)
                    {
                        goto Label0;
                    }
                    else
                    {
                        break;
                    }
                }
                }
            }
            else
            {
                if (V_1 == 19 || V_1 == 21)
                {
                    goto Label1;
                }
                goto Label0;
            }
Label1:
            return(true);

Label0:
            return(false);
        }
Ejemplo n.º 3
0
        public virtual void Visit(ICodeNode node)
        {
            this.visitsOnStack = this.visitsOnStack + (long)1;
            if (this.visitsOnStack == (long)0x258)
            {
                this.visitsOnStack = (long)0;
                throw new Exception("Stack overflow while traversing code tree in visit.");
            }
            if (node == null)
            {
                this.visitsOnStack = this.visitsOnStack - (long)1;
                return;
            }
            switch (node.get_CodeNodeType())
            {
            case 0:
            {
                this.VisitBlockStatement((BlockStatement)node);
                break;
            }

            case 1:
            {
                this.VisitUnsafeBlockStatement((UnsafeBlockStatement)node);
                break;
            }

            case 2:
            {
                this.VisitGotoStatement((GotoStatement)node);
                break;
            }

            case 3:
            {
                this.VisitIfStatement((IfStatement)node);
                break;
            }

            case 4:
            {
                this.VisitIfElseIfStatement((IfElseIfStatement)node);
                break;
            }

            case 5:
            {
                this.VisitExpressionStatement((ExpressionStatement)node);
                break;
            }

            case 6:
            {
                this.VisitThrowExpression((ThrowExpression)node);
                break;
            }

            case 7:
            {
                this.VisitWhileStatement((WhileStatement)node);
                break;
            }

            case 8:
            {
                this.VisitDoWhileStatement((DoWhileStatement)node);
                break;
            }

            case 9:
            {
                this.VisitBreakStatement((BreakStatement)node);
                break;
            }

            case 10:
            {
                this.VisitContinueStatement((ContinueStatement)node);
                break;
            }

            case 11:
            {
                this.VisitForStatement((ForStatement)node);
                break;
            }

            case 12:
            {
                this.VisitForEachStatement((ForEachStatement)node);
                break;
            }

            case 13:
            {
                this.VisitConditionCase((ConditionCase)node);
                break;
            }

            case 14:
            {
                this.VisitDefaultCase((DefaultCase)node);
                break;
            }

            case 15:
            {
                this.VisitSwitchStatement((SwitchStatement)node);
                break;
            }

            case 16:
            {
                this.VisitCatchClause((CatchClause)node);
                break;
            }

            case 17:
            {
                this.VisitTryStatement((TryStatement)node);
                break;
            }

            case 18:
            {
                this.VisitBlockExpression((BlockExpression)node);
                break;
            }

            case 19:
            {
                this.VisitMethodInvocationExpression((MethodInvocationExpression)node);
                break;
            }

            case 20:
            {
                this.VisitMethodReferenceExpression((MethodReferenceExpression)node);
                break;
            }

            case 21:
            {
                this.VisitDelegateCreationExpression((DelegateCreationExpression)node);
                break;
            }

            case 22:
            {
                this.VisitLiteralExpression((LiteralExpression)node);
                break;
            }

            case 23:
            {
                this.VisitUnaryExpression((UnaryExpression)node);
                break;
            }

            case 24:
            {
                this.VisitBinaryExpression((BinaryExpression)node);
                break;
            }

            case 25:
            {
                this.VisitArgumentReferenceExpression((ArgumentReferenceExpression)node);
                break;
            }

            case 26:
            {
                this.VisitVariableReferenceExpression((VariableReferenceExpression)node);
                break;
            }

            case 27:
            {
                this.VisitVariableDeclarationExpression((VariableDeclarationExpression)node);
                break;
            }

            case 28:
            {
                this.VisitThisReferenceExpression((ThisReferenceExpression)node);
                break;
            }

            case 29:
            {
                this.VisitBaseReferenceExpression((BaseReferenceExpression)node);
                break;
            }

            case 30:
            {
                this.VisitFieldReferenceExpression((FieldReferenceExpression)node);
                break;
            }

            case 31:
            {
                this.VisitExplicitCastExpression((ExplicitCastExpression)node);
                break;
            }

            case 32:
            {
                this.VisitImplicitCastExpression((ImplicitCastExpression)node);
                break;
            }

            case 33:
            {
                this.VisitSafeCastExpression((SafeCastExpression)node);
                break;
            }

            case 34:
            {
                this.VisitCanCastExpression((CanCastExpression)node);
                break;
            }

            case 35:
            {
                this.VisitTypeOfExpression((TypeOfExpression)node);
                break;
            }

            case 36:
            {
                this.VisitConditionExpression((ConditionExpression)node);
                break;
            }

            case 37:
            {
                this.VisitFixedStatement((FixedStatement)node);
                break;
            }

            case 38:
            {
                this.VisitArrayCreationExpression((ArrayCreationExpression)node);
                break;
            }

            case 39:
            {
                this.VisitArrayIndexerExpression((ArrayIndexerExpression)node);
                break;
            }

            case 40:
            {
                this.VisitObjectCreationExpression((ObjectCreationExpression)node);
                break;
            }

            case 41:
            {
                this.VisitDefaultObjectExpression((DefaultObjectExpression)node);
                break;
            }

            case 42:
            {
                this.VisitPropertyReferenceExpression((PropertyReferenceExpression)node);
                break;
            }

            case 43:
            {
                this.VisitTypeReferenceExpression((TypeReferenceExpression)node);
                break;
            }

            case 44:
            {
                this.VisitUsingStatement((UsingStatement)node);
                break;
            }

            case 45:
            {
                this.VisitStackAllocExpression((StackAllocExpression)node);
                break;
            }

            case 46:
            {
                this.VisitSizeOfExpression((SizeOfExpression)node);
                break;
            }

            case 47:
            {
                this.VisitMakeRefExpression((MakeRefExpression)node);
                break;
            }

            case 48:
            {
                this.VisitEventReferenceExpression((EventReferenceExpression)node);
                break;
            }

            case 49:
            {
                this.VisitEnumExpression((EnumExpression)node);
                break;
            }

            case 50:
            {
                this.VisitLambdaExpression((LambdaExpression)node);
                break;
            }

            case 51:
            {
                this.VisitDelegateInvokeExpression((DelegateInvokeExpression)node);
                break;
            }

            case 52:
            {
                this.VisitBaseCtorExpression((BaseCtorExpression)node);
                break;
            }

            case 53:
            {
                this.VisitThisCtorExpression((ThisCtorExpression)node);
                break;
            }

            case 54:
            {
                this.VisitYieldReturnExpression((YieldReturnExpression)node);
                break;
            }

            case 55:
            {
                this.VisitYieldBreakExpression((YieldBreakExpression)node);
                break;
            }

            case 56:
            {
                this.VisitLockStatement((LockStatement)node);
                break;
            }

            case 57:
            {
                this.VisitReturnExpression((ReturnExpression)node);
                break;
            }

            case 58:
            {
                this.VisitEmptyStatement((EmptyStatement)node);
                break;
            }

            case 59:
            {
                this.VisitDynamicMemberReferenceExpression((DynamicMemberReferenceExpression)node);
                break;
            }

            case 60:
            {
                this.VisitDynamicConstructorInvocationExpression((DynamicConstructorInvocationExpression)node);
                break;
            }

            case 61:
            {
                this.VisitDynamicIndexerExpression((DynamicIndexerExpression)node);
                break;
            }

            case 62:
            {
                this.VisitBoxExpression((BoxExpression)node);
                break;
            }

            case 63:
            {
                this.VisitAnonymousPropertyInitializerExpression((AnonymousPropertyInitializerExpression)node);
                break;
            }

            case 64:
            {
                this.VisitLambdaParameterExpression((LambdaParameterExpression)node);
                break;
            }

            case 65:
            {
                this.VisitAwaitExpression((AwaitExpression)node);
                break;
            }

            case 66:
            {
                this.VisitArrayLengthExpression((ArrayLengthExpression)node);
                break;
            }

            case 67:
            {
                this.VisitExceptionStatement((ExceptionStatement)node);
                break;
            }

            case 68:
            {
                this.VisitBreakSwitchCaseStatement((BreakSwitchCaseStatement)node);
                break;
            }

            case 69:
            {
                this.VisitCaseGotoStatement((CaseGotoStatement)node);
                break;
            }

            case 70:
            {
                this.VisitFinallyClause((FinallyClause)node);
                break;
            }

            case 71:
            {
                this.VisitShortFormReturnExpression((ShortFormReturnExpression)node);
                break;
            }

            case 72:
            {
                this.VisitAnonymousObjectCreationExpression((AnonymousObjectCreationExpression)node);
                break;
            }

            case 73:
            {
                this.VisitFromClause((FromClause)node);
                break;
            }

            case 74:
            {
                this.VisitSelectClause((SelectClause)node);
                break;
            }

            case 75:
            {
                this.VisitWhereClause((WhereClause)node);
                break;
            }

            case 76:
            {
                this.VisitGroupClause((GroupClause)node);
                break;
            }

            case 77:
            {
                this.VisitOrderByClause((OrderByClause)node);
                break;
            }

            case 78:
            {
                this.VisitJoinClause((JoinClause)node);
                break;
            }

            case 79:
            {
                this.VisitLetClause((LetClause)node);
                break;
            }

            case 80:
            {
                this.VisitIntoClause((IntoClause)node);
                break;
            }

            case 81:
            {
                this.VisitLinqQueryExpression((LinqQueryExpression)node);
                break;
            }

            case 82:
            {
                this.VisitArrayVariableDeclarationExpression((ArrayVariableDeclarationExpression)node);
                break;
            }

            case 83:
            {
                this.VisitArrayAssignmentVariableReferenceExpression((ArrayVariableReferenceExpression)node);
                break;
            }

            case 84:
            {
                this.VisitArrayAssignmentFieldReferenceExpression((ArrayAssignmentFieldReferenceExpression)node);
                break;
            }

            case 85:
            {
                this.VisitPropertyInitializerExpression((PropertyInitializerExpression)node);
                break;
            }

            case 86:
            {
                this.VisitFieldInitializerExpression((FieldInitializerExpression)node);
                break;
            }

            case 87:
            {
                this.VisitParenthesesExpression((ParenthesesExpression)node);
                break;
            }

            case 88:
            {
                this.VisitInitializerExpression((InitializerExpression)node);
                break;
            }

            case 89:
            {
                this.VisitCheckedExpression((CheckedExpression)node);
                break;
            }

            case 90:
            {
                this.VisitMemberHandleExpression((MemberHandleExpression)node);
                break;
            }

            case 91:
            {
                this.VisitAutoPropertyConstructorInitializerExpression((AutoPropertyConstructorInitializerExpression)node);
                break;
            }

            case 92:
            {
                this.VisitRaiseEventExpression((RaiseEventExpression)node);
                break;
            }

            case 93:
            {
                this.VisitRefVariableDeclarationExpression((RefVariableDeclarationExpression)node);
                break;
            }

            case 94:
            {
                this.VisitRefReturnExpression((RefReturnExpression)node);
                break;
            }

            default:
            {
                goto Label0;
            }
            }
            this.visitsOnStack = this.visitsOnStack - (long)1;
            return;

Label0:
            throw new ArgumentException();
        }
            public override void Visit(ICodeNode node)
            {
                if (!this.isConstant)
                {
                    return;
                }
                V_1 = node.get_CodeNodeType();
                switch (V_1 - 20)
                {
                case 0:
                case 2:
                case 9:
                {
Label2:
                    return;
                }

                case 1:
                case 6:
                case 7:
                case 10:
                case 11:
                case 12:
                case 14:
                {
Label3:
                    this.isConstant = false;
                    return;
                }

                case 3:
                {
                    switch ((node as UnaryExpression).get_Operator())
                    {
                    case 0:
                    case 1:
                    case 2:
                    case 8:
                    case 10:
                    case 11:
                    {
                        goto Label0;
                    }

                    case 3:
                    case 4:
                    case 5:
                    case 6:
                    {
Label1:
                        this.isConstant = false;
                        return;
                    }

                    case 7:
                    case 9:
                    {
                        return;
                    }

                    default:
                    {
                        goto Label1;
                    }
                    }
                    break;
                }

                case 4:
                {
                    V_0 = node as BinaryExpression;
                    if (V_0.get_IsChecked() || V_0.get_Operator() == 7)
                    {
                        stackVariable22 = false;
                    }
                    else
                    {
                        stackVariable22 = V_0.get_Operator() != 24;
                    }
                    this.isConstant = stackVariable22;
                    if (this.isConstant)
                    {
                        goto Label0;
                    }
                    return;
                }

                case 5:
                {
                    this.isConstant = false;
                    return;
                }

                case 8:
                {
                    return;
                }

                case 13:
                case 15:
                {
Label0:
                    this.Visit(node);
                    return;
                }

                default:
                {
                    if (V_1 == 43)
                    {
                        goto Label2;
                    }
                    goto Label3;
                }
                }
            }