Skip to content

Commit f203c56

Browse files
committed
libsyntax: De-@mut quote_depth in the parser
1 parent b311649 commit f203c56

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/libsyntax/ext/quote.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ fn expand_tts(cx: &ExtCtxt, sp: Span, tts: &[ast::token_tree])
590590
let mut p = parse::new_parser_from_tts(cx.parse_sess(),
591591
cx.cfg(),
592592
tts.to_owned());
593-
*p.quote_depth += 1u;
593+
p.quote_depth += 1u;
594594

595595
let cx_expr = p.parse_expr();
596596
if !p.eat(&token::COMMA) {

src/libsyntax/ext/tt/macro_parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,9 @@ pub fn parse_nt(p: &mut Parser, name: &str) -> nonterminal {
448448
}
449449
"attr" => token::nt_attr(@p.parse_attribute(false)),
450450
"tt" => {
451-
*p.quote_depth += 1u; //but in theory, non-quoted tts might be useful
451+
p.quote_depth += 1u; //but in theory, non-quoted tts might be useful
452452
let res = token::nt_tt(@p.parse_token_tree());
453-
*p.quote_depth -= 1u;
453+
p.quote_depth -= 1u;
454454
res
455455
}
456456
"matchers" => token::nt_matchers(p.parse_matchers()),

src/libsyntax/parse/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ pub fn parse_tts_from_source_str(
175175
name,
176176
source
177177
);
178-
*p.quote_depth += 1u;
178+
p.quote_depth += 1u;
179179
// right now this is re-creating the token trees from ... token trees.
180180
maybe_aborted(p.parse_all_token_trees(),p)
181181
}

src/libsyntax/parse/parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ pub fn Parser(sess: @mut ParseSess,
315315
buffer_end: @mut 0,
316316
tokens_consumed: @mut 0,
317317
restriction: @mut UNRESTRICTED,
318-
quote_depth: @mut 0,
318+
quote_depth: 0,
319319
obsolete_set: @mut HashSet::new(),
320320
mod_path_stack: @mut ~[],
321321
open_braces: @mut ~[],
@@ -340,7 +340,7 @@ pub struct Parser {
340340
buffer_end: @mut int,
341341
tokens_consumed: @mut uint,
342342
restriction: @mut restriction,
343-
quote_depth: @mut uint, // not (yet) related to the quasiquoter
343+
quote_depth: uint, // not (yet) related to the quasiquoter
344344
reader: @mut reader,
345345
interner: @token::ident_interner,
346346
/// The set of seen errors about obsolete syntax. Used to suppress
@@ -2097,7 +2097,7 @@ impl Parser {
20972097
token_str))
20982098
},
20992099
/* we ought to allow different depths of unquotation */
2100-
token::DOLLAR if *p.quote_depth > 0u => {
2100+
token::DOLLAR if p.quote_depth > 0u => {
21012101
p.bump();
21022102
let sp = *p.span;
21032103

0 commit comments

Comments
 (0)