Пример #1
0
 protected FieldDeclarationSyntax ResolveStaticGlobal <T>(string name, ExpressionSyntax?initializer = null, bool @private = true) => ResolveStaticGlobal
 (
     MetadataTypeInfo.CreateFrom(typeof(T)),
     name,
     initializer,
     @private
 );
Пример #2
0
 protected internal AttributeSyntax CreateAttribute <TAttribute>(ExpressionSyntax param) where TAttribute : Attribute => Attribute
 (
     (NameSyntax)CreateType(MetadataTypeInfo.CreateFrom(typeof(TAttribute)))
 )
 .WithArgumentList
 (
     argumentList : AttributeArgumentList
     (
         arguments : SingletonSeparatedList
         (
             AttributeArgument(param)
         )
     )
 );
Пример #3
0
 private SyntaxList <AttributeListSyntax> DeclareMethodImplAttributeToForceInlining() => SingletonList
 (
     node: AttributeList
     (
         attributes: SingletonSeparatedList
         (
             node: CreateAttribute <MethodImplAttribute>
             (
                 SimpleMemberAccess
                 (
                     CreateType(MetadataTypeInfo.CreateFrom(typeof(MethodImplOptions))),
                     nameof(MethodImplOptions.AggressiveInlining)
                 )
             )
         )
     )
 );
Пример #4
0
        protected AttributeSyntax ResolveAttribute(Type attribute, params ExpressionSyntax[] paramz)
        {
            Debug.Assert(typeof(Attribute).IsAssignableFrom(attribute));

            AttributeSyntax attr = Attribute
                                   (
                (NameSyntax)ResolveType(MetadataTypeInfo.CreateFrom(attribute))
                                   );

            if (paramz.Length > 0)
            {
                attr = attr.WithArgumentList
                       (
                    argumentList: AttributeArgumentList
                    (
                        arguments: paramz.ToSyntaxList(AttributeArgument)
                    )
                       );
            }

            return(attr);
        }
Пример #5
0
 protected override IEnumerable <ITypeInfo> ResolveBases(object context)
 {
     yield return(MetadataTypeInfo.CreateFrom(typeof(Attribute)));
 }
Пример #6
0
 protected LocalDeclarationStatementSyntax ResolveLocal <T>(string name, ExpressionSyntax?initializer = null) => ResolveLocal(MetadataTypeInfo.CreateFrom(typeof(T)), name, initializer);
Пример #7
0
 protected TypeSyntax ResolveType <T>() => ResolveType(MetadataTypeInfo.CreateFrom(typeof(T)));
Пример #8
0
 public static string GetFullName(this MemberInfo src) => $"{new SyntaxFactoryBase().CreateType(MetadataTypeInfo.CreateFrom(src.DeclaringType)).ToFullString()}.{src.Name}";
 protected ArrayCreationExpressionSyntax ResolveArray <T>(params ExpressionSyntax[] elements) => ResolveArray(MetadataTypeInfo.CreateFrom(typeof(T)), elements);
 /// <summary>
 /// new System.Object[] {..., ..., ...}
 /// </summary>
 protected internal ArrayCreationExpressionSyntax CreateArray <T>(params ExpressionSyntax[] elements) => CreateArray(MetadataTypeInfo.CreateFrom(typeof(T)), elements);
 protected internal string GetSafeTypeName <T>() => GetSafeTypeName(MetadataTypeInfo.CreateFrom(typeof(T)));