コード例 #1
0
        public static bool is_assertion_checked(Type t, ASSERTION_LEVEL_ENUM val, bool saved_caller_supplier_precondition)
        // Are assertions checked for type `t' for assertion type `val'.
        // Note that `val' is not a combination.
        {
            ASSERTION_LEVEL_ENUM type_assertion_level;
            object obj;
            bool   Result;

                #if ASSERTIONS
            ASSERTIONS.CHECK("Valid val",
                             (val == ASSERTION_LEVEL_ENUM.no) ||
                             (val == ASSERTION_LEVEL_ENUM.check) ||
                             (val == ASSERTION_LEVEL_ENUM.require) ||
                             (val == ASSERTION_LEVEL_ENUM.ensure) ||
                             (val == ASSERTION_LEVEL_ENUM.loop) ||
                             (val == ASSERTION_LEVEL_ENUM.invariant));
                #endif

            Result = !in_assertion();
            if (Result)
            {
                if (val == ASSERTION_LEVEL_ENUM.require && saved_caller_supplier_precondition)
                {
                    Result = true;
                }
                else
                {
                    // Let's extract the specified assertion level for type `t'.
                    // If `is_global_assertion_level_set' is set, then we can return
                    // the global one.
                    if (is_global_assertion_level_set)
                    {
                        return((global_assertion_level & val) == val);
                    }
                    else if ((assertion_levels != null))
                    {
                        obj = assertion_levels [t];
                        if (obj != null)
                        {
                            type_assertion_level = (ASSERTION_LEVEL_ENUM)obj;
                        }
                        else
                        {
                            type_assertion_level = ASSERTION_LEVEL_ENUM.no;
                        }
                    }
                    else
                    {
                        type_assertion_level = ASSERTION_LEVEL_ENUM.no;
                    }
                    Result = ((type_assertion_level & val) == val);
                }
            }
            return(Result);
        }
コード例 #2
0
ファイル: runtime.cs プロジェクト: tioui/EiffelStudio
	public static bool is_assertion_checked (Type t, ASSERTION_LEVEL_ENUM val, bool saved_caller_supplier_precondition)
		// Are assertions checked for type `t' for assertion type `val'.
		// Note that `val' is not a combination.
	{
		ASSERTION_LEVEL_ENUM type_assertion_level;
		object obj;
		bool Result;

		#if ASSERTIONS
			ASSERTIONS.CHECK ("Valid val",
				(val == ASSERTION_LEVEL_ENUM.no) ||
				(val == ASSERTION_LEVEL_ENUM.check) ||
				(val == ASSERTION_LEVEL_ENUM.require) ||
				(val == ASSERTION_LEVEL_ENUM.ensure) ||
				(val == ASSERTION_LEVEL_ENUM.loop) ||
				(val == ASSERTION_LEVEL_ENUM.invariant));
		#endif

		Result = !in_assertion();
		if (Result) {
			if (val == ASSERTION_LEVEL_ENUM.require && saved_caller_supplier_precondition) {
				Result = true;
			} else {
					// Let's extract the specified assertion level for type `t'.
					// If `is_global_assertion_level_set' is set, then we can return
					// the global one.
				if (is_global_assertion_level_set) {
					return (global_assertion_level & val) == val;
				} else if ((assertion_levels != null)) {
					obj = assertion_levels [t];
					if (obj != null) {
						type_assertion_level = (ASSERTION_LEVEL_ENUM) obj;
					} else {
						type_assertion_level = ASSERTION_LEVEL_ENUM.no;
					}
				} else {
					type_assertion_level = ASSERTION_LEVEL_ENUM.no;
				}
				Result = ((type_assertion_level & val) == val);
			}
		}
		return Result;
	}
コード例 #3
0
/*
 * feature -- Initialization
 */
        public ASSERTION_LEVEL_ATTRIBUTE(Type type, ASSERTION_LEVEL_ENUM level)
        {
            class_type      = type;
            assertion_level = level;
        }
コード例 #4
0
 /*
 feature -- Initialization
 */
 public ASSERTION_LEVEL_ATTRIBUTE(Type type, ASSERTION_LEVEL_ENUM level)
 {
     class_type = type;
     assertion_level = level;
 }