public void SetAssigned (VariableInfo vi) { CurrentUsageVector.SetAssigned (vi); }
public void SetFieldAssigned (VariableInfo vi, string name) { CurrentUsageVector.SetFieldAssigned (vi, name); }
public bool IsAssigned (VariableInfo vi) { return CurrentUsageVector.IsAssigned (vi, false); }
public bool IsStructFieldAssigned (VariableInfo vi, string field_name) { return CurrentUsageVector.IsAssigned (vi, false) || CurrentUsageVector.IsFieldAssigned (vi, field_name); }
public bool IsFieldAssigned (VariableInfo var, string name) { if (/*!var.IsParameter &&*/ IsUnreachable) return true; return var.IsStructFieldAssigned (locals, name); }
public void SetFieldAssigned (VariableInfo var, string name) { if (/*!var.IsParameter &&*/ IsUnreachable) return; var.SetStructFieldAssigned (locals, name); }
public void SetAssigned (VariableInfo var) { if (!var.IsParameter && IsUnreachable) return; var.SetAssigned (locals); }
public bool IsAssigned (VariableInfo var, bool ignoreReachability) { if (!ignoreReachability && !var.IsParameter && IsUnreachable) return true; return var.IsAssigned (locals); }
protected void Initialize () { TypeInfo[] sub_fields = TypeInfo.SubStructInfo; if (sub_fields != null) { sub_info = new VariableInfo [sub_fields.Length]; for (int i = 0; i < sub_fields.Length; i++) { if (sub_fields [i] != null) sub_info [i] = new VariableInfo (this, sub_fields [i]); } } else sub_info = new VariableInfo [0]; }
VariableInfo (VariableInfo parent, TypeInfo type) { this.Name = parent.Name; this.TypeInfo = type; this.Offset = parent.Offset + type.Offset; this.Length = type.TotalLength; this.IsParameter = parent.IsParameter; Initialize (); }
// <summary> // A struct's constructor must always assign all fields. // This method checks whether it actually does so. // </summary> public bool IsFullyInitialized (BlockContext ec, VariableInfo vi, Location loc) { if (struct_info == null) return true; bool ok = true; FlowBranching branching = ec.CurrentBranching; for (int i = 0; i < struct_info.Count; i++) { var field = struct_info.Fields [i]; if (!branching.IsStructFieldAssigned (vi, field.Name)) { if (field.MemberDefinition is Property.BackingField) { ec.Report.Error (843, loc, "An automatically implemented property `{0}' must be fully assigned before control leaves the constructor. Consider calling the default struct contructor from a constructor initializer", field.GetSignatureForError ()); } else { ec.Report.Error (171, loc, "Field `{0}' must be fully assigned before control leaves the constructor", field.GetSignatureForError ()); } ok = false; } } return ok; }