當前位置: 首頁>>代碼示例>>C#>>正文


C# Resolver.PopGhost方法代碼示例

本文整理匯總了C#中System.Resolver.PopGhost方法的典型用法代碼示例。如果您正苦於以下問題:C# Resolver.PopGhost方法的具體用法?C# Resolver.PopGhost怎麽用?C# Resolver.PopGhost使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Resolver的用法示例。


在下文中一共展示了Resolver.PopGhost方法的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.PopGhost方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。