Beispiel #1
0
 public HxlCompilerResultsAdapter(CompilerResults results)
 {
     _results = results;
     _errors  = new HxlCompilerErrorCollection();
     foreach (CompilerError error in results.Errors)
     {
         _errors.AddNew(error.ErrorNumber,
                        error.ErrorText,
                        error.FileName,
                        error.Column,
                        error.Line,
                        error.IsWarning);
     }
     _output = _results.Output.Cast <string>().ToList();
 }
Beispiel #2
0
 public static void LogCompilerErrors(this IHxlcLogger log, HxlCompilerErrorCollection errors)
 {
     foreach (var e in errors)
     {
         var str = e.ToString();
         if (e.IsWarning)
         {
             log.Warn(str);
         }
         else
         {
             log.Error(str);
         }
     }
 }
Beispiel #3
0
 public HxlCompilerResultsAdapter(string pathToAssembly, EmitResult results)
 {
     _results = results;
     _errors  = new HxlCompilerErrorCollection();
     foreach (var error in results.Diagnostics)
     {
         var mapped = error.Location.GetMappedLineSpan();
         var loc    = mapped.StartLinePosition;
         _errors.AddNew(error.Descriptor.Id,
                        error.GetMessage(CultureInfo.CurrentCulture),
                        mapped.Path,
                        loc.Character,
                        loc.Line,
                        error.Severity != DiagnosticSeverity.Error);
     }
     _output         = Empty <string> .List;
     _pathToAssembly = pathToAssembly;
 }