Exemplo n.º 1
0
 public static Compilation InitializeCompilationFrom(CompilerArguments args)
 {
     var compilation = Compilation.Create(outputName: args.Output,
                                          syntaxTrees: BuildSyntaxTrees(args),
                                          references: BuildReferences(args),
                                          options: BuildCompilationOptions(args));
     return compilation;
 }
Exemplo n.º 2
0
 private static IEnumerable<SyntaxTree> BuildSyntaxTrees(CompilerArguments args)
 {
     var trees = new List<SyntaxTree>();
     foreach (var file in args.Files)
     {
         trees.Add(SyntaxTree.ParseCompilationUnit(file));
     }
     return trees;
 }
Exemplo n.º 3
0
 private static CompilationOptions BuildCompilationOptions(CompilerArguments args)
 {
     return new CompilationOptions(
                                         assemblyKind:GetAssemblyKindFrom(args.Target),
                                         optimize:args.Optimize,
                                         checkOverflow:args.Checked,
                                         mainTypeName: args.Main
                                  );
 }
Exemplo n.º 4
0
 private static IEnumerable<MetadataReference> BuildReferences(CompilerArguments args)
 {
     return args.References.Select(refer => new AssemblyFileReference(refer));
 }