예제 #1
0
 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,
     };
 }
예제 #2
0
        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),
            };
        }
예제 #3
0
        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
            };
        }
예제 #4
0
 public static ConstantExpression ReadTypedConstant(CodeModelBuilder model, TypedConstant constant)
 {
     return(new ConstantExpression {
         Type = model.TryGetMember <TypeMember>(constant.Type),
         Value = constant.Value
     });
 }
예제 #5
0
 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),
     };
 }
예제 #6
0
        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);
        }