@@ -449,6 +449,7 @@ impl<'a> Parser<'a> {
449
449
parser
450
450
}
451
451
452
+ #[ inline]
452
453
pub fn recovery ( mut self , recovery : Recovery ) -> Self {
453
454
self . recovery = recovery;
454
455
self
@@ -461,6 +462,7 @@ impl<'a> Parser<'a> {
461
462
///
462
463
/// Technically, this only needs to restrict eager recovery by doing lookahead at more tokens.
463
464
/// But making the distinction is very subtle, and simply forbidding all recovery is a lot simpler to uphold.
465
+ #[ inline]
464
466
fn may_recover ( & self ) -> bool {
465
467
matches ! ( self . recovery, Recovery :: Allowed )
466
468
}
@@ -542,6 +544,7 @@ impl<'a> Parser<'a> {
542
544
///
543
545
/// This method will automatically add `tok` to `expected_tokens` if `tok` is not
544
546
/// encountered.
547
+ #[ inline]
545
548
fn check ( & mut self , tok : & TokenKind ) -> bool {
546
549
let is_present = self . token == * tok;
547
550
if !is_present {
@@ -550,6 +553,7 @@ impl<'a> Parser<'a> {
550
553
is_present
551
554
}
552
555
556
+ #[ inline]
553
557
fn check_noexpect ( & self , tok : & TokenKind ) -> bool {
554
558
self . token == * tok
555
559
}
@@ -558,6 +562,7 @@ impl<'a> Parser<'a> {
558
562
///
559
563
/// the main purpose of this function is to reduce the cluttering of the suggestions list
560
564
/// which using the normal eat method could introduce in some cases.
565
+ #[ inline]
561
566
pub fn eat_noexpect ( & mut self , tok : & TokenKind ) -> bool {
562
567
let is_present = self . check_noexpect ( tok) ;
563
568
if is_present {
@@ -567,6 +572,7 @@ impl<'a> Parser<'a> {
567
572
}
568
573
569
574
/// Consumes a token 'tok' if it exists. Returns whether the given token was present.
575
+ #[ inline]
570
576
pub fn eat ( & mut self , tok : & TokenKind ) -> bool {
571
577
let is_present = self . check ( tok) ;
572
578
if is_present {
@@ -577,11 +583,13 @@ impl<'a> Parser<'a> {
577
583
578
584
/// If the next token is the given keyword, returns `true` without eating it.
579
585
/// An expectation is also added for diagnostics purposes.
586
+ #[ inline]
580
587
fn check_keyword ( & mut self , kw : Symbol ) -> bool {
581
588
self . expected_tokens . push ( TokenType :: Keyword ( kw) ) ;
582
589
self . token . is_keyword ( kw)
583
590
}
584
591
592
+ #[ inline]
585
593
fn check_keyword_case ( & mut self , kw : Symbol , case : Case ) -> bool {
586
594
if self . check_keyword ( kw) {
587
595
return true ;
@@ -600,6 +608,7 @@ impl<'a> Parser<'a> {
600
608
/// If the next token is the given keyword, eats it and returns `true`.
601
609
/// Otherwise, returns `false`. An expectation is also added for diagnostics purposes.
602
610
// Public for rustfmt usage.
611
+ #[ inline]
603
612
pub fn eat_keyword ( & mut self , kw : Symbol ) -> bool {
604
613
if self . check_keyword ( kw) {
605
614
self . bump ( ) ;
@@ -612,6 +621,7 @@ impl<'a> Parser<'a> {
612
621
/// Eats a keyword, optionally ignoring the case.
613
622
/// If the case differs (and is ignored) an error is issued.
614
623
/// This is useful for recovery.
624
+ #[ inline]
615
625
fn eat_keyword_case ( & mut self , kw : Symbol , case : Case ) -> bool {
616
626
if self . eat_keyword ( kw) {
617
627
return true ;
@@ -629,6 +639,7 @@ impl<'a> Parser<'a> {
629
639
false
630
640
}
631
641
642
+ #[ inline]
632
643
fn eat_keyword_noexpect ( & mut self , kw : Symbol ) -> bool {
633
644
if self . token . is_keyword ( kw) {
634
645
self . bump ( ) ;
@@ -650,6 +661,7 @@ impl<'a> Parser<'a> {
650
661
self . token . is_keyword ( kw) && self . look_ahead ( 1 , |t| t. is_ident ( ) && !t. is_reserved_ident ( ) )
651
662
}
652
663
664
+ #[ inline]
653
665
fn check_or_expected ( & mut self , ok : bool , typ : TokenType ) -> bool {
654
666
if ok {
655
667
true
@@ -697,6 +709,7 @@ impl<'a> Parser<'a> {
697
709
698
710
/// Checks to see if the next token is either `+` or `+=`.
699
711
/// Otherwise returns `false`.
712
+ #[ inline]
700
713
fn check_plus ( & mut self ) -> bool {
701
714
self . check_or_expected (
702
715
self . token . is_like_plus ( ) ,
0 commit comments