//-----------------------------------------------
// Entry
//-----------------------------------------------
/// <summary>
/// Visits the specified QilExpression graph and generates MSIL code.
/// </summary>
public void Visit(QilExpression qil, GenerateHelper helper, MethodInfo methRoot)
{
_qil = qil;
_helper = helper;
_iterNested = null;
_indexId = 0;
// Prepare each global parameter and global variable to be visited
PrepareGlobalValues(qil.GlobalParameterList);
PrepareGlobalValues(qil.GlobalVariableList);
// Visit each global parameter and global variable
VisitGlobalValues(qil.GlobalParameterList);
VisitGlobalValues(qil.GlobalVariableList);
// Build each function
foreach (QilFunction ndFunc in qil.FunctionList)
{
// Visit each parameter and the function body
Function(ndFunc);
}
// Build the root expression
_helper.MethodBegin(methRoot, null, true);
StartNestedIterator(qil.Root);
Visit(qil.Root);
Debug.Assert(_iterCurr.Storage.Location == ItemLocation.None, "Root expression should have been pushed to the writer.");
EndNestedIterator(qil.Root);
_helper.MethodEnd();
}