void AddParameters(IMethodOrProperty target, ParameterDefinitionCollection plist) { foreach (ParameterDefinition par in plist) { IReturnType pReturnType = CreateType(this.ProjectContent, target, par.ParameterType); DefaultParameter p = new DefaultParameter(par.Name, pReturnType, DomRegion.Empty); if ((par.Attributes & ParameterAttributes.Out) == ParameterAttributes.Out) { p.Modifiers = ParameterModifiers.Out; } else if (par.ParameterType is ReferenceType) { p.Modifiers = ParameterModifiers.Ref; } else { p.Modifiers = ParameterModifiers.In; } if ((par.Attributes & ParameterAttributes.Optional) == ParameterAttributes.Optional) { p.Modifiers |= ParameterModifiers.Optional; } if (p.ReturnType.IsArrayReturnType) { foreach (CustomAttribute att in par.CustomAttributes) { if (att.Constructor.DeclaringType.FullName == typeof(ParamArrayAttribute).FullName) { p.Modifiers |= ParameterModifiers.Params; } } } target.Parameters.Add(p); } }
private void ReadParameters(IList <IParameter> parameters, int count) { for (int i = 0; i < count; i++) { string name = ReadString(); DefaultParameter p = new DefaultParameter(name, ReadType(), DomRegion.Empty); p.Modifiers = (ParameterModifiers)_reader.ReadByte(); ReadAttributes(p); parameters.Add(p); } }
public override IMember Clone() { DefaultProperty p = new DefaultProperty(Name, ReturnType, Modifiers, Region, BodyRegion, DeclaringType); p._parameters = DefaultParameter.Clone(this.Parameters); p.accessFlags = this.accessFlags; foreach (ExplicitInterfaceImplementation eii in InterfaceImplementations) { p.InterfaceImplementations.Add(eii.Clone()); } return(p); }
private void ReadAttributes(DefaultParameter parameter) { int count = _reader.ReadUInt16(); if (count > 0) { ReadAttributes(parameter.Attributes, count); } else { parameter.Attributes = DefaultAttribute.EmptyAttributeList; } }
public override IMember Clone() { DefaultMethod p = new DefaultMethod(Name, ReturnType, Modifiers, Region, BodyRegion, DeclaringType); p.parameters = DefaultParameter.Clone(this.Parameters); p.typeParameters = this.typeParameters; p.documentationTag = DocumentationTag; p.isExtensionMethod = this.isExtensionMethod; foreach (ExplicitInterfaceImplementation eii in InterfaceImplementations) { p.InterfaceImplementations.Add(eii.Clone()); } return(p); }