Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
 private static AbstractStatement ReadExpression(CodeModelBuilder model, ExpressionStatementSyntax syntax)
 {
     return(new ExpressionStatement {
         Expression = ExpressionReader.ReadExpression(model, syntax.Expression)
     });
 }