public TraceError(Source src, ErrorCode code, string msg, ReqStatement req, MetaLocation[] stack) { Source = src; ErrorCode = code; Message = msg; ReqStatement = req; Stack = stack; }
public void AddReqStatement(ReqStatement s) { if (MetaProperty == null) { Log.Error(s.Source, ErrorCode.E0030, "'req' is not allowed in this scope"); return; } var reqStatements = ReqStatements; var creq = s as ReqProperty; var oreq = s as ReqObject; if (creq != null) { for (int i = 0; i < reqStatements.Count; i++) { if (reqStatements[i] is ReqProperty) { var lreq = reqStatements[i] as ReqProperty; if (lreq.PropertyName == creq.PropertyName) { var dt = creq.PropertyType ?? lreq.PropertyType; if (creq.PropertyType != null && lreq.PropertyType != null && !creq.PropertyType.Equals(lreq.PropertyType)) { Log.Error(creq.Source, ErrorCode.E0032, "Data type must be " + lreq.PropertyType.Quote() + ", same as the previous definition of " + lreq.PropertyName.Quote() + " declared at " + lreq.Source); } if (creq.Tag != null && lreq.Tag != null) { continue; } reqStatements[i] = new ReqProperty(creq.Source, creq.PropertyName, dt, Math.Max(creq.Offset, lreq.Offset), lreq.Tag); return; } } } } else if (oreq != null) { foreach (var r in reqStatements) { if ((r as ReqObject)?.ObjectType.Equals(oreq.ObjectType) == true) { return; } } } reqStatements.Add(s); }