static void RunRTAOnSource(string source, RTAResultDelegate runDelegate) { RunRTAOnSources(new string[] { source }, runDelegate); }
static void RunRTAOnSources(string[] sources, RTAResultDelegate runDelegate) { //The last source in the array must have the Main entrypoint CompileSourcesAndRun(sources, ".exe", compilerResult => { var mainAssembly = compilerResult.MainAssembly; WholeProgram wholeProgram = new WholeProgram(new IAssembly[] { compilerResult.MainAssembly }, compilerResult.Host); var rta = new RapidTypeAnalysis(wholeProgram, TargetProfile.Desktop); rta.Run(new IMethodDefinition[1] { mainAssembly.EntryPoint.ResolvedMethod }); runDelegate(compilerResult, rta); }); }
static void RunRTAOnSourceResource(string sourceResourceName, RTAResultDelegate runDelegate) { // This step unfortunately loses the *name* of the resource, which would // perhaps be helpful for error messages. string resourceAsString = ExtractResourceToString(sourceResourceName); RunRTAOnSource(resourceAsString, runDelegate); }