IsAssigned() public method

public IsAssigned ( DefiniteAssignmentBitSet vector ) : bool
vector DefiniteAssignmentBitSet
return bool
Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
			public bool IsAssigned (VariableInfo var, bool ignoreReachability)
			{
				if (!ignoreReachability && !var.IsParameter && IsUnreachable)
					return true;

				return var.IsAssigned (locals);
			}
Ejemplo n.º 3
0
 public bool IsDefinitelyAssigned(VariableInfo variable)
 {
     return(variable.IsAssigned(DefiniteAssignment));
 }
Ejemplo n.º 4
0
		public bool IsDefinitelyAssigned (VariableInfo variable)
		{
			return variable.IsAssigned (DefiniteAssignment);
		}