本文整理匯總了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
}