public Delegate (TypeContainer parent, FullNamedExpression type, Modifiers mod_flags, MemberName name, ParametersCompiled param_list, Attributes attrs) : base (parent, name, attrs, MemberKind.Delegate) { this.ReturnType = type; ModFlags = ModifiersExtensions.Check (AllowedModifiers, mod_flags, IsTopLevel ? Modifiers.INTERNAL : Modifiers.PRIVATE, name.Location, Report); parameters = param_list; spec = new TypeSpec (Kind, null, this, null, ModFlags | Modifiers.SEALED); }
void case_269() #line 2229 "cs-parser.jay" { Constructor c = (Constructor) yyVals[-1+yyTop]; c.Block = (ToplevelBlock) yyVals[0+yyTop]; if (doc_support) c.DocComment = ConsumeStoredComment (); current_local_parameters = null; if (doc_support) Lexer.doc_state = XmlCommentState.Allowed; }
public static ParametersCompiled MergeGenerated (CompilerContext ctx, ParametersCompiled userParams, bool checkConflicts, Parameter compilerParams, TypeSpec compilerTypes) { return MergeGenerated (ctx, userParams, checkConflicts, new Parameter [] { compilerParams }, new TypeSpec [] { compilerTypes }); }
protected void DefineBuilders (MemberKind kind, ParametersCompiled parameters) { PropertyBuilder = Parent.TypeBuilder.DefineProperty ( GetFullName (MemberName), PropertyAttributes.None, #if !BOOTSTRAP_BASIC // Requires trunk version mscorlib IsStatic ? 0 : CallingConventions.HasThis, #endif MemberType.GetMetaInfo (), null, null, parameters.GetMetaInfo (), null, null); PropertySpec spec; if (kind == MemberKind.Indexer) spec = new IndexerSpec (Parent.Definition, this, MemberType, parameters, PropertyBuilder, ModFlags); else spec = new PropertySpec (kind, Parent.Definition, this, MemberType, PropertyBuilder, ModFlags); if (Get != null) { spec.Get = Get.Spec; var method = Get.Spec.GetMetaInfo () as MethodBuilder; if (method != null) { PropertyBuilder.SetGetMethod (method); Parent.MemberCache.AddMember (this, method.Name, Get.Spec); } } else { CheckMissingAccessor (kind, parameters, true); } if (Set != null) { spec.Set = Set.Spec; var method = Set.Spec.GetMetaInfo () as MethodBuilder; if (method != null) { PropertyBuilder.SetSetMethod (method); Parent.MemberCache.AddMember (this, method.Name, Set.Spec); } } else { CheckMissingAccessor (kind, parameters, false); } Parent.MemberCache.AddMember (this, PropertyBuilder.Name, spec); }
public SetMethod (PropertyBase method, Modifiers modifiers, ParametersCompiled parameters, Attributes attrs, Location loc) : base (method, Prefix, modifiers, attrs, loc) { this.parameters = parameters; }
public SetIndexerMethod (PropertyBase property, Modifiers modifiers, ParametersCompiled parameters, Attributes attrs, Location loc) : base (property, modifiers, parameters, attrs, loc) { }
public static Method Create (TypeDefinition parent, FullNamedExpression returnType, Modifiers mod, MemberName name, ParametersCompiled parameters, Attributes attrs) { var m = new Method (parent, returnType, mod, name, parameters, attrs); if ((mod & Modifiers.PARTIAL) != 0) { const Modifiers invalid_partial_mod = Modifiers.AccessibilityMask | Modifiers.ABSTRACT | Modifiers.EXTERN | Modifiers.NEW | Modifiers.OVERRIDE | Modifiers.SEALED | Modifiers.VIRTUAL; if ((mod & invalid_partial_mod) != 0) { m.Report.Error (750, m.Location, "A partial method cannot define access modifier or any of abstract, extern, new, override, sealed, or virtual modifiers"); mod &= ~invalid_partial_mod; } if ((parent.ModFlags & Modifiers.PARTIAL) == 0) { m.Report.Error (751, m.Location, "A partial method must be declared within a partial class or partial struct"); } } if ((mod & Modifiers.STATIC) == 0 && parameters.HasExtensionMethodType) { m.Report.Error (1105, m.Location, "`{0}': Extension methods must be declared static", m.GetSignatureForError ()); } return m; }
public Method (TypeDefinition parent, FullNamedExpression return_type, Modifiers mod, MemberName name, ParametersCompiled parameters, Attributes attrs) : base (parent, return_type, mod, parent.PartialContainer.Kind == MemberKind.Interface ? AllowedModifiersInterface : parent.PartialContainer.Kind == MemberKind.Struct ? AllowedModifiersStruct | Modifiers.ASYNC : AllowedModifiersClass | Modifiers.ASYNC, name, attrs, parameters) { }
public LambdaMethod (ParametersCompiled parameters, ParametersBlock block, TypeSpec return_type, TypeSpec delegate_type, Location loc) : base (parameters, block, return_type, delegate_type, loc) { }
protected override AnonymousMethodBody CompatibleMethodFactory (TypeSpec returnType, TypeSpec delegateType, ParametersCompiled p, ParametersBlock b) { return new LambdaMethod (p, b, returnType, delegateType, loc); }
protected bool DefineParameters (ParametersCompiled parameters) { if (!parameters.Resolve (this)) return false; bool error = false; for (int i = 0; i < parameters.Count; ++i) { Parameter p = parameters [i]; if (p.HasDefaultValue && (IsExplicitImpl || this is Operator || (this is Indexer && parameters.Count == 1))) p.Warning_UselessOptionalParameter (Report); if (p.CheckAccessibility (this)) continue; TypeSpec t = parameters.Types [i]; Report.SymbolRelatedToPreviousError (t); if (this is Indexer) Report.Error (55, Location, "Inconsistent accessibility: parameter type `{0}' is less accessible than indexer `{1}'", TypeManager.CSharpName (t), GetSignatureForError ()); else if (this is Operator) Report.Error (57, Location, "Inconsistent accessibility: parameter type `{0}' is less accessible than operator `{1}'", TypeManager.CSharpName (t), GetSignatureForError ()); else Report.Error (51, Location, "Inconsistent accessibility: parameter type `{0}' is less accessible than method `{1}'", TypeManager.CSharpName (t), GetSignatureForError ()); error = true; } return !error; }
void case_1003() #line 6872 "cs-parser.jay" { --lexer.parsing_block; Method method = (Method) oob_stack.Pop (); method.Block = (ToplevelBlock) end_block(lexer.Location); InteractiveResult = (Class) pop_current_class (); current_local_parameters = null; }
void case_1002() #line 6844 "cs-parser.jay" { current_container = current_type = new Class (current_container, new MemberName ("<InteractiveExpressionClass>"), Modifiers.PUBLIC, null); /* (ref object retval)*/ Parameter [] mpar = new Parameter [1]; mpar [0] = new Parameter (new TypeExpression (compiler.BuiltinTypes.Object, Location.Null), "$retval", Parameter.Modifier.REF, null, Location.Null); ParametersCompiled pars = new ParametersCompiled (mpar); var mods = Modifiers.PUBLIC | Modifiers.STATIC; if (settings.Unsafe) mods |= Modifiers.UNSAFE; current_local_parameters = pars; Method method = new Method ( current_type, new TypeExpression (compiler.BuiltinTypes.Void, Location.Null), mods, new MemberName ("Host"), pars, null /* attributes */); current_type.AddMember (method); oob_stack.Push (method); ++lexer.parsing_block; start_block (lexer.Location); }
void case_650() #line 4555 "cs-parser.jay" { var pars_list = (List<Parameter>) yyVals[0+yyTop]; yyVal = new ParametersCompiled (pars_list.ToArray ()); lbag.AddLocation (yyVal, parameterListCommas); }
void case_271() #line 2255 "cs-parser.jay" { valid_param_mod = 0; current_local_parameters = (ParametersCompiled) yyVals[-1+yyTop]; var lt = (Tokenizer.LocatedToken) yyVals[-4+yyTop]; var mods = (Modifiers) yyVals[-5+yyTop]; var c = new Constructor (current_type, lt.Value, mods, (Attributes) yyVals[-6+yyTop], current_local_parameters, lt.Location); if (lt.Value != current_container.MemberName.Name) { report.Error (1520, c.Location, "Class, struct, or interface method must have a return type"); } else if ((mods & Modifiers.STATIC) != 0) { if ((mods & Modifiers.AccessibilityMask) != 0){ report.Error (515, c.Location, "`{0}': static constructor cannot have an access modifier", c.GetSignatureForError ()); } } current_type.AddConstructor (c); lbag.AddMember (c, GetModifierLocations (), GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[0+yyTop])); yyVal = c; /**/ /* start block here, so possible anonymous methods inside*/ /* constructor initializer can get correct parent block*/ /**/ start_block (lexer.Location); } void case_272() #line 2284 "cs-parser.jay" { if (yyVals[0+yyTop] != null) { var c = (Constructor) yyVals[-1+yyTop]; c.Initializer = (ConstructorInitializer) yyVals[0+yyTop]; if (c.IsStatic) { report.Error (514, c.Location, "`{0}': static constructor cannot have an explicit `this' or `base' constructor call", c.GetSignatureForError ()); } } yyVal = yyVals[-1+yyTop]; } void case_278() #line 2316 "cs-parser.jay" { --lexer.parsing_block; yyVal = new ConstructorBaseInitializer ((Arguments) yyVals[-1+yyTop], GetLocation (yyVals[-4+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_280() #line 2326 "cs-parser.jay" { --lexer.parsing_block; yyVal = new ConstructorThisInitializer ((Arguments) yyVals[-1+yyTop], GetLocation (yyVals[-4+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[0+yyTop])); } void case_281() #line 2332 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = new ConstructorThisInitializer (null, GetLocation (yyVals[0+yyTop])); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_282() #line 2338 "cs-parser.jay" { Error_SyntaxError (yyToken); yyVal = null; } void case_283() #line 2346 "cs-parser.jay" { if (doc_support) { tmpComment = Lexer.consume_doc_comment (); Lexer.doc_state = XmlCommentState.NotAllowed; } current_local_parameters = ParametersCompiled.EmptyReadOnlyParameters; } void case_284() #line 2355 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; if (lt.Value != current_container.MemberName.Name){ report.Error (574, lt.Location, "Name of destructor must match name of class"); } else if (current_container.Kind != MemberKind.Class){ report.Error (575, lt.Location, "Only class types can contain destructor"); } Destructor d = new Destructor (current_type, (Modifiers) yyVals[-6+yyTop], ParametersCompiled.EmptyReadOnlyParameters, (Attributes) yyVals[-7+yyTop], lt.Location); d.Identifier = lt.Value; if (doc_support) d.DocComment = ConsumeStoredComment (); d.Block = (ToplevelBlock) yyVals[0+yyTop]; current_type.AddMember (d); lbag.AddMember (d, GetModifierLocations (), GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-2+yyTop]), GetLocation (yyVals[-1+yyTop])); current_local_parameters = null; } void case_285() #line 2381 "cs-parser.jay" { current_event_field = new EventField (current_type, (FullNamedExpression) yyVals[-1+yyTop], (Modifiers) yyVals[-3+yyTop], (MemberName) yyVals[0+yyTop], (Attributes) yyVals[-4+yyTop]); current_type.AddMember (current_event_field); if (current_event_field.MemberName.ExplicitInterface != null) { report.Error (71, current_event_field.Location, "`{0}': An explicit interface implementation of an event must use property syntax", current_event_field.GetSignatureForError ()); } yyVal = current_event_field; } void case_286() #line 2395 "cs-parser.jay" { if (doc_support) { current_event_field.DocComment = Lexer.consume_doc_comment (); Lexer.doc_state = XmlCommentState.Allowed; } if (current_event_field.Initializer != null) { lbag.AddMember (current_event_field, GetModifierLocations (), GetLocation (yyVals[-6+yyTop]), savedEventAssignLocation, GetLocation (yyVals[0+yyTop])); } else { lbag.AddMember (current_event_field, GetModifierLocations (), GetLocation (yyVals[-6+yyTop]), GetLocation (yyVals[0+yyTop])); } current_event_field = null; } void case_287() #line 2411 "cs-parser.jay" { current_event = new EventProperty (current_type, (FullNamedExpression) yyVals[-2+yyTop], (Modifiers) yyVals[-4+yyTop], (MemberName) yyVals[-1+yyTop], (Attributes) yyVals[-5+yyTop]); current_type.AddMember (current_event); lbag.AddMember (current_event, GetModifierLocations (), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[0+yyTop])); lexer.EventParsing = true; } void case_288() #line 2419 "cs-parser.jay" { if (current_container.Kind == MemberKind.Interface) report.Error (69, GetLocation (yyVals[-2+yyTop]), "Event in interface cannot have add or remove accessors"); lexer.EventParsing = false; } void case_289() #line 2426 "cs-parser.jay" { if (doc_support) { current_event.DocComment = Lexer.consume_doc_comment (); Lexer.doc_state = XmlCommentState.Allowed; } lbag.AppendToMember (current_event, GetLocation (yyVals[-1+yyTop])); current_event = null; current_local_parameters = null; } void case_290() #line 2439 "cs-parser.jay" { Error_SyntaxError (yyToken); current_type.AddMember (new EventField (current_type, (FullNamedExpression) yyVals[-1+yyTop], (Modifiers) yyVals[-3+yyTop], MemberName.Null, (Attributes) yyVals[-4+yyTop])); } void case_293() #line 2453 "cs-parser.jay" { --lexer.parsing_block; savedEventAssignLocation = GetLocation (yyVals[-2+yyTop]); current_event_field.Initializer = (Expression) yyVals[0+yyTop]; } void case_298() #line 2478 "cs-parser.jay" { var lt = (Tokenizer.LocatedToken) yyVals[0+yyTop]; yyVal = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), null); lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop])); } void case_300() #line 2488 "cs-parser.jay" { --lexer.parsing_block; var lt = (Tokenizer.LocatedToken) yyVals[-3+yyTop]; yyVal = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (Expression) yyVals[0+yyTop]); lbag.AddLocation (yyVal, GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[-2+yyTop])); } void case_301() #line 2497 "cs-parser.jay" { if (current_container.Kind == MemberKind.Interface) { report.Error (68, lexer.Location, "`{0}': event in interface cannot have an initializer", current_event_field.GetSignatureForError ()); } if ((current_event_field.ModFlags & Modifiers.ABSTRACT) != 0) { report.Error (74, lexer.Location, "`{0}': abstract event cannot have an initializer", current_event_field.GetSignatureForError ()); } } void case_305() #line 2518 "cs-parser.jay" { report.Error (65, lexer.Location, "`{0}': event property must have both add and remove accessors", current_event.GetSignatureForError ()); } void case_306() #line 2523 "cs-parser.jay" { report.Error (65, lexer.Location, "`{0}': event property must have both add and remove accessors", current_event.GetSignatureForError ()); } void case_307() #line 2528 "cs-parser.jay" { report.Error (1055, GetLocation (yyVals[0+yyTop]), "An add or remove accessor expected"); yyVal = null; } void case_308() #line 2536 "cs-parser.jay" { if (yyVals[-1+yyTop] != ModifierNone) { report.Error (1609, GetLocation (yyVals[-1+yyTop]), "Modifiers cannot be placed on event accessor declarations"); } current_event.Add = new EventProperty.AddDelegateMethod (current_event, (Attributes) yyVals[-2+yyTop], GetLocation (yyVals[0+yyTop])); current_local_parameters = current_event.Add.ParameterInfo; lbag.AddMember (current_event.Add, GetModifierLocations ()); lexer.EventParsing = false; } void case_309() #line 2548 "cs-parser.jay" { lexer.EventParsing = true; current_event.Add.Block = (ToplevelBlock) yyVals[0+yyTop]; if (current_container.Kind == MemberKind.Interface) { report.Error (531, current_event.Add.Block.StartLocation, "`{0}': interface members cannot have a definition", current_event.Add.GetSignatureForError ()); } current_local_parameters = null; } void case_310() #line 2564 "cs-parser.jay" { if (yyVals[-1+yyTop] != ModifierNone) { report.Error (1609, GetLocation (yyVals[-1+yyTop]), "Modifiers cannot be placed on event accessor declarations"); } current_event.Remove = new EventProperty.RemoveDelegateMethod (current_event, (Attributes) yyVals[-2+yyTop], GetLocation (yyVals[0+yyTop])); current_local_parameters = current_event.Remove.ParameterInfo; lbag.AddMember (current_event.Remove, GetModifierLocations ()); lexer.EventParsing = false; } void case_311() #line 2576 "cs-parser.jay" { lexer.EventParsing = true; current_event.Remove.Block = (ToplevelBlock) yyVals[0+yyTop]; if (current_container.Kind == MemberKind.Interface) { report.Error (531, current_event.Remove.Block.StartLocation, "`{0}': interface members cannot have a definition", current_event.Remove.GetSignatureForError ()); } current_local_parameters = null; } void case_312() #line 2592 "cs-parser.jay" { report.Error (73, lexer.Location, "An add or remove accessor must have a body"); yyVal = null; } void case_314() #line 2601 "cs-parser.jay" { current_type.UnattachedAttributes = (Attributes) yyVals[-1+yyTop]; report.Error (1519, GetLocation (yyVals[-1+yyTop]), "An attribute is missing member declaration"); lexer.putback ('}'); } void case_315() #line 2614 "cs-parser.jay" { if (doc_support) enumTypeComment = Lexer.consume_doc_comment (); } void case_316() #line 2619 "cs-parser.jay" { if (doc_support) Lexer.doc_state = XmlCommentState.Allowed; MemberName name = (MemberName) yyVals[-3+yyTop]; if (name.IsGeneric) { report.Error (1675, name.Location, "Enums cannot have type parameters"); } push_current_container (new Enum (current_container, (FullNamedExpression) yyVals[-2+yyTop], (Modifiers) yyVals[-5+yyTop], name, (Attributes) yyVals[-6+yyTop]), null); if (yyVals[-2+yyTop] != null) { lbag.AddMember (current_container, GetModifierLocations (), GetLocation (yyVals[-4+yyTop]), savedLocation, GetLocation (yyVals[0+yyTop])); } else { lbag.AddMember (current_container, GetModifierLocations (), GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[0+yyTop])); } } void case_317() #line 2636 "cs-parser.jay" { /* here will be evaluated after CLOSE_BLACE is consumed.*/ if (doc_support) Lexer.doc_state = XmlCommentState.Allowed; }
public MethodCore (TypeDefinition parent, FullNamedExpression type, Modifiers mod, Modifiers allowed_mod, MemberName name, Attributes attrs, ParametersCompiled parameters) : base (parent, type, mod, allowed_mod, name, attrs) { this.parameters = parameters; }
protected MethodOrOperator (TypeDefinition parent, FullNamedExpression type, Modifiers mod, Modifiers allowed_mod, MemberName name, Attributes attrs, ParametersCompiled parameters) : base (parent, type, mod, allowed_mod, name, attrs, parameters) { }
void DefineAsyncMethods (CallingConventions cc, TypeExpression returnType) { var iasync_result = Module.PredefinedTypes.IAsyncResult; var async_callback = Module.PredefinedTypes.AsyncCallback; // // It's ok when async types don't exist, the delegate will have Invoke method only // if (!iasync_result.Define () || !async_callback.Define ()) return; // // BeginInvoke // ParametersCompiled async_parameters; if (Parameters.Count == 0) { async_parameters = ParametersCompiled.EmptyReadOnlyParameters; } else { var compiled = new Parameter[Parameters.Count]; for (int i = 0; i < compiled.Length; ++i) { var p = parameters[i]; compiled[i] = new Parameter (new TypeExpression (parameters.Types[i], Location), p.Name, p.ModFlags & Parameter.Modifier.RefOutMask, p.OptAttributes == null ? null : p.OptAttributes.Clone (), Location); } async_parameters = new ParametersCompiled (compiled); } async_parameters = ParametersCompiled.MergeGenerated (Compiler, async_parameters, false, new Parameter[] { new Parameter (new TypeExpression (async_callback.TypeSpec, Location), "callback", Parameter.Modifier.NONE, null, Location), new Parameter (new TypeExpression (Compiler.BuiltinTypes.Object, Location), "object", Parameter.Modifier.NONE, null, Location) }, new [] { async_callback.TypeSpec, Compiler.BuiltinTypes.Object } ); BeginInvokeBuilder = new Method (this, new TypeExpression (iasync_result.TypeSpec, Location), MethodModifiers, new MemberName ("BeginInvoke"), async_parameters, null); BeginInvokeBuilder.Define (); // // EndInvoke is a bit more interesting, all the parameters labeled as // out or ref have to be duplicated here. // // // Define parameters, and count out/ref parameters // ParametersCompiled end_parameters; int out_params = 0; foreach (Parameter p in Parameters.FixedParameters) { if ((p.ModFlags & Parameter.Modifier.RefOutMask) != 0) ++out_params; } if (out_params > 0) { Parameter[] end_params = new Parameter[out_params]; int param = 0; for (int i = 0; i < Parameters.FixedParameters.Length; ++i) { Parameter p = parameters [i]; if ((p.ModFlags & Parameter.Modifier.RefOutMask) == 0) continue; end_params [param++] = new Parameter (new TypeExpression (p.Type, Location), p.Name, p.ModFlags & Parameter.Modifier.RefOutMask, p.OptAttributes == null ? null : p.OptAttributes.Clone (), Location); } end_parameters = new ParametersCompiled (end_params); } else { end_parameters = ParametersCompiled.EmptyReadOnlyParameters; } end_parameters = ParametersCompiled.MergeGenerated (Compiler, end_parameters, false, new Parameter ( new TypeExpression (iasync_result.TypeSpec, Location), "result", Parameter.Modifier.NONE, null, Location), iasync_result.TypeSpec); // // Create method, define parameters, register parameters with type system // EndInvokeBuilder = new Method (this, returnType, MethodModifiers, new MemberName ("EndInvoke"), end_parameters, null); EndInvokeBuilder.Define (); }
protected Method (TypeDefinition parent, FullNamedExpression return_type, Modifiers mod, Modifiers amod, MemberName name, ParametersCompiled parameters, Attributes attrs) : base (parent, return_type, mod, amod, name, attrs, parameters) { }
public static FullNamedExpression CreateDelegateTypeExpression (BuiltinTypes builtinTypes, ParametersCompiled parameters, FullNamedExpression retType, Location loc){ bool hasParams = parameters != null && parameters.Count > 0; int paramCount = hasParams ? parameters.Count : 0; bool hasRetType = !(retType is TypeExpression && ((TypeExpression)retType).Type == builtinTypes.Void); int typeParamCount = paramCount; if (hasRetType) typeParamCount++; TypeArguments typeArgs = null; if (typeParamCount > 0) { var typeArgArray = new FullNamedExpression[typeParamCount]; for (var i = 0; i < paramCount; i++) { if (i < paramCount) { var param = parameters.FixedParameters[i] as Parameter; typeArgArray[i] = param.TypeExpression; } else { typeArgArray[i] = retType; } } typeArgs = new TypeArguments (typeArgArray); } if (!hasRetType) { return new MemberAccess(new SimpleName("System", loc), "Action", typeArgs, loc); } else { return new MemberAccess(new SimpleName("System", loc), "Func", typeArgs, loc); } }
protected AEventAccessor (Event method, string prefix, Attributes attrs, Location loc) : base (method, prefix, attrs, loc) { this.method = method; this.ModFlags = method.ModFlags; this.parameters = ParametersCompiled.CreateImplicitParameter (method.TypeExpression, loc); }
public Constructor (TypeDefinition parent, string name, Modifiers mod, Attributes attrs, ParametersCompiled args, Location loc) : base (parent, null, mod, AllowedModifiers, new MemberName (name, loc), attrs, args) { }
public Indexer (TypeDefinition parent, FullNamedExpression type, MemberName name, Modifiers mod, ParametersCompiled parameters, Attributes attrs) : base (parent, type, mod, parent.PartialContainer.Kind == MemberKind.Interface ? AllowedInterfaceModifiers : AllowedModifiers, name, attrs) { this.parameters = parameters; }
/// <summary> /// Create the MethodBuilder for the method /// </summary> void DefineMethodBuilder (TypeDefinition container, string method_name, ParametersCompiled param) { var return_type = method.ReturnType.GetMetaInfo (); var p_types = param.GetMetaInfo (); if (builder == null) { builder = container.TypeBuilder.DefineMethod ( method_name, flags, method.CallingConventions, return_type, p_types); return; } // // Generic method has been already defined to resolve method parameters // correctly when they use type parameters // builder.SetParameters (p_types); builder.SetReturnType (return_type); if (builder.Attributes != flags) { #if STATIC builder.__SetAttributes (flags); #else try { if (methodbuilder_attrs_field == null) methodbuilder_attrs_field = typeof (MethodBuilder).GetField ("attrs", BindingFlags.NonPublic | BindingFlags.Instance); methodbuilder_attrs_field.SetValue (builder, flags); } catch { container.Compiler.Report.RuntimeMissingSupport (method.Location, "Generic method MethodAttributes"); } #endif } }
void CheckMissingAccessor (MemberKind kind, ParametersCompiled parameters, bool get) { if (IsExplicitImpl) { MemberFilter filter; if (kind == MemberKind.Indexer) filter = new MemberFilter (MemberCache.IndexerNameAlias, 0, kind, parameters, null); else filter = new MemberFilter (MemberName.Name, 0, kind, null, null); var implementing = MemberCache.FindMember (InterfaceType, filter, BindingRestriction.DeclaredOnly) as PropertySpec; if (implementing == null) return; var accessor = get ? implementing.Get : implementing.Set; if (accessor != null) { Report.SymbolRelatedToPreviousError (accessor); Report.Error (551, Location, "Explicit interface implementation `{0}' is missing accessor `{1}'", GetSignatureForError (), accessor.GetSignatureForError ()); } } }
public Destructor (TypeDefinition parent, Modifiers mod, ParametersCompiled parameters, Attributes attrs, Location l) : base (parent, null, mod, AllowedModifiers, new MemberName (MetadataName, l), attrs, parameters) { ModFlags &= ~Modifiers.PRIVATE; ModFlags |= Modifiers.PROTECTED | Modifiers.OVERRIDE; }
public VariableInfo (ParametersCompiled ip, int i, int offset) : this (ip.FixedParameters [i].Name, ip.Types [i], offset) { this.IsParameter = true; }
public Operator (TypeDefinition parent, OpType type, FullNamedExpression ret_type, Modifiers mod_flags, ParametersCompiled parameters, ToplevelBlock block, Attributes attrs, Location loc) : base (parent, ret_type, mod_flags, AllowedModifiers, new MemberName (GetMetadataName (type), loc), attrs, parameters) { OperatorType = type; Block = block; }
// // Use this method when you merge compiler generated parameters with user parameters // public static ParametersCompiled MergeGenerated (CompilerContext ctx, ParametersCompiled userParams, bool checkConflicts, Parameter[] compilerParams, TypeSpec[] compilerTypes) { Parameter[] all_params = new Parameter [userParams.Count + compilerParams.Length]; userParams.FixedParameters.CopyTo(all_params, 0); TypeSpec [] all_types; if (userParams.types != null) { all_types = new TypeSpec [all_params.Length]; userParams.Types.CopyTo (all_types, 0); } else { all_types = null; } int last_filled = userParams.Count; int index = 0; foreach (Parameter p in compilerParams) { for (int i = 0; i < last_filled; ++i) { while (p.Name == all_params [i].Name) { if (checkConflicts && i < userParams.Count) { ctx.Report.Error (316, userParams[i].Location, "The parameter name `{0}' conflicts with a compiler generated name", p.Name); } p.Name = '_' + p.Name; } } all_params [last_filled] = p; if (all_types != null) all_types [last_filled] = compilerTypes [index++]; ++last_filled; } ParametersCompiled parameters = new ParametersCompiled (all_params, all_types); parameters.has_params = userParams.has_params; return parameters; }
void case_268() #line 2219 "cs-parser.jay" { Error_SyntaxError (yyToken); current_local_parameters = ParametersCompiled.EmptyReadOnlyParameters; yyVal = new OperatorDeclaration (Operator.OpType.Explicit, null, GetLocation (yyVals[-1+yyTop])); }