public void SetAssigned(DefiniteAssignmentBitSet vector, bool generatedAssignment) { if (Length == 1) { vector.Set(Offset); } else { vector.Set(Offset, Length); } if (!generatedAssignment) { IsEverAssigned = true; } }
public void SetStructFieldAssigned(DefiniteAssignmentBitSet vector, string field_name) { if (vector[Offset]) { return; } int field_idx = TypeInfo.GetFieldIndex(field_name); if (field_idx == 0) { return; } var complex_field = TypeInfo.GetStructField(field_name); if (complex_field != null) { vector.Set(Offset + complex_field.Offset, complex_field.TotalLength); } else { vector.Set(Offset + field_idx); } IsEverAssigned = true; // // Each field must be assigned before setting master bit // for (int i = Offset + 1; i < TypeInfo.TotalLength + Offset; i++) { if (!vector[i]) { return; } } // // Set master struct flag to assigned when all tested struct // fields have been assigned // vector.Set(Offset); }
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); }
public void SetStructFieldAssigned (DefiniteAssignmentBitSet vector, string field_name) { if (vector [Offset]) return; int field_idx = TypeInfo.GetFieldIndex (field_name); if (field_idx == 0) return; var complex_field = TypeInfo.GetStructField (field_name); if (complex_field != null) { vector.Set (Offset + complex_field.Offset, complex_field.TotalLength); } else { vector.Set (Offset + field_idx); } IsEverAssigned = true; // // Each field must be assigned before setting master bit // for (int i = Offset + 1; i < TypeInfo.TotalLength + Offset; i++) { if (!vector[i]) return; } // // Set master struct flag to assigned when all tested struct // fields have been assigned // vector.Set (Offset); }
public void SetAssigned (DefiniteAssignmentBitSet vector, bool generatedAssignment) { if (Length == 1) vector.Set (Offset); else vector.Set (Offset, Length); if (!generatedAssignment) IsEverAssigned = true; }
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; }