private void fixArguments(Token tok)
{
String funcname = tok.Prev().Prev().Value;
List <String> nonbasic = new List <String>();
while (!tok.IsRightPar())
{
Type type = new Type();
tok = tok.CompleteType(type);
String ident = tok.IsIdentifier() ? tok.Value : "anonymous";
if (tok.IsIdentifier() && !type.IsBasic() && type.ModName == "")
{
nonbasic.Add(ident);
}
if (tok.IsIdentifier())
{
tok = tok.Next();
}
if (tok.IsEnd() || tok.IsRightPar())
{
break;
}
tok = tok.Next();
if (tok.IsEnd())
{
break;
}
}
tok = tok.Next();
if (!tok.IsLeftBracket())
{
return;
}
tok = tok.Next();
if (tok.IsEnd())
{
return;
}
int level = tok.ScopeLevel;
Token next;
Token prev;
while (nonbasic.Count > 0 && !tok.IsRightBracket() && !tok.IsEnd() && tok.ScopeLevel == level)
{
next = tok.Next();
prev = tok.Prev();
if (tok.IsIdentifier() && !next.IsEnd() && prev.IsSemi() && next.IsAssign() && nonbasic.Contains(tok.Value))
{
nonbasic.Remove(tok.Value);
}
tok = tok.Next();
}
if (nonbasic.Count > 0)
{
Program.LogNoLine(funcname + ": nonbasic value-args without assignment found: ");
bool comma = false;
foreach (String s in nonbasic)
{
if (comma)
{
Program.LogNoLine(", ", false);
}
else
{
comma = true;
}
Program.LogNoLine(s, false);
}
Program.Log(".", false);
}
}