public CompilerResults Compile()
        {
            var exitval = DafnyDriver.ProcessCommandLineArguments(CompilationArgs, out var dafnyFiles, out var otherFiles);

            if (!PerformPreliminaryChecks(exitval, out var errorneousCompileResults))
            {
                return(errorneousCompileResults);
            }

            TextWriter tw = new StringWriter();

            Type.ResetScopes();
            int oldErrorCount = Dp.reporter.Count(ErrorLevel.Error);

            DafnyDriver.CompileDafnyProgram(Dp, Path, otherFiles.AsReadOnly(), true, tw);
            int newErrorCount = Dp.reporter.Count(ErrorLevel.Error);

            if (oldErrorCount != newErrorCount)
            {
                return(ExtractError(oldErrorCount));
            }

            bool hasMain = new Microsoft.Dafny.CsharpCompiler(Dp.reporter).HasMain(Dp, out _);

            return(new CompilerResults
            {
                Error = false,
                Executable = hasMain,
                Message = tw.ToString().TrimEnd('\r', '\n')
            });
        }
Ejemplo n.º 2
0
        public Program getProgram(string filename)
        {
            Program          dafnyProgram = null;
            List <DafnyFile> dafnyFiles;
            List <string>    otherFiles;

            string[] args = new string[] { filename };
            DafnyDriver.ProcessCommandLineArguments(args, out dafnyFiles, out otherFiles);
            ErrorReporter reporter = new ConsoleErrorReporter();
            string        s        = Microsoft.Dafny.Main.ParseCheck(dafnyFiles, "", reporter, out dafnyProgram);

            return(dafnyProgram);
        }
Ejemplo n.º 3
0
      public VSResolver(Dafny.Program program, DafnyDriver dd)
        : base(program) {
        this.dd = dd;

        AdditionalInformationReporter =
          (addinfo)
            =>
            {
              if (!_additionalInformation.ContainsKey(addinfo.Token)) {
                _additionalInformation.Add(addinfo.Token, new HashSet<AdditionalInformation>());
              }
              _additionalInformation[addinfo.Token].Add(addinfo);
            };
      }
Ejemplo n.º 4
0
 public VSErrorReporter(DafnyDriver dd)
 {
     this.dd = dd;
 }
Ejemplo n.º 5
0
 public VSErrors(DafnyDriver dd) {
   this.dd = dd;
 }