Fix the order of static field initializers.

This commit is contained in:
Kirill Osenkov 2021-08-04 19:48:31 -07:00
Родитель 6677f7c490
Коммит 6771b22ad1
1 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -10,6 +10,13 @@ namespace MonoDevelop.Xml.Editor.Completion
{
public static class XmlImages
{
// Warning: the order of these static fields is important,
// declare in the order they depend on one another.
// If this Guid is at the end, the other fields will read the empty value before it gets initialized
static readonly Guid KnownImagesGuid = KnownImageIds.ImageCatalogGuid;
static ImageElement CreateElement (int id) => new ImageElement (new ImageId (KnownImagesGuid, id));
public static readonly ImageElement Element = CreateElement (3245);
public static readonly ImageElement Attribute = CreateElement (3335);
public static readonly ImageElement AttributeValue = CreateElement (KnownImageIds.Constant);
@ -19,8 +26,5 @@ namespace MonoDevelop.Xml.Editor.Completion
public static readonly ImageElement Prolog = CreateElement (KnownImageIds.XMLProcessInstructionTag);
public static readonly ImageElement Entity = Prolog;
public static ImageElement ClosingTag = Element;
static readonly Guid KnownImagesGuid = KnownImageIds.ImageCatalogGuid;
static ImageElement CreateElement (int id) => new ImageElement (new ImageId (KnownImagesGuid, id));
}
}