mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
* New "must call base" analyzer. This enforces that you actually call base when overriding stuff. This is intended for base methods like entity system's, where server/client systems overriding shared ones SHOULD call Initialize() and such. * Add MustCallBase to entity system methods
18 lines
592 B
C#
18 lines
592 B
C#
using System;
|
|
|
|
namespace Robust.Shared.Analyzers;
|
|
|
|
/// <summary>
|
|
/// Indicates that overriders of this method must always call the base function.
|
|
/// </summary>
|
|
/// <param name="onlyOverrides">
|
|
/// If true, only base calls to *overrides* are necessary.
|
|
/// This is intended for base classes where the base function is always empty,
|
|
/// so a base call from the first override may be ommitted.
|
|
/// </param>
|
|
[AttributeUsage(AttributeTargets.Method)]
|
|
public sealed class MustCallBaseAttribute(bool onlyOverrides = false) : Attribute
|
|
{
|
|
public bool OnlyOverrides { get; } = onlyOverrides;
|
|
}
|