File tree 3 files changed +11
-4
lines changed
3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -416,6 +416,8 @@ mod test {
416
416
417
417
use syntax_pos:: DUMMY_SP ;
418
418
use syntax:: ast:: * ;
419
+ use syntax:: attr;
420
+ use syntax:: source_map:: dummy_spanned;
419
421
use syntax:: symbol:: Symbol ;
420
422
use syntax:: with_globals;
421
423
Original file line number Diff line number Diff line change @@ -1351,12 +1351,17 @@ pub enum StrStyle {
1351
1351
Raw ( u16 ) ,
1352
1352
}
1353
1353
1354
- /// A literal.
1354
+ /// An AST literal.
1355
1355
#[ derive( Clone , RustcEncodable , RustcDecodable , Debug ) ]
1356
1356
pub struct Lit {
1357
- pub node : LitKind ,
1357
+ /// The original literal token as written in source code.
1358
1358
pub token : token:: Lit ,
1359
+ /// The original literal suffix as written in source code.
1359
1360
pub suffix : Option < Symbol > ,
1361
+ /// The "semantic" representation of the literal lowered from the original tokens.
1362
+ /// Strings are unescaped, hexadecimal forms are eliminated, etc.
1363
+ /// FIXME: Remove this and only create the semantic representation during lowering to HIR.
1364
+ pub node : LitKind ,
1360
1365
pub span : Span ,
1361
1366
}
1362
1367
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ macro_rules! err {
27
27
28
28
impl LitKind {
29
29
/// Converts literal token with a suffix into a semantic literal.
30
- /// Works speculatively and may return `None` is diagnostic handler is not passed.
30
+ /// Works speculatively and may return `None` if diagnostic handler is not passed.
31
31
/// If diagnostic handler is passed, always returns `Some`,
32
32
/// possibly after reporting non-fatal errors and recovery.
33
33
fn from_lit_token (
@@ -166,7 +166,7 @@ impl LitKind {
166
166
167
167
impl Lit {
168
168
/// Converts literal token with a suffix into an AST literal.
169
- /// Works speculatively and may return `None` is diagnostic handler is not passed.
169
+ /// Works speculatively and may return `None` if diagnostic handler is not passed.
170
170
/// If diagnostic handler is passed, may return `Some`,
171
171
/// possibly after reporting non-fatal errors and recovery, or `None` for irrecoverable errors.
172
172
crate fn from_token (
You can’t perform that action at this time.
0 commit comments