MODMatchToBuffer

Checks for mismatching modifiers between lhsMod and rhsMod and prints the mismatching modifiers to buf.

The modifiers of the lhsMod mismatching the ones with the rhsMod are printed, i.e. lhs(shared) vs. rhs() prints "shared", wheras lhs() vs rhs(shared) prints "non-shared".

MODMatchToBuffer
(,
ubyte lhsMod
,
ubyte rhsMod
)

Parameters

buf OutBuffer*

output buffer to write to

lhsMod ubyte

modifier on the left-hand side

lhsMod ubyte

modifier on the right-hand side

Return Value

Type: auto

A tuple with isMutable and isNotShared set if the lhsMod is missing those modifiers (compared to rhs).

Examples

OutBuffer buf;
auto mismatches = MODMatchToBuffer(&buf, MODFlags.shared_, 0);
assert(buf[] == "`shared` ");
assert(!mismatches.isNotShared);

buf.setsize(0);
mismatches = MODMatchToBuffer(&buf, 0, MODFlags.shared_);
assert(buf[] == "non-shared ");
assert(mismatches.isNotShared);

buf.setsize(0);
mismatches = MODMatchToBuffer(&buf, MODFlags.const_, 0);
assert(buf[] == "`const` ");
assert(!mismatches.isMutable);

buf.setsize(0);
mismatches = MODMatchToBuffer(&buf, 0, MODFlags.const_);
assert(buf[] == "mutable ");
assert(mismatches.isMutable);
Suggestion Box / Bug Report