Mono.CSharp.VariableInfo.IsAssigned C# (CSharp) Method

IsAssigned() public method

public IsAssigned ( DefiniteAssignmentBitSet vector ) : bool
vector DefiniteAssignmentBitSet
return bool
		public bool IsAssigned (DefiniteAssignmentBitSet vector)
		{
			if (vector == null)
				return true;

			if (vector [Offset])
				return true;

			// Unless this is a struct
			if (!TypeInfo.IsStruct)
				return false;

			//
			// Following case cannot be handled fully by SetStructFieldAssigned
			// because we may encounter following case
			// 
			// struct A { B b }
			// struct B { int value; }
			//
			// setting a.b.value is propagated only to B's vector and not upwards to possible parents
			//
			//
			// Each field must be assigned
			//
			for (int i = Offset + 1; i <= TypeInfo.Length + Offset; i++) {
				if (!vector[i])
					return false;
			}

			// Ok, now check all fields which are structs.
			for (int i = 0; i < sub_info.Length; i++) {
				VariableInfo sinfo = sub_info[i];
				if (sinfo == null)
					continue;

				if (!sinfo.IsAssigned (vector))
					return false;
			}
			
			vector.Set (Offset);
			return true;
		}

Usage Example

Example #1
0
        public bool IsAssigned(DefiniteAssignmentBitSet vector)
        {
            if (vector == null)
            {
                return(true);
            }

            if (vector[Offset])
            {
                return(true);
            }

            // Unless this is a struct
            if (!TypeInfo.IsStruct)
            {
                return(false);
            }

            //
            // Following case cannot be handled fully by SetStructFieldAssigned
            // because we may encounter following case
            //
            // struct A { B b }
            // struct B { int value; }
            //
            // setting a.b.value is propagated only to B's vector and not upwards to possible parents
            //
            //
            // Each field must be assigned
            //
            for (int i = Offset + 1; i <= TypeInfo.Length + Offset; i++)
            {
                if (!vector[i])
                {
                    return(false);
                }
            }

            // Ok, now check all fields which are structs.
            for (int i = 0; i < sub_info.Length; i++)
            {
                VariableInfo sinfo = sub_info[i];
                if (sinfo == null)
                {
                    continue;
                }

                if (!sinfo.IsAssigned(vector))
                {
                    return(false);
                }
            }

            vector.Set(Offset);
            return(true);
        }
All Usage Examples Of Mono.CSharp.VariableInfo::IsAssigned