private void TryEnqueue(string name, AST <Program> refSource, Span refSpan, ParseResult res) { if (string.IsNullOrWhiteSpace(name)) { return; } try { var progName = new ProgramName(name, refSource.Node.Name); workItems.Add(new Tuple <ProgramName, string, Span>(progName, refSource.Node.Name.ToString(env.Parameters), refSpan)); } catch (Exception e) { var badRef = new Flag( SeverityKind.Error, refSpan, Constants.BadFile.ToString(e.Message), Constants.BadFile.Code, refSource.Node.Name); if (res == null) { iresult.AddFlag(refSource, badRef); } else { res.AddFlag(badRef); } } }