本文整理汇总了C#中System.Resolver.SetCurClass方法的典型用法代码示例。如果您正苦于以下问题:C# Resolver.SetCurClass方法的具体用法?C# Resolver.SetCurClass怎么用?C# Resolver.SetCurClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Resolver
的用法示例。
在下文中一共展示了Resolver.SetCurClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EvalTacticApplication
private MemberDecl EvalTacticApplication(MemberDecl target, Resolver r) {
Contract.Requires(tcce.NonNull(target));
// initialize new stack for variables
_frame = new Stack<Dictionary<IVariable, Type>>();
var method = target as Method;
if(method != null) {
_state.SetTopLevelClass(method.EnclosingClass?.Name);
_state.TargetMethod = target;
var dict = method.Ins.Concat(method.Outs)
.ToDictionary<IVariable, IVariable, Type>(item => item, item => item.Type);
_frame.Push(dict);
var pre_res = _resultList.Keys.Copy();
SearchBlockStmt(method.Body);
dict = _frame.Pop();
// sanity check
Contract.Assert(_frame.Count == 0);
var new_rets = _resultList.Where(kvp => !pre_res.Contains(kvp.Key)).ToDictionary(i => i.Key, i => i.Value);
Contract.Assert(new_rets.Count != 0);
var body = Util.InsertCode(_state, new_rets);
method.Body.Body.Clear();
if(body != null)
method.Body.Body.AddRange(body.Body);
// use the original resolver of the resoved program, as it contains all the necessary type info
//TODO: how about pre and post ??
method.CallsTactic = false; // set the tactic call lable to be false, no actual consequence
// set the current class in the resolver, so that it can refer to the memberdecl correctly
r.SetCurClass(method.EnclosingClass as ClassDecl);
r.ResolveMethodBody(method);
//Console.WriteLine("Errors: " + _program.reporter.Count(ErrorLevel.Error));
}
return method;
}