当前位置: 首页>>代码示例>>C#>>正文


C# Resolver.PopTypeParam方法代码示例

本文整理汇总了C#中System.Resolver.PopTypeParam方法的典型用法代码示例。如果您正苦于以下问题:C# Resolver.PopTypeParam方法的具体用法?C# Resolver.PopTypeParam怎么用?C# Resolver.PopTypeParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Resolver的用法示例。


在下文中一共展示了Resolver.PopTypeParam方法的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)
//.........这里部分代码省略.........
开发者ID:jango2015,项目名称:Ironclad,代码行数:101,代码来源:ParseMain.cs


注:本文中的System.Resolver.PopTypeParam方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。