本文整理汇总了C#中System.Resolver.ResolveProgram方法的典型用法代码示例。如果您正苦于以下问题:C# Resolver.ResolveProgram方法的具体用法?C# Resolver.ResolveProgram怎么用?C# Resolver.ResolveProgram使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Resolver
的用法示例。
在下文中一共展示了Resolver.ResolveProgram方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReParse
public Program ReParse(bool runResolver)
{
var errorReporter = new ConsoleErrorReporter();
var module = new LiteralModuleDecl(new DefaultModuleDecl(), null);
var builtIns = new BuiltIns();
var parseErrors = new Errors(errorReporter);
var errorCount = Parser.Parse(_snapshot.GetText(), _filename, _filename, module, builtIns, parseErrors);
var errString = Main.ParseIncludes(module, builtIns, new List<string>(), parseErrors);
if (errorCount != 0 || errString != null) return null;
var program = new Program(_filename, module, builtIns, errorReporter);
if (!runResolver) return program;
var r = new Resolver(program);
r.ResolveProgram(program);
return errorReporter.Count(ErrorLevel.Error) == 0 ? program : null;
}
示例2: ParseAndTypeCheck
bool ParseAndTypeCheck(bool runResolver)
{
Tuple<ITextSnapshot, Dafny.Program, List<DafnyError>> parseResult;
Dafny.Program program;
var errorReporter = new VSErrorReporter(this);
if (_buffer.Properties.TryGetProperty(bufferDafnyKey, out parseResult) &&
(parseResult.Item1 == _snapshot)) {
// already parsed;
program = parseResult.Item2;
_errors = parseResult.Item3;
if (program == null)
runResolver = false;
} else {
Dafny.ModuleDecl module = new Dafny.LiteralModuleDecl(new Dafny.DefaultModuleDecl(), null);
Dafny.BuiltIns builtIns = new Dafny.BuiltIns();
var parseErrors = new Dafny.Errors(errorReporter);
int errorCount = Dafny.Parser.Parse(_snapshot.GetText(), _filename, _filename, module, builtIns, parseErrors);
string errString = Dafny.Main.ParseIncludes(module, builtIns, new List<string>(), parseErrors);
if (errorCount != 0 || errString != null) {
runResolver = false;
program = null;
} else {
program = new Dafny.Program(_filename, module, builtIns, errorReporter);
}
_buffer.Properties[bufferDafnyKey] = new Tuple<ITextSnapshot, Dafny.Program, List<DafnyError>>(_snapshot, program, _errors);
}
if (!runResolver) {
return false;
}
var r = new Resolver(program);
r.ResolveProgram(program);
if (errorReporter.Count(ErrorLevel.Error) != 0)
return false;
_program = program;
return true; // success
}
示例3: ParseAndTypeCheck
bool ParseAndTypeCheck()
{
Dafny.ModuleDecl module = new Dafny.LiteralModuleDecl(new Dafny.DefaultModuleDecl(), null);
Dafny.BuiltIns builtIns = new Dafny.BuiltIns();
var errorReporter = new VSErrorReporter(this);
var parseErrors = new Dafny.Errors(errorReporter);
int errorCount = Dafny.Parser.Parse(_snapshot.GetText(), _filename, _filename, module, builtIns, parseErrors);
string errString = Dafny.Main.ParseIncludes(module, builtIns, new List<string>(), parseErrors);
if (errorCount != 0 || errString != null)
return false;
Dafny.Program program = new Dafny.Program(_filename, module, builtIns, errorReporter);
var r = new Resolver(program);
r.ResolveProgram(program);
if (errorReporter.Count(ErrorLevel.Error) != 0)
return false;
_program = program;
return true; // success
}