本文整理汇总了C#中ISemanticResolver.SetCurrentClass方法的典型用法代码示例。如果您正苦于以下问题:C# ISemanticResolver.SetCurrentClass方法的具体用法?C# ISemanticResolver.SetCurrentClass怎么用?C# ISemanticResolver.SetCurrentClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISemanticResolver
的用法示例。
在下文中一共展示了ISemanticResolver.SetCurrentClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResolveMemberDecls
// Resolve the members (fields & methods)
public override void ResolveMemberDecls(
ISemanticResolver s,
ICLRtypeProvider provider
)
{
// If we've already been resolved, then skip
if (this.Symbol.MemberScope.IsLocked)
return;
// We need our base types to have resolved members so that we can
// do inheritence checks.
FixBaseMemberDecls(s, provider);
// Setup our context to do evaluation
Scope prev = s.SetCurrentContext(m_symbol.MemberScope);
s.SetCurrentClass(m_symbol);
// Add our members to our scope
{
// Do events first because they generate methods & fields
FixEvents(s, provider);
if (!IsInterface)
this.FixFields(s, provider);
// Resolve properties before methods, since properties create methods
foreach(PropertyDecl p in m_alProperties)
{
p.ResolveMember(m_symbol, s, provider);
}
// This can change both the normal methods as well as accessor methods on properties.
FixMethods(s, provider);
// Set property symbols after we've touched up the methods.
foreach(PropertyDecl p in m_alProperties)
{
p.Symbol.SetInfo(provider);
}
PostFixEvents(s, provider);
// Nested types
foreach(TypeDeclBase t in this.m_alNestedTypes)
{
t.ResolveMemberDecls(s, provider);
}
// If we have no ctor at all, then add a default one.
// (default ctor - takes no parameters, chains to base's default ctor)
if (!IsInterface)
FixCtors(s, provider);
// We're done adding to the scope, so lock it.
m_symbol.MemberScope.LockScope();
}
s.SetCurrentClass(null);
s.RestoreContext(prev);
}
示例2: ResolveBodies
// Resolve the bodies of methods
public override void ResolveBodies(ISemanticResolver s)
{
Scope scope = m_symbol.MemberScope;
//s.PushScope(scope);
Scope prev = s.SetCurrentContext(scope);
s.SetCurrentClass(m_symbol);
foreach(MethodDecl m in m_alMethods)
{
m.ResolveBodies(s);
}
foreach(PropertyDecl p in m_alProperties)
{
p.ResolveBodies(s);
}
// Nested
foreach(TypeDeclBase t in this.m_alNestedTypes)
{
t.ResolveBodies(s);
}
s.SetCurrentClass(null);
//s.PopScope(scope);
s.RestoreContext(prev);
}
示例3: ResolveTypesAsBlueStub
// Semantic checking
// Stubs can be resolved in any order.
public override void ResolveTypesAsBlueStub(
ISemanticResolver s,
string stNamespace,
Scope scopeParent
)
{
// Get our name. Nested classes are separated with a '+'
// Namespaces are separated with a '.'
string stFullName = (stNamespace == "") ?
(m_strName) :
(stNamespace + "." + m_strName);
// Are we a nested class?
if (scopeParent.Node is ClassDecl)
{
Debug.Assert(stNamespace != "");
stFullName = stNamespace + "+" + m_strName;
}
// Create a stub sym entry to add to current scope
m_symbol = new TypeEntry(stFullName, this, m_genre, scopeParent);
scopeParent.AddSymbol(m_symbol);
// Stub on nested types
//s.PushScope(m_symbol.MemberScope);
// Our context is the same as the scope on our symbol
Scope context = m_symbol.MemberScope;
Debug.Assert(context != null);
s.SetCurrentClass(m_symbol);
foreach(TypeDeclBase t in this.m_alNestedTypes)
{
t.ResolveTypesAsBlueStub(s, stFullName, context);
}
s.SetCurrentClass(null);
//s.PopScope(m_symbol.MemberScope);
}