@@ -27,16 +27,16 @@ use std::fmt;
27
27
28
28
/// A SyntaxContext represents a chain of macro expansions (represented by marks).
29
29
#[ derive( Clone , Copy , PartialEq , Eq , Default , PartialOrd , Ord , Hash ) ]
30
- pub struct SyntaxContext ( pub ( super ) u32 ) ;
30
+ pub struct SyntaxContext ( u32 ) ;
31
31
32
32
#[ derive( Copy , Clone , Debug ) ]
33
- pub struct SyntaxContextData {
34
- pub outer_mark : Mark ,
35
- pub prev_ctxt : SyntaxContext ,
33
+ struct SyntaxContextData {
34
+ outer_mark : Mark ,
35
+ prev_ctxt : SyntaxContext ,
36
36
// This context, but with all transparent and semi-transparent marks filtered away.
37
- pub opaque : SyntaxContext ,
37
+ opaque : SyntaxContext ,
38
38
// This context, but with all transparent marks filtered away.
39
- pub opaque_and_semitransparent : SyntaxContext ,
39
+ opaque_and_semitransparent : SyntaxContext ,
40
40
}
41
41
42
42
/// A mark is a unique id associated with a macro expansion.
@@ -198,15 +198,15 @@ impl Mark {
198
198
}
199
199
200
200
#[ derive( Debug ) ]
201
- pub struct HygieneData {
201
+ crate struct HygieneData {
202
202
marks : Vec < MarkData > ,
203
203
syntax_contexts : Vec < SyntaxContextData > ,
204
204
markings : HashMap < ( SyntaxContext , Mark ) , SyntaxContext > ,
205
205
default_edition : Edition ,
206
206
}
207
207
208
208
impl HygieneData {
209
- pub fn new ( ) -> Self {
209
+ crate fn new ( ) -> Self {
210
210
HygieneData {
211
211
marks : vec ! [ MarkData {
212
212
parent: Mark :: root( ) ,
@@ -249,6 +249,14 @@ impl SyntaxContext {
249
249
SyntaxContext ( 0 )
250
250
}
251
251
252
+ crate fn as_u32 ( self ) -> u32 {
253
+ self . 0
254
+ }
255
+
256
+ crate fn from_u32 ( raw : u32 ) -> SyntaxContext {
257
+ SyntaxContext ( raw)
258
+ }
259
+
252
260
// Allocate a new SyntaxContext with the given ExpnInfo. This is used when
253
261
// deserializing Spans from the incr. comp. cache.
254
262
// FIXME(mw): This method does not restore MarkData::parent or
0 commit comments