Exemplo n.º 1
0
        /// <summary>
        /// In case the type represents `enum` type, gets its baking type (the type specified after <c>:</c>).
        /// </summary>
        public static TypeRef GetEnumBackingType(this TypeDecl tdecl)
        {
            if (tdecl.MemberAttributes.IsEnum() && tdecl.Properties.TryGetProperty <EnumBackingType>(out var value))
            {
                return(value.Type);
            }

            return(null);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Gets type mask corresponding to <c>self</c> with <c>includesSubclasses</c> flag set whether type is not final.
 /// </summary>
 private TypeRefMask GetTypeCtxMask(AST.TypeDecl typeCtx)
 {
     if (typeCtx != null)
     {
         var typeIsFinal = (typeCtx.MemberAttributes & PhpMemberAttributes.Final) != 0;
         return(GetTypeMask(new ClassTypeRef(NameUtils.MakeQualifiedName(typeCtx)), !typeIsFinal));
     }
     else
     {
         return(GetSystemObjectTypeMask());
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Associates enum with its backing type.
 /// </summary>
 internal static void SetEnumBackingType(this TypeDecl tdecl, TypeRef backingType)
 {
     if (backingType != null)
     {
         tdecl.Properties.SetProperty(new EnumBackingType {
             Type = backingType
         });
     }
     else
     {
         tdecl.Properties.RemoveProperty <EnumBackingType>();
     }
 }
Exemplo n.º 4
0
 internal static TypeSignature GetTypeSignature(this TypeDecl tdecl) => tdecl.Properties.GetProperty <TypeSignature>();
Exemplo n.º 5
0
 internal static void SetTypeSignature(this TypeDecl tdecl, TypeSignature tsig) => tdecl.Properties.SetProperty(tsig);