/// <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); }
/// <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()); } }
/// <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>(); } }
internal static TypeSignature GetTypeSignature(this TypeDecl tdecl) => tdecl.Properties.GetProperty <TypeSignature>();
internal static void SetTypeSignature(this TypeDecl tdecl, TypeSignature tsig) => tdecl.Properties.SetProperty(tsig);