本文整理汇总了C#中IMethod.GetOwner方法的典型用法代码示例。如果您正苦于以下问题:C# IMethod.GetOwner方法的具体用法?C# IMethod.GetOwner怎么用?C# IMethod.GetOwner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMethod
的用法示例。
在下文中一共展示了IMethod.GetOwner方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldExportMethod
protected bool ShouldExportMethod(IMethod mde)
{
var ret = !mde.IsExplicitInterfaceImplementation;
if (Sk.NewInterfaceImplementation) ret = true;
if (!Sk.NewInterfaceImplementation)
{
var body = mde.GetDeclarationBody();
if (body == null || body.IsNull)
ret = false;
}
if (mde.IsAutomaticAccessor())
ret = false;
if (mde.GetOwner() != null)
return false;
var att = mde.GetMetadata<JsMethodAttribute>();
if (att != null && !att.Export)
return false;
return ret;
}
示例2: ExportMethodBody
protected JsBlock ExportMethodBody(IMethod me)
{
if (CompilerConfiguration.Current.EnableLogging)
{
Log.Debug("JsTypeImporter: Visit Method: " + me.ToString());
}
var nativeCode = Sk.GetNativeCode(me);
if (nativeCode != null)
{
var block = Js.Block().Add(Js.CodeStatement(nativeCode)); //TODO: double semicolon?
return block;
}
var def = me.GetDefinition();
if (def == null || def.IsNull)
{
if (me.IsAutomaticEventAccessor())
{
if (me.IsEventAddAccessor())
{
var node = GenerateAutomaticEventAccessor((IEvent)me.GetOwner(), false);
return node.Block;
}
else if (me.IsEventRemoveAccessor())
{
var node = GenerateAutomaticEventAccessor((IEvent)me.GetOwner(), true);
return node.Block;
}
}
else if (me.IsAutomaticPropertyAccessor())
{
var bf = Js.Member("_" + SkJs.GetEntityJsName(me.AccessorOwner));
if (!me.IsStatic)
bf.PreviousMember = Js.This();
else if (!Sk.IsGlobalMethod(me))
bf.PreviousMember = SkJs.EntityToMember(me.DeclaringTypeDefinition);
if (me.IsGetter())
return Js.Block().Add(Js.Return(bf));
else
return Js.Block().Add(bf.Assign(Js.Member("value")).Statement());
}
return null;
}
var block2 = (JsBlock)AstNodeConverter.Visit(def);
if (def.Descendants.OfType<YieldReturnStatement>().FirstOrDefault() != null)
{
if (!AstNodeConverter.SupportClrYield)
{
if (block2.Statements == null)
block2.Statements = new List<JsStatement>();
block2.Statements.Insert(0, Js.Var("$yield", Js.NewJsonArray()).Statement());
block2.Statements.Add(AstNodeConverter.GenerateYieldReturnStatement(me));
}
}
return block2;
}