diff options
Diffstat (limited to 'gcc/d/dmd/errors.d')
-rw-r--r-- | gcc/d/dmd/errors.d | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/gcc/d/dmd/errors.d b/gcc/d/dmd/errors.d index 287dc49..1f7a78e 100644 --- a/gcc/d/dmd/errors.d +++ b/gcc/d/dmd/errors.d @@ -119,22 +119,32 @@ else package auto previewErrorFunc(bool isDeprecated, FeatureState featureState) @safe @nogc pure nothrow { - if (featureState == FeatureState.enabled) - return &error; - else if (featureState == FeatureState.disabled || isDeprecated) - return &noop; - else - return &deprecation; + with (FeatureState) final switch (featureState) + { + case enabled: + return &error; + + case disabled: + return &noop; + + case default_: + return isDeprecated ? &noop : &deprecation; + } } package auto previewSupplementalFunc(bool isDeprecated, FeatureState featureState) @safe @nogc pure nothrow { - if (featureState == FeatureState.enabled) - return &errorSupplemental; - else if (featureState == FeatureState.disabled || isDeprecated) - return &noop; - else - return &deprecationSupplemental; + with (FeatureState) final switch (featureState) + { + case enabled: + return &errorSupplemental; + + case disabled: + return &noop; + + case default_: + return isDeprecated ? &noop : &deprecationSupplemental; + } } |