pub struct PositionalMacros<'a> { /* private fields */ }Expand description
A macro table that answers as of one offset.
This is what crate::condition::MacroValues is implemented for, so a condition is evaluated
against the macros that were in force where it was written — not against the file’s final table,
which is a different question with different answers.
The table is a &dyn because the same offset question is asked of a per-file table and of a whole walked
translation unit’s view — see MacroBindings, which is where the three sources of an answer are named.
Trait Implementations§
Source§impl MacroValues for PositionalMacros<'_>
impl MacroValues for PositionalMacros<'_>
Source§fn builtin_operator(&self, name: &str, operand: &str) -> Option<Value>
fn builtin_operator(&self, name: &str, operand: &str) -> Option<Value>
Forwarded, with the offset this wrapper exists to add.
The cooks all evaluate through a PositionalMacros, so an operator answered by the table underneath is
answered here or nowhere: __has_include would be Unknown in every real cook while its implementation sat
one layer down, unreachable. The wrapper’s whole job is to add the offset.
§The offset is not decoration
An earlier version of this forwarded the operator with no position, and for __has_cpp_attribute that was
the whole bug: the answer depends on whether the bare name is a macro at that point, and the walking table
answers a question without a position from the end of the file — where xtr1common:22’s #undef msvc
has already happened, so every msvc:: attribute read as unsupported and
[[msvc::no_specializations(...)]] was missing from the stream while cl.exe emitted it 17 times.
Source§fn lookup(&self, name: &str) -> Lookup<'_>
fn lookup(&self, name: &str) -> Lookup<'_>
name at the position being evaluated.Source§fn is_complete(&self) -> bool
fn is_complete(&self) -> bool
Lookup::Undefined and
Lookup::Unanswered for a name the table has never seen. Read moreAuto Trait Implementations§
impl<'a> !RefUnwindSafe for PositionalMacros<'a>
impl<'a> !Send for PositionalMacros<'a>
impl<'a> !Sync for PositionalMacros<'a>
impl<'a> !UnwindSafe for PositionalMacros<'a>
impl<'a> Forget for PositionalMacros<'a>
impl<'a> Freeze for PositionalMacros<'a>
impl<'a> Move for PositionalMacros<'a>
impl<'a> Unpin for PositionalMacros<'a>
impl<'a> UnsafeUnpin for PositionalMacros<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more