本文整理汇总了C#中System.Resolver.PopVar方法的典型用法代码示例。如果您正苦于以下问题:C# Resolver.PopVar方法的具体用法?C# Resolver.PopVar怎么用?C# Resolver.PopVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Resolver
的用法示例。
在下文中一共展示了Resolver.PopVar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Resolve
public static void Resolve(Resolver resolver, Program program)
{
try
{
foreach (ModuleDefinition module in program.Modules)
{
foreach (TopLevelDecl decl in module.TopLevelDecls)
{
DatatypeDecl data = decl as DatatypeDecl;
if (data != null)
{
foreach (var ctor in data.Ctors)
{
resolver.PushGhost();
data.TypeArgs.ForEach(p => resolver.PushTypeParam(p));
ctor.Formals.ForEach(f => f.Resolve(resolver));
data.TypeArgs.ForEach(p => resolver.PopTypeParam(p));
resolver.PopGhost();
}
}
}
}
foreach (MemberDecl member in ClassDecl.TheClass.Members)
{
Field field = member as Field;
Function fun = member as Function;
Method method = member as Method;
if (field != null)
{
if (field.IsGhost) { resolver.PushGhost(); }
field.Type.Resolve(resolver);
if (field.IsGhost) { resolver.PopGhost(); }
}
if (fun != null)
{
resolver.currentFunction = fun;
resolver.PushGhost();
fun.TypeArgs.ForEach(p => resolver.PushTypeParam(p));
fun.Formals.ForEach(x => { x.Resolve(resolver); });
fun.ResultType.Resolve(resolver);
fun.TypeArgs.ForEach(p => resolver.PopTypeParam(p));
resolver.PopGhost();
resolver.currentFunction = null;
}
if (method != null)
{
resolver.currentMethod = method;
if (method.IsGhost) { resolver.PushGhost(); }
method.TypeArgs.ForEach(p => resolver.PushTypeParam(p));
method.Formals.ForEach(x => { x.Resolve(resolver); });
method.Outs.ForEach(x => { x.Resolve(resolver); });
method.TypeArgs.ForEach(p => resolver.PopTypeParam(p));
if (method.IsGhost) { resolver.PopGhost(); }
resolver.currentMethod = null;
}
}
foreach (MemberDecl member in ClassDecl.TheClass.Members)
{
Function fun = member as Function;
Method method = member as Method;
if (fun != null)
{
resolver.currentFunction = fun;
resolver.PushGhost();
fun.TypeArgs.ForEach(p => resolver.PushTypeParam(p));
fun.Formals.ForEach(x => { resolver.PushVar(x.Name, x.Type, true); });
fun.ResultType.Resolve(resolver);
fun.Req = fun.Req.ConvertAll(e => e.Resolve(resolver, Type.Bool));
fun.Ens = fun.Ens.ConvertAll(e => e.Resolve(resolver, Type.Bool));
fun.Decreases.Resolve(resolver);
if (fun.Body != null) { fun.Body = fun.Body.Resolve(resolver, fun.ResultType); }
if (fun.IsRecursive && fun.Decreases.Expressions.Count == 0)
{
fun.Decreases.Expressions.Add(new IdentifierExpr(Token.NoToken, fun.Formals[0].Name));
fun.Decreases.Resolve(resolver);
}
fun.Formals.ForEach(x => resolver.PopVar(x.Name));
fun.TypeArgs.ForEach(p => resolver.PopTypeParam(p));
resolver.PopGhost();
resolver.currentFunction = null;
}
if (method != null)
{
resolver.currentMethod = method;
if (method.IsGhost) { resolver.PushGhost(); }
method.TypeArgs.ForEach(p => resolver.PushTypeParam(p));
method.Formals.ForEach(x => { resolver.PushVar(x.Name, x.Type, true); });
method.Req.ForEach(e => e.Resolve(resolver));
method.Outs.ForEach(x => { resolver.PushVar(x.Name, x.Type, true); });
method.Ens.ForEach(e => e.Resolve(resolver));
method.Decreases.Resolve(resolver);
method.Outs.ForEach(x => resolver.PopVar(x.Name));
method.Formals.ForEach(x => resolver.PopVar(x.Name));
method.TypeArgs.ForEach(p => resolver.PopTypeParam(p));
if (method.IsGhost) { resolver.PopGhost(); }
resolver.currentMethod = null;
}
}
}
catch (Exception e)
//.........这里部分代码省略.........