internal void CreateEnumerateScriptsSymbol(DiagnosticBag diagnostic)
{
var method = this.ScriptType.EnumerateScriptsSymbol;
var files = this.Compilation.SourceSymbolTables.GetFiles();
// void (Action<string, RuntimeMethodHandle> callback)
var body = MethodGenerator.GenerateMethodBody(this, method,
(il) =>
{
var action_string_method = method.Parameters[0].Type;
Debug.Assert(action_string_method.Name == "Action");
var invoke = action_string_method.DelegateInvokeMethod();
Debug.Assert(invoke != null);
foreach (var f in files)
{
// callback.Invoke(f.Name, f)
il.EmitLoadArgumentOpcode(0);
il.EmitStringConstant(f.RelativeFilePath);
il.EmitLoadToken(this, diagnostic, f.MainMethod, null);
il.EmitCall(this, diagnostic, ILOpCode.Callvirt, invoke);
}
//
il.EmitRet(true);
},
null, diagnostic, false);
SetMethodBody(method, body);
}