本文整理汇总了C#中Mono.CSharp.ReturnParameter类的典型用法代码示例。如果您正苦于以下问题:C# ReturnParameter类的具体用法?C# ReturnParameter怎么用?C# ReturnParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReturnParameter类属于Mono.CSharp命名空间,在下文中一共展示了ReturnParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyAttributeBuilder
public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
{
if (a.Target == AttributeTargets.ReturnValue) {
if (return_attributes == null)
return_attributes = new ReturnParameter (InvokeBuilder, Location);
return_attributes.ApplyAttributeBuilder (a, cb, pa);
return;
}
base.ApplyAttributeBuilder (a, cb, pa);
}
示例2: ApplyAttributeBuilder
public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa)
{
if (a.Target == AttributeTargets.ReturnValue) {
if (return_attributes == null)
return_attributes = new ReturnParameter (this, InvokeBuilder.MethodBuilder, Location);
return_attributes.ApplyAttributeBuilder (a, ctor, cdata, pa);
return;
}
base.ApplyAttributeBuilder (a, ctor, cdata, pa);
}
示例3: Emit
public virtual void Emit (TypeDefinition parent)
{
method_data.Emit (parent);
if ((ModFlags & Modifiers.COMPILER_GENERATED) != 0 && !Parent.IsCompilerGenerated)
Module.PredefinedAttributes.CompilerGenerated.EmitAttribute (method_data.MethodBuilder);
if (((ModFlags & Modifiers.DEBUGGER_HIDDEN) != 0))
Module.PredefinedAttributes.DebuggerHidden.EmitAttribute (method_data.MethodBuilder);
if (ReturnType.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
return_attributes = new ReturnParameter (this, method_data.MethodBuilder, Location);
Module.PredefinedAttributes.Dynamic.EmitAttribute (return_attributes.Builder);
} else if (ReturnType.HasDynamicElement) {
return_attributes = new ReturnParameter (this, method_data.MethodBuilder, Location);
Module.PredefinedAttributes.Dynamic.EmitAttribute (return_attributes.Builder, ReturnType, Location);
}
if (OptAttributes != null)
OptAttributes.Emit ();
if (declarative_security != null) {
foreach (var de in declarative_security) {
#if STATIC
method_data.MethodBuilder.__AddDeclarativeSecurity (de);
#else
method_data.MethodBuilder.AddDeclarativeSecurity (de.Key, de.Value);
#endif
}
}
block = null;
}
示例4: ApplyAttributeBuilder
public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa)
{
if (a.Type == pa.CLSCompliant || a.Type == pa.Obsolete || a.Type == pa.Conditional) {
Report.Error (1667, a.Location,
"Attribute `{0}' is not valid on property or event accessors. It is valid on `{1}' declarations only",
a.Type.GetSignatureForError (), a.GetValidTargets ());
return;
}
if (a.IsValidSecurityAttribute ()) {
a.ExtractSecurityPermissionSet (ctor, ref declarative_security);
return;
}
if (a.Target == AttributeTargets.Method) {
method_data.MethodBuilder.SetCustomAttribute ((ConstructorInfo) ctor.GetMetaInfo (), cdata);
return;
}
if (a.Target == AttributeTargets.ReturnValue) {
if (return_attributes == null)
return_attributes = new ReturnParameter (this, method_data.MethodBuilder, Location);
return_attributes.ApplyAttributeBuilder (a, ctor, cdata, pa);
return;
}
ApplyToExtraTarget (a, ctor, cdata, pa);
}
示例5: Emit
public override void Emit ()
{
base.Emit ();
if (declarative_security != null) {
foreach (var de in declarative_security) {
#if STATIC
TypeBuilder.__AddDeclarativeSecurity (de);
#else
TypeBuilder.AddDeclarativeSecurity (de.Key, de.Value);
#endif
}
}
if (ReturnType.Type != null) {
if (ReturnType.Type.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
return_attributes = new ReturnParameter (this, InvokeBuilder.MethodBuilder, Location);
Module.PredefinedAttributes.Dynamic.EmitAttribute (return_attributes.Builder);
} else if (ReturnType.Type.HasDynamicElement) {
return_attributes = new ReturnParameter (this, InvokeBuilder.MethodBuilder, Location);
Module.PredefinedAttributes.Dynamic.EmitAttribute (return_attributes.Builder, ReturnType.Type, Location);
}
ConstraintChecker.Check (this, ReturnType.Type, ReturnType.Location);
}
Constructor.ParameterInfo.ApplyAttributes (this, Constructor.ConstructorBuilder);
Constructor.ConstructorBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
parameters.CheckConstraints (this);
parameters.ApplyAttributes (this, InvokeBuilder.MethodBuilder);
InvokeBuilder.MethodBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
if (BeginInvokeBuilder != null) {
BeginInvokeBuilder.ParameterInfo.ApplyAttributes (this, BeginInvokeBuilder.MethodBuilder);
EndInvokeBuilder.ParameterInfo.ApplyAttributes (this, EndInvokeBuilder.MethodBuilder);
BeginInvokeBuilder.MethodBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
EndInvokeBuilder.MethodBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
}
}
示例6: ApplyAttributeBuilder
public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa)
{
if (a.Target == AttributeTargets.ReturnValue) {
if (return_attributes == null)
return_attributes = new ReturnParameter (this, InvokeBuilder.MethodBuilder, Location);
return_attributes.ApplyAttributeBuilder (a, ctor, cdata, pa);
return;
}
if (a.IsValidSecurityAttribute ()) {
a.ExtractSecurityPermissionSet (ctor, ref declarative_security);
return;
}
base.ApplyAttributeBuilder (a, ctor, cdata, pa);
}
示例7: Emit
public override void Emit ()
{
if ((ModFlags & Modifiers.COMPILER_GENERATED) != 0 && !Parent.IsCompilerGenerated)
Compiler.PredefinedAttributes.CompilerGenerated.EmitAttribute (MethodBuilder);
if ((ModFlags & Modifiers.DEBUGGER_HIDDEN) != 0)
Compiler.PredefinedAttributes.DebuggerHidden.EmitAttribute (MethodBuilder);
if (ReturnType == InternalType.Dynamic) {
return_attributes = new ReturnParameter (this, MethodBuilder, Location);
Compiler.PredefinedAttributes.Dynamic.EmitAttribute (return_attributes.Builder);
} else if (ReturnType.HasDynamicElement) {
return_attributes = new ReturnParameter (this, MethodBuilder, Location);
Compiler.PredefinedAttributes.Dynamic.EmitAttribute (return_attributes.Builder, ReturnType);
}
if (OptAttributes != null)
OptAttributes.Emit ();
if (declarative_security != null) {
foreach (var de in declarative_security) {
MethodBuilder.AddDeclarativeSecurity (de.Key, de.Value);
}
}
if (MethodData != null)
MethodData.Emit (Parent);
base.Emit ();
Block = null;
MethodData = null;
}
示例8: ApplyAttributeBuilder
public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa)
{
if (a.Target == AttributeTargets.ReturnValue) {
if (return_attributes == null)
return_attributes = new ReturnParameter (this, MethodBuilder, Location);
return_attributes.ApplyAttributeBuilder (a, ctor, cdata, pa);
return;
}
if (a.IsInternalMethodImplAttribute) {
is_external_implementation = true;
}
if (a.Type == pa.DllImport) {
const Modifiers extern_static = Modifiers.EXTERN | Modifiers.STATIC;
if ((ModFlags & extern_static) != extern_static) {
Report.Error (601, a.Location, "The DllImport attribute must be specified on a method marked `static' and `extern'");
}
is_external_implementation = true;
}
if (a.IsValidSecurityAttribute ()) {
if (declarative_security == null)
declarative_security = new Dictionary<SecurityAction, PermissionSet> ();
a.ExtractSecurityPermissionSet (declarative_security);
return;
}
if (MethodBuilder != null)
MethodBuilder.SetCustomAttribute ((ConstructorInfo) ctor.GetMetaInfo (), cdata);
}
示例9: Emit
public virtual void Emit (DeclSpace parent)
{
method_data.Emit (parent);
if ((ModFlags & Modifiers.COMPILER_GENERATED) != 0 && !Parent.IsCompilerGenerated)
PredefinedAttributes.Get.CompilerGenerated.EmitAttribute (method_data.MethodBuilder);
if (((ModFlags & Modifiers.DEBUGGER_HIDDEN) != 0))
PredefinedAttributes.Get.DebuggerHidden.EmitAttribute (method_data.MethodBuilder);
if (TypeManager.IsDynamicType (ReturnType)) {
return_attributes = new ReturnParameter (method_data.MethodBuilder, Location);
return_attributes.EmitPredefined (PredefinedAttributes.Get.Dynamic, Location);
}
if (OptAttributes != null)
OptAttributes.Emit ();
if (declarative_security != null) {
foreach (DictionaryEntry de in declarative_security) {
method_data.MethodBuilder.AddDeclarativeSecurity ((SecurityAction)de.Key, (PermissionSet)de.Value);
}
}
block = null;
}
示例10: EmitType
public override void EmitType ()
{
if (ReturnType.Type == InternalType.Dynamic) {
return_attributes = new ReturnParameter (this, InvokeBuilder.MethodBuilder, Location);
Compiler.PredefinedAttributes.Dynamic.EmitAttribute (return_attributes.Builder);
} else {
var trans_flags = TypeManager.HasDynamicTypeUsed (ReturnType.Type);
if (trans_flags != null) {
var pa = Compiler.PredefinedAttributes.DynamicTransform;
if (pa.Constructor != null || pa.ResolveConstructor (Location, ArrayContainer.MakeType (TypeManager.bool_type))) {
return_attributes = new ReturnParameter (this, InvokeBuilder.MethodBuilder, Location);
return_attributes.Builder.SetCustomAttribute (
new CustomAttributeBuilder (pa.Constructor, new object [] { trans_flags }));
}
}
}
Parameters.ApplyAttributes (this, InvokeBuilder.MethodBuilder);
Constructor.ConstructorBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
InvokeBuilder.MethodBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
if (BeginInvokeBuilder != null) {
BeginInvokeBuilder.ParameterInfo.ApplyAttributes (this, BeginInvokeBuilder.MethodBuilder);
BeginInvokeBuilder.MethodBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
EndInvokeBuilder.MethodBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
}
if (OptAttributes != null) {
OptAttributes.Emit ();
}
base.Emit ();
}
示例11: EmitType
public override void EmitType ()
{
if (ReturnType.Type != null) {
if (ReturnType.Type.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
return_attributes = new ReturnParameter (this, InvokeBuilder.MethodBuilder, Location);
Module.PredefinedAttributes.Dynamic.EmitAttribute (return_attributes.Builder);
} else if (ReturnType.Type.HasDynamicElement) {
return_attributes = new ReturnParameter (this, InvokeBuilder.MethodBuilder, Location);
Module.PredefinedAttributes.Dynamic.EmitAttribute (return_attributes.Builder, ReturnType.Type, Location);
}
ConstraintChecker.Check (this, ReturnType.Type, ReturnType.Location);
}
Constructor.ParameterInfo.ApplyAttributes (this, Constructor.ConstructorBuilder);
Constructor.ConstructorBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
parameters.CheckConstraints (this);
parameters.ApplyAttributes (this, InvokeBuilder.MethodBuilder);
InvokeBuilder.MethodBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
if (BeginInvokeBuilder != null) {
BeginInvokeBuilder.ParameterInfo.ApplyAttributes (this, BeginInvokeBuilder.MethodBuilder);
EndInvokeBuilder.ParameterInfo.ApplyAttributes (this, EndInvokeBuilder.MethodBuilder);
BeginInvokeBuilder.MethodBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
EndInvokeBuilder.MethodBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
}
if (OptAttributes != null) {
OptAttributes.Emit ();
}
base.Emit ();
}
示例12: Emit
public virtual void Emit(DeclSpace parent)
{
method_data.Emit (parent);
if ((ModFlags & Modifiers.COMPILER_GENERATED) != 0 && !Parent.IsCompilerGenerated)
PredefinedAttributes.Get.CompilerGenerated.EmitAttribute (method_data.MethodBuilder);
if (((ModFlags & Modifiers.DEBUGGER_HIDDEN) != 0))
PredefinedAttributes.Get.DebuggerHidden.EmitAttribute (method_data.MethodBuilder);
if (ReturnType == InternalType.Dynamic) {
return_attributes = new ReturnParameter (this, method_data.MethodBuilder, Location);
PredefinedAttributes.Get.Dynamic.EmitAttribute (return_attributes.Builder);
} else {
var trans_flags = TypeManager.HasDynamicTypeUsed (ReturnType);
if (trans_flags != null) {
var pa = PredefinedAttributes.Get.DynamicTransform;
if (pa.Constructor != null || pa.ResolveConstructor (Location, ArrayContainer.MakeType (TypeManager.bool_type))) {
return_attributes = new ReturnParameter (this, method_data.MethodBuilder, Location);
return_attributes.Builder.SetCustomAttribute (
new CustomAttributeBuilder (pa.Constructor, new object [] { trans_flags }));
}
}
}
if (OptAttributes != null)
OptAttributes.Emit ();
if (declarative_security != null) {
foreach (var de in declarative_security) {
method_data.MethodBuilder.AddDeclarativeSecurity (de.Key, de.Value);
}
}
block = null;
}
示例13: Emit
public override void Emit ()
{
if ((ModFlags & Modifiers.COMPILER_GENERATED) != 0 && !Parent.IsCompilerGenerated)
Module.PredefinedAttributes.CompilerGenerated.EmitAttribute (MethodBuilder);
if ((ModFlags & Modifiers.DEBUGGER_HIDDEN) != 0)
Module.PredefinedAttributes.DebuggerHidden.EmitAttribute (MethodBuilder);
if ((ModFlags & Modifiers.DEBUGGER_STEP_THROUGH) != 0)
Module.PredefinedAttributes.DebuggerStepThrough.EmitAttribute (MethodBuilder);
if (ReturnType.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
return_attributes = new ReturnParameter (this, MethodBuilder, Location);
Module.PredefinedAttributes.Dynamic.EmitAttribute (return_attributes.Builder);
} else if (ReturnType.HasDynamicElement) {
return_attributes = new ReturnParameter (this, MethodBuilder, Location);
Module.PredefinedAttributes.Dynamic.EmitAttribute (return_attributes.Builder, ReturnType, Location);
}
if (OptAttributes != null)
OptAttributes.Emit ();
if (declarative_security != null) {
foreach (var de in declarative_security) {
#if STATIC
MethodBuilder.__AddDeclarativeSecurity (de);
#else
MethodBuilder.AddDeclarativeSecurity (de.Key, de.Value);
#endif
}
}
//
// Optimization but it also covers cases where we cannot check
// constraints because method is captured into generated class
// and type parameters context is now different
//
if (type_expr != null && !IsCompilerGenerated)
ConstraintChecker.Check (this, member_type, type_expr.Location);
base.Emit ();
if (MethodData != null)
MethodData.Emit (Parent);
if (block != null && block.StateMachine is AsyncTaskStorey) {
var psm = Module.PredefinedAttributes.AsyncStateMachine;
psm.EmitAttribute (MethodBuilder, block.StateMachine);
}
if ((ModFlags & Modifiers.PARTIAL) == 0)
Block = null;
}
示例14: Emit
public override void Emit ()
{
if (TypeManager.IsDynamicType (ret_type)) {
return_attributes = new ReturnParameter (InvokeBuilder, Location);
return_attributes.EmitPredefined (PredefinedAttributes.Get.Dynamic, Location);
}
Parameters.ApplyAttributes (InvokeBuilder);
if (BeginInvokeBuilder != null) {
ParametersCompiled p = (ParametersCompiled) TypeManager.GetParameterData (BeginInvokeBuilder);
p.ApplyAttributes (BeginInvokeBuilder);
}
if (OptAttributes != null) {
OptAttributes.Emit ();
}
base.Emit ();
}
示例15: EmitType
public override void EmitType ()
{
if (ReturnType.Type != null) {
if (ReturnType.Type == InternalType.Dynamic) {
return_attributes = new ReturnParameter (this, InvokeBuilder.MethodBuilder, Location);
Compiler.PredefinedAttributes.Dynamic.EmitAttribute (return_attributes.Builder);
} else if (ReturnType.Type.HasDynamicElement) {
return_attributes = new ReturnParameter (this, InvokeBuilder.MethodBuilder, Location);
Compiler.PredefinedAttributes.Dynamic.EmitAttribute (return_attributes.Builder, ReturnType.Type);
}
}
parameters.ApplyAttributes (this, InvokeBuilder.MethodBuilder);
Constructor.ConstructorBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
InvokeBuilder.MethodBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
if (BeginInvokeBuilder != null) {
BeginInvokeBuilder.ParameterInfo.ApplyAttributes (this, BeginInvokeBuilder.MethodBuilder);
BeginInvokeBuilder.MethodBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
EndInvokeBuilder.MethodBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
}
if (OptAttributes != null) {
OptAttributes.Emit ();
}
base.Emit ();
}