本文整理汇总了C#中Mono.CSharp.MethodData.Define方法的典型用法代码示例。如果您正苦于以下问题:C# MethodData.Define方法的具体用法?C# MethodData.Define怎么用?C# MethodData.Define使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.MethodData
的用法示例。
在下文中一共展示了MethodData.Define方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Define
public override MethodBuilder Define (TypeContainer parent)
{
parameters.Resolve (this);
base.Define (parent);
Spec = new MethodSpec (MemberKind.Method, parent.PartialContainer.Definition, this, ReturnType, ParameterInfo, ModFlags);
method_data = new MethodData (method, ModFlags, flags, this);
if (!method_data.Define (parent.PartialContainer, method.GetFullName (MemberName)))
return null;
method_data.DefineMethodBuilder (parent.PartialContainer, ParameterInfo);
return method_data.MethodBuilder;
}
示例2: Define
public override bool Define ()
{
if (!base.Define ())
return false;
if (!CheckBase ())
return false;
MemberKind kind;
if (this is Operator)
kind = MemberKind.Operator;
else if (this is Destructor)
kind = MemberKind.Destructor;
else
kind = MemberKind.Method;
string explicit_name;
if (IsPartialDefinition) {
caching_flags &= ~Flags.Excluded_Undetected;
caching_flags |= Flags.Excluded;
// Add to member cache only when a partial method implementation has not been found yet
if ((caching_flags & Flags.PartialDefinitionExists) != 0)
return true;
if (IsExplicitImpl)
return true;
explicit_name = null;
} else {
MethodData = new MethodData (this, ModFlags, flags, this, base_method);
if (!MethodData.Define (Parent.PartialContainer, GetFullName (MemberName)))
return false;
explicit_name = MethodData.MetadataName;
}
spec = new MethodSpec (kind, Parent.Definition, this, ReturnType, parameters, ModFlags);
if (MemberName.Arity > 0)
spec.IsGeneric = true;
Parent.MemberCache.AddMember (this, explicit_name, spec);
return true;
}
示例3: Define
public override MethodBuilder Define (DeclSpace parent)
{
parameters.Resolve (this);
base.Define (parent);
Spec = new MethodSpec (MemberKind.Method, parent.PartialContainer.Definition, this, ReturnType, null, ParameterInfo, ModFlags);
method_data = new MethodData (method, ModFlags, flags, this);
if (!method_data.Define (parent, method.GetFullName (MemberName), Report))
return null;
Spec.SetMetaInfo (method_data.MethodBuilder);
return method_data.MethodBuilder;
}
示例4: Define
public override bool Define ()
{
if (!base.Define ())
return false;
if (!CheckBase ())
return false;
MemberKind kind;
if (this is Operator)
kind = MemberKind.Operator;
else if (this is Destructor)
kind = MemberKind.Destructor;
else
kind = MemberKind.Method;
if (IsPartialDefinition) {
caching_flags &= ~Flags.Excluded_Undetected;
caching_flags |= Flags.Excluded;
// Add to member cache only when a partial method implementation has not been found yet
if ((caching_flags & Flags.PartialDefinitionExists) == 0) {
// MethodBase mb = new PartialMethodDefinitionInfo (this);
spec = new MethodSpec (kind, Parent.Definition, this, ReturnType, null, parameters, ModFlags);
if (MemberName.Arity > 0) {
spec.IsGeneric = true;
// TODO: Have to move DefineMethod after Define (ideally to Emit)
throw new NotImplementedException ("Generic partial methods");
}
Parent.MemberCache.AddMember (spec);
}
return true;
}
MethodData = new MethodData (
this, ModFlags, flags, this, MethodBuilder, base_method);
if (!MethodData.Define (Parent.PartialContainer, GetFullName (MemberName)))
return false;
MethodBuilder = MethodData.MethodBuilder;
spec = new MethodSpec (kind, Parent.Definition, this, ReturnType, MethodBuilder, parameters, ModFlags);
if (MemberName.Arity > 0)
spec.IsGeneric = true;
Parent.MemberCache.AddMember (this, MethodBuilder.Name, spec);
return true;
}
示例5: Define
public virtual MethodBuilder Define (DeclSpace parent)
{
// Fill in already resolved event type to speed things up and
// avoid confusing duplicate errors
((Parameter) parameters.FixedParameters[0]).Type = method.member_type;
parameters.Types = new TypeSpec[] { method.member_type };
method_data = new MethodData (method, method.ModFlags,
method.flags | MethodAttributes.HideBySig | MethodAttributes.SpecialName, this);
if (!method_data.Define (parent, method.GetFullName (MemberName), Report))
return null;
MethodBuilder mb = method_data.MethodBuilder;
Spec = new MethodSpec (MemberKind.Method, parent.PartialContainer.Definition, this, ReturnType, mb, ParameterInfo, method.ModFlags);
Spec.IsAccessor = true;
return mb;
}
示例6: Define
public override void Define (TypeContainer parent)
{
base.Define (parent);
Spec = new MethodSpec (MemberKind.Method, parent.PartialContainer.Definition, this, ReturnType, ParameterInfo, ModFlags);
method_data = new MethodData (method, ModFlags, flags, this);
method_data.Define (parent.PartialContainer, method.GetFullName (MemberName));
}
示例7: Define
public override bool Define (TypeContainer parent)
{
EventAttributes e_attr = EventAttributes.RTSpecialName | EventAttributes.SpecialName;
if (!DoDefine (parent))
return false;
if (init != null && ((ModFlags & Modifiers.ABSTRACT) != 0)){
Report.Error (74, Location, "'" + parent.Name + "." + Name +
"': abstract event can not have an initializer");
return false;
}
if (!MemberType.IsSubclassOf (TypeManager.delegate_type)) {
Report.Error (66, Location, "'" + parent.Name + "." + Name +
"' : event must be of a delegate type");
return false;
}
Type [] parameter_types = new Type [1];
parameter_types [0] = MemberType;
Parameter [] parms = new Parameter [1];
parms [0] = new Parameter (Type, "value", Parameter.Modifier.NONE, null);
InternalParameters ip = new InternalParameters (
parent, new Parameters (parms, null, Location));
if (!CheckBase (parent))
return false;
//
// Now define the accessors
//
AddData = new MethodData (this, "add", TypeManager.void_type,
parameter_types, ip, CallingConventions.Standard,
(Add != null) ? Add.OptAttributes : null,
ModFlags, flags, false);
if (!AddData.Define (parent))
return false;
AddBuilder = AddData.MethodBuilder;
AddBuilder.DefineParameter (1, ParameterAttributes.None, "value");
RemoveData = new MethodData (this, "remove", TypeManager.void_type,
parameter_types, ip, CallingConventions.Standard,
(Remove != null) ? Remove.OptAttributes : null,
ModFlags, flags, false);
if (!RemoveData.Define (parent))
return false;
RemoveBuilder = RemoveData.MethodBuilder;
RemoveBuilder.DefineParameter (1, ParameterAttributes.None, "value");
if (!IsExplicitImpl){
EventBuilder = new MyEventBuilder (this,
parent.TypeBuilder, Name, e_attr, MemberType);
if (Add == null && Remove == null) {
FieldBuilder = parent.TypeBuilder.DefineField (
Name, MemberType,
FieldAttributes.Private | ((ModFlags & Modifiers.STATIC) != 0 ? FieldAttributes.Static : 0));
TypeManager.RegisterPrivateFieldOfEvent (
(EventInfo) EventBuilder, FieldBuilder);
TypeManager.RegisterFieldBase (FieldBuilder, this);
}
EventBuilder.SetAddOnMethod (AddBuilder);
EventBuilder.SetRemoveOnMethod (RemoveBuilder);
if (!TypeManager.RegisterEvent (EventBuilder, AddBuilder, RemoveBuilder)) {
Report.Error (111, Location,
"Class `" + parent.Name +
"' already contains a definition for the event `" +
Name + "'");
return false;
}
}
return true;
}
示例8: Define
public virtual MethodBuilder Define (DeclSpace parent)
{
method_data = new MethodData (method, method.ModFlags,
method.flags | MethodAttributes.HideBySig | MethodAttributes.SpecialName, this);
if (!method_data.Define (parent, method.GetFullName (MemberName), Report))
return null;
MethodBuilder mb = method_data.MethodBuilder;
ParameterInfo.ApplyAttributes (mb);
return mb;
}