Ejemplo n.º 1
0
        void ExtractAttribute(System.IO.TextWriter trapFile, AttributeSyntax syntax, ITypeSymbol attributeClass, IEntity entity)
        {
            var type = Type.Create(cx, attributeClass);

            trapFile.attributes(this, type.TypeRef, entity);

            trapFile.attribute_location(this, cx.Create(syntax.Name.GetLocation()));

            if (cx.Extractor.OutputPath != null)
            {
                trapFile.attribute_location(this, Assembly.CreateOutputAssembly(cx));
            }

            TypeMention.Create(cx, syntax.Name, this, type);

            if (syntax.ArgumentList != null)
            {
                cx.PopulateLater(() =>
                {
                    int child = 0;
                    foreach (var arg in syntax.ArgumentList.Arguments)
                    {
                        var expr = Expression.Create(cx, arg.Expression, this, child++);
                        if (!(arg.NameEquals is null))
                        {
                            trapFile.expr_argument_name(expr, arg.NameEquals.Name.Identifier.Text);
                        }
                    }
                });
            }
        }