internal bool DoFixup(NameLookupContext nlc, IWarningLogger log) { log.PushLocation(FullName); try { if (ResolveTemplate(nlc, log)) { return(true); } ApplyWaitTags(); // Now register our tags with the GraphBuilder GraphBuilder gb = (GraphBuilder)Owner.Owner; foreach (string tag in TagsWithValues) { if (gb.GetTagId(tag) < 0) { return(true); } } // Now make sure that all of our argument names are valid. Rule rinst = (Rule)Activator.CreateInstance(Rule); Dictionary <string, int> argmap = rinst.MakeArgNameMap(); foreach (string arg in ArgsWithDeps) { if (argmap.ContainsKey(arg)) { continue; } string s = String.Format("Argument `{0}' does not exist in rule " + "`{1}'", arg, Rule); log.Error(2024, s, null); return(true); } } finally { log.PopLocation(); } return(false); }
// IWarningLogger public void PushLocation(string loc) { real.PushLocation(loc); }
void Warning(int category, string text, string detail) { log.PushLocation(Location); log.Warning(category, text, detail); log.PopLocation(); }
internal bool DoFixup (NameLookupContext nlc, IWarningLogger log) { log.PushLocation (FullName); try { if (ResolveTemplate (nlc, log)) return true; ApplyWaitTags (); // Now register our tags with the GraphBuilder GraphBuilder gb = (GraphBuilder) Owner.Owner; foreach (string tag in TagsWithValues) { if (gb.GetTagId (tag) < 0) return true; } // Now make sure that all of our argument names are valid. Rule rinst = (Rule) Activator.CreateInstance (Rule); Dictionary<string,int> argmap = rinst.MakeArgNameMap (); foreach (string arg in ArgsWithDeps) { if (argmap.ContainsKey (arg)) continue; string s = String.Format ("Argument `{0}' does not exist in rule " + "`{1}'", arg, Rule); log.Error (2024, s, null); return true; } } finally { log.PopLocation (); } return false; }
public static Result ImportXml (XmlReader xr, out string id, IWarningLogger log) { id = null; if (xr.Name != "result") { log.Warning (3019, "Expected 'result' node but got " + xr.Name + " on XML import", null); return null; } id = xr.GetAttribute ("id"); if (id == null) { log.Warning (3019, "No 'id' attribute on result element during XML import", null); return null; } log.PushLocation (id); string type = xr.GetAttribute ("type"); if (type == null) { log.Warning (3019, "No 'type' attribute on result element during XML import", null); log.PopLocation (); return null; } int depth = xr.Depth; Result r; while (xr.Read ()) if (xr.NodeType != XmlNodeType.Attribute && xr.NodeType != XmlNodeType.Whitespace) break; //Console.WriteLine ("here: id {0}, type {1}", id, type); //Console.WriteLine ("here: {0}: {1} = \"{2}\"; ac = {3}, d = {4} (vs {5})", xr.NodeType, xr.Name, xr.Value, // xr.AttributeCount, xr.Depth, depth); try { Type t; t = System.Type.GetType (type, false); if (t == null) { log.Warning (3019, "Unknown result type during XML import", type); log.PopLocation (); return null; } if (!t.IsSubclassOf (typeof (Result))) { log.Warning (3019, "Type is not a subclass of Result", t.FullName); log.PopLocation (); return null; } r = MyCreateInstance (t); if (r.ImportXml (xr, log)) { log.PopLocation (); // error will be reported return null; } log.PopLocation (); } finally { while (xr.Depth > depth) { if (!xr.Read ()) { log.Warning (3019, "Unexpected end of XML document", null); break; } } } return r; }
public void PushLocation(string loc) { uilog.PushLocation(loc); }
public static Result ImportXml(XmlReader xr, out string id, IWarningLogger log) { id = null; if (xr.Name != "result") { log.Warning(3019, "Expected 'result' node but got " + xr.Name + " on XML import", null); return(null); } id = xr.GetAttribute("id"); if (id == null) { log.Warning(3019, "No 'id' attribute on result element during XML import", null); return(null); } log.PushLocation(id); string type = xr.GetAttribute("type"); if (type == null) { log.Warning(3019, "No 'type' attribute on result element during XML import", null); log.PopLocation(); return(null); } int depth = xr.Depth; Result r; while (xr.Read()) { if (xr.NodeType != XmlNodeType.Attribute && xr.NodeType != XmlNodeType.Whitespace) { break; } } //Console.WriteLine ("here: id {0}, type {1}", id, type); //Console.WriteLine ("here: {0}: {1} = \"{2}\"; ac = {3}, d = {4} (vs {5})", xr.NodeType, xr.Name, xr.Value, // xr.AttributeCount, xr.Depth, depth); try { Type t; t = System.Type.GetType(type, false); if (t == null) { log.Warning(3019, "Unknown result type during XML import", type); log.PopLocation(); return(null); } if (!t.IsSubclassOf(typeof(Result))) { log.Warning(3019, "Type is not a subclass of Result", t.FullName); log.PopLocation(); return(null); } r = MyCreateInstance(t); if (r.ImportXml(xr, log)) { log.PopLocation(); // error will be reported return(null); } log.PopLocation(); } finally { while (xr.Depth > depth) { if (!xr.Read()) { log.Warning(3019, "Unexpected end of XML document", null); break; } } } return(r); }