Getting a Function Argument List?
Hello!
I am trying to get a list of arguments to the current function unit, as well as their types if possible. I thought I had figured out the rigtht way to do it, but it doesn't seem to be working. I created a new project in C# which is a phase right after typechecking. In the "Execute" method of this phase, I have the following code:
protectedoverridevoid Execute(Phx.Unit unit)
{
if (!unit.IsFunctionUnit)
{
return;
}
Phx.FunctionUnit functionUnit = unit.AsFunctionUnit;
Phx.Collections.FunctionArgumentList args =
functionUnit.FunctionSymbol.FunctionArgumentList;Phx.Types.FunctionType ftype = functionUnit.FunctionSymbol.Type.AsFunctionType;Phx.Collections.FunctionArgumentList.Iterator iter = new Phx.Collections.FunctionArgumentList.Iterator(args);while ( iter.MoveNext() ){ Phx.Symbols.FunctionArgument arg = iter.CurrentValue; System.Console.WriteLine("\tFunction Arg: {0}", arg.NameString);}...
}
This type-checks, but doesn't work. It throws an assertion failure. But in particular, if I step through the execution, I see that the FunctionArgumentList, args, is always null (not an empty list) no matter how many arguments I have the in the function under analysis. Am I going about this the right way?
Thanks,
Nels

