Resolved token conflicts in favor of tokens without reference.

This commit is contained in:
the_fiddler 2010-11-19 11:29:02 +00:00
parent 93e224ff83
commit c57853abb6
2 changed files with 15 additions and 2 deletions

View file

@ -176,8 +176,18 @@ namespace Bind.ES
}
else if (e.ConstantCollection[c.Name].Value != c.Value)
{
Console.WriteLine("[Warning] Conflicting token {0}.{1} with value {2} != {3}",
e.Name, c.Name, e.ConstantCollection[c.Name].Value, c.Value);
var existing = e.ConstantCollection[c.Name];
if (existing.Reference != null && c.Reference == null)
{
e.ConstantCollection[c.Name] = c;
}
else if (existing.Reference == null && c.Reference != null)
{ } // Keep existing
else
{
Console.WriteLine("[Warning] Conflicting token {0}.{1} with value {2} != {3}",
e.Name, c.Name, e.ConstantCollection[c.Name].Value, c.Value);
}
}
}
catch (ArgumentException ex)

View file

@ -302,7 +302,10 @@ namespace Bind
.Where(c => !Constant.TranslateConstantWithReference(c, enums, null))
.Select(c => c).ToList();
foreach (var c in broken_references)
{
Console.WriteLine("[Warning] Reference {0} not found for token {1}.", c.Reference, c);
e.ConstantCollection.Remove(c.Name);
}
}
static bool IsValue(string test)