View source code
Display the source code in dmd/func.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Function dmd.func.MODMatchToBuffer
Checks for mismatching modifiers between lhsMod
and rhsMod
and prints the
mismatching modifiers to buf
.
auto dmd .func .MODMatchToBuffer MODMatchToBuffer
(
dmd .root .outbuffer .OutBuffer* buf,
ubyte lhsMod,
ubyte rhsMod
);
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".
Parameters
Name | Description |
---|---|
buf | output buffer to write to |
lhsMod | modifier on the left-hand side |
lhsMod | modifier on the right-hand side |
Returns
A tuple with isMutable
and isNotShared
set
if the lhsMod
is missing those modifiers (compared to rhs).
Example
OutBuffer buf;
auto mismatches = MODMatchToBuffer(&buf, MODFlags .shared_, 0);
writeln(buf .peekSlice); // "`shared` "
assert(!mismatches .isNotShared);
buf .reset;
mismatches = MODMatchToBuffer(&buf, 0, MODFlags .shared_);
writeln(buf .peekSlice); // "non-shared "
assert(mismatches .isNotShared);
buf .reset;
mismatches = MODMatchToBuffer(&buf, MODFlags .const_, 0);
writeln(buf .peekSlice); // "`const` "
assert(!mismatches .isMutable);
buf .reset;
mismatches = MODMatchToBuffer(&buf, 0, MODFlags .const_);
writeln(buf .peekSlice); // "mutable "
assert(mismatches .isMutable);
Authors
License
Copyright © 1999-2018 by the D Language Foundation | Page generated by ddox.