public void ReadDeclaration() { _member = new FieldMember { Name = _symbol.Name, DeclaringType = _modelBuilder.TryGetMember <TypeMember>(_symbol.ContainingType), Status = MemberStatus.Incomplete, Visibility = _symbol.GetMemberVisibility(), Modifier = _symbol.GetMemberModifier(), Type = _modelBuilder.TryGetMember <TypeMember>(_symbol.Type), IsReadOnly = _symbol.IsReadOnly, }; }
public void ReadDeclaration() { _adderReader = MethodReaderMechanism.CreateAccessorMethodReader(_modelBuilder, _symbol.AddMethod); _removerReader = MethodReaderMechanism.CreateAccessorMethodReader(_modelBuilder, _symbol.RemoveMethod); _member = new EventMember { Name = _symbol.Name, DeclaringType = _modelBuilder.TryGetMember <TypeMember>(_symbol.ContainingType), Status = MemberStatus.Incomplete, Visibility = _symbol.GetMemberVisibility(), Modifier = _symbol.GetMemberModifier(), DelegateType = _modelBuilder.TryGetMember <TypeMember>(_symbol.Type), }; }
public void ReadDeclaration() { _getterReader = MethodReaderMechanism.CreateAccessorMethodReader(_modelBuilder, _symbol.GetMethod); _setterReader = MethodReaderMechanism.CreateAccessorMethodReader(_modelBuilder, _symbol.SetMethod); _member = new PropertyMember { Name = _symbol.Name, DeclaringType = _modelBuilder.TryGetMember <TypeMember>(_symbol.ContainingType), Status = MemberStatus.Incomplete, Visibility = _symbol.GetMemberVisibility(), Modifier = _symbol.GetMemberModifier(), PropertyType = _modelBuilder.TryGetMember <TypeMember>(_symbol.Type), Getter = _getterReader?.Member as MethodMember, Setter = _setterReader?.Member as MethodMember }; }
public static ConstantExpression ReadTypedConstant(CodeModelBuilder model, TypedConstant constant) { return(new ConstantExpression { Type = model.TryGetMember <TypeMember>(constant.Type), Value = constant.Value }); }
public void ReadDeclaration() { _member = new ConstructorMember { DeclaringType = _modelBuilder.TryGetMember <TypeMember>(_symbol.ContainingType), Status = MemberStatus.Incomplete, Visibility = _symbol.GetMemberVisibility(), Modifier = _symbol.GetMemberModifier(), Signature = MethodReaderMechanism.ReadSignature(_modelBuilder, _symbol), }; }
public static AttributeDescription ReadAttribute(CodeModelBuilder modelBuilder, AttributeData data) { var constructorArguments = data.ConstructorArguments .Select(arg => ExpressionReader.ReadTypedConstant(modelBuilder, arg)) .ToList <AbstractExpression>(); var propertyValues = data.NamedArguments .Select(kvp => new NamedPropertyValue(kvp.Key, ExpressionReader.ReadTypedConstant(modelBuilder, kvp.Value))) .ToList(); var result = new AttributeDescription { AttributeType = modelBuilder.TryGetMember <TypeMember>(data.AttributeClass), ConstructorArguments = constructorArguments, PropertyValues = propertyValues }; return(result); }