private static void Compile(string fileName) { HostEnvironment hostEnvironment = new HostEnvironment(); IName name = hostEnvironment.NameTable.GetNameFor(fileName); IDictionary<string, string> options = new Dictionary<string, string>(); List<IAssemblyReference> assemblyReferences = new List<IAssemblyReference>(); List<IModuleReference> moduleReferences = new List<IModuleReference>(); assemblyReferences.Add(hostEnvironment.LoadAssembly(hostEnvironment.CoreAssemblySymbolicIdentity)); assemblyReferences.Add((IAssembly)hostEnvironment.LoadUnitFrom(typeof(Microsoft.SmallBasic.Library.ConsoleWindow).Assembly.Location)); StreamReader instream = File.OpenText(fileName); List<SmallBasicDocument> programSources = new List<SmallBasicDocument>(1); SmallBasicAssembly assem = new SmallBasicAssembly(name, Path.GetFullPath(fileName), hostEnvironment, options, assemblyReferences, moduleReferences, programSources); SmallBasicCompilationHelper helper = new SmallBasicCompilationHelper(assem.Compilation); programSources.Add(new SmallBasicDocument(helper, name, Path.GetFullPath(fileName), instream)); var exeFile = File.Create(Path.ChangeExtension(fileName, "exe")); var sourceLocationProvider = assem.Compilation.SourceLocationProvider; //var localScopeProvider = assem.Compilation.LocalScopeProvider; using (var pdbWriter = new PdbWriter(Path.ChangeExtension(fileName, "pdb"), sourceLocationProvider)) { PeWriter.WritePeToStream(assem, hostEnvironment, exeFile, sourceLocationProvider, null, pdbWriter); } }
internal SmallBasicCompilationPart(SmallBasicCompilationHelper helper, SmallBasicCompilationPart template) : base(helper, template) { }
private static void RunTest(HostEnvironment hostEnvironment, string suiteName, string test, StringBuilder actualOutput, List<string> compilerParameters, List<string> testCaseParameters) { IName name = hostEnvironment.NameTable.GetNameFor(suiteName); IDictionary<string, string> options = new Dictionary<string, string>(); List<IAssemblyReference> assemblyReferences = new List<IAssemblyReference>(); List<IModuleReference> moduleReferences = new List<IModuleReference>(); assemblyReferences.Add(hostEnvironment.LoadAssembly(hostEnvironment.CoreAssemblySymbolicIdentity)); assemblyReferences.Add((IAssembly)hostEnvironment.LoadUnitFrom(typeof(Microsoft.SmallBasic.Library.ConsoleWindow).Assembly.Location)); SmallBasicAssembly/*?*/ assem = null; SmallBasicCompilationHelper helper; List<SmallBasicDocument> programSources = new List<SmallBasicDocument>(1); assem = new SmallBasicAssembly(name, "", hostEnvironment, options, assemblyReferences, moduleReferences, programSources); helper = new SmallBasicCompilationHelper(assem.Compilation); programSources.Add(/*hostEnvironment.previousDocument = */new SmallBasicDocument(helper, name, "", test)); var memStream = new MemoryStream(); PeWriter.WritePeToStream(assem, hostEnvironment, memStream); var runtimeAssembly = System.Reflection.Assembly.Load(memStream.ToArray()); runtimeAssembly.EntryPoint.Invoke(null, null); }
internal SmallBasicCompilationPart(SmallBasicCompilationHelper helper, ISourceLocation sourceLocation) : base(helper, sourceLocation) // ^ requires sourceLocation.SourceDocument is SpecSharpDocument; { }
private SmallBasicDocument(SmallBasicCompilationHelper helper, string text, SourceDocument previousVersion, int position, int oldLength, int newLength) : base(text, previousVersion, position, oldLength, newLength) { this.helper = helper; }
public SmallBasicDocument(SmallBasicCompilationHelper helper, IName name, string location, string text) : base(name, location, text) { this.helper = helper; }
public SmallBasicDocument(SmallBasicCompilationHelper helper, IName name, string location, System.IO.StreamReader streamReader) : base(name, location, streamReader) { this.helper = helper; }
private SmallBasicCompilationHelper(Compilation targetCompilation, SmallBasicCompilationHelper template) : base(targetCompilation, template) { }