libsyntax_pos: Tweak some visibilities
This commit is contained in:
parent
0c0315cfd9
commit
01b6d7cc6f
3 changed files with 19 additions and 11 deletions
|
@ -27,16 +27,16 @@ use std::fmt;
|
|||
|
||||
/// A SyntaxContext represents a chain of macro expansions (represented by marks).
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Default, PartialOrd, Ord, Hash)]
|
||||
pub struct SyntaxContext(pub(super) u32);
|
||||
pub struct SyntaxContext(u32);
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct SyntaxContextData {
|
||||
pub outer_mark: Mark,
|
||||
pub prev_ctxt: SyntaxContext,
|
||||
struct SyntaxContextData {
|
||||
outer_mark: Mark,
|
||||
prev_ctxt: SyntaxContext,
|
||||
// This context, but with all transparent and semi-transparent marks filtered away.
|
||||
pub opaque: SyntaxContext,
|
||||
opaque: SyntaxContext,
|
||||
// This context, but with all transparent marks filtered away.
|
||||
pub opaque_and_semitransparent: SyntaxContext,
|
||||
opaque_and_semitransparent: SyntaxContext,
|
||||
}
|
||||
|
||||
/// A mark is a unique id associated with a macro expansion.
|
||||
|
@ -198,7 +198,7 @@ impl Mark {
|
|||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct HygieneData {
|
||||
crate struct HygieneData {
|
||||
marks: Vec<MarkData>,
|
||||
syntax_contexts: Vec<SyntaxContextData>,
|
||||
markings: HashMap<(SyntaxContext, Mark), SyntaxContext>,
|
||||
|
@ -206,7 +206,7 @@ pub struct HygieneData {
|
|||
}
|
||||
|
||||
impl HygieneData {
|
||||
pub fn new() -> Self {
|
||||
crate fn new() -> Self {
|
||||
HygieneData {
|
||||
marks: vec![MarkData {
|
||||
parent: Mark::root(),
|
||||
|
@ -249,6 +249,14 @@ impl SyntaxContext {
|
|||
SyntaxContext(0)
|
||||
}
|
||||
|
||||
crate fn as_u32(self) -> u32 {
|
||||
self.0
|
||||
}
|
||||
|
||||
crate fn from_u32(raw: u32) -> SyntaxContext {
|
||||
SyntaxContext(raw)
|
||||
}
|
||||
|
||||
// Allocate a new SyntaxContext with the given ExpnInfo. This is used when
|
||||
// deserializing Spans from the incr. comp. cache.
|
||||
// FIXME(mw): This method does not restore MarkData::parent or
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
|
||||
#![feature(const_fn)]
|
||||
#![feature(crate_visibility_modifier)]
|
||||
#![feature(custom_attribute)]
|
||||
#![feature(non_exhaustive)]
|
||||
#![feature(optin_builtin_traits)]
|
||||
#![allow(unused_attributes)]
|
||||
#![feature(specialization)]
|
||||
#![feature(stdsimd)]
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ const INTERNED_INDEX_OFFSET: u32 = 1;
|
|||
|
||||
#[inline]
|
||||
fn encode(sd: &SpanData) -> Span {
|
||||
let (base, len, ctxt) = (sd.lo.0, sd.hi.0 - sd.lo.0, sd.ctxt.0);
|
||||
let (base, len, ctxt) = (sd.lo.0, sd.hi.0 - sd.lo.0, sd.ctxt.as_u32());
|
||||
|
||||
let val = if (base >> INLINE_SIZES[BASE_INDEX]) == 0 &&
|
||||
(len >> INLINE_SIZES[LEN_INDEX]) == 0 &&
|
||||
|
@ -132,7 +132,7 @@ fn decode(span: Span) -> SpanData {
|
|||
let index = extract(INTERNED_INDEX_OFFSET, INTERNED_INDEX_SIZE);
|
||||
return with_span_interner(|interner| *interner.get(index));
|
||||
};
|
||||
SpanData { lo: BytePos(base), hi: BytePos(base + len), ctxt: SyntaxContext(ctxt) }
|
||||
SpanData { lo: BytePos(base), hi: BytePos(base + len), ctxt: SyntaxContext::from_u32(ctxt) }
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue