@@ -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
}
@@ -548,6 +550,7 @@ impl<'a> Parser<'a> {
548
550
///
549
551
/// This method will automatically add `tok` to `expected_tokens` if `tok` is not
550
552
/// encountered.
553
+ #[ inline]
551
554
fn check ( & mut self , tok : & TokenKind ) -> bool {
552
555
let is_present = self . token == * tok;
553
556
if !is_present {
@@ -556,6 +559,7 @@ impl<'a> Parser<'a> {
556
559
is_present
557
560
}
558
561
562
+ #[ inline]
559
563
fn check_noexpect ( & self , tok : & TokenKind ) -> bool {
560
564
self . token == * tok
561
565
}
@@ -564,6 +568,7 @@ impl<'a> Parser<'a> {
564
568
///
565
569
/// the main purpose of this function is to reduce the cluttering of the suggestions list
566
570
/// which using the normal eat method could introduce in some cases.
571
+ #[ inline]
567
572
pub fn eat_noexpect ( & mut self , tok : & TokenKind ) -> bool {
568
573
let is_present = self . check_noexpect ( tok) ;
569
574
if is_present {
@@ -573,6 +578,7 @@ impl<'a> Parser<'a> {
573
578
}
574
579
575
580
/// Consumes a token 'tok' if it exists. Returns whether the given token was present.
581
+ #[ inline]
576
582
pub fn eat ( & mut self , tok : & TokenKind ) -> bool {
577
583
let is_present = self . check ( tok) ;
578
584
if is_present {
@@ -583,11 +589,13 @@ impl<'a> Parser<'a> {
583
589
584
590
/// If the next token is the given keyword, returns `true` without eating it.
585
591
/// An expectation is also added for diagnostics purposes.
592
+ #[ inline]
586
593
fn check_keyword ( & mut self , kw : Symbol ) -> bool {
587
594
self . expected_tokens . push ( TokenType :: Keyword ( kw) ) ;
588
595
self . token . is_keyword ( kw)
589
596
}
590
597
598
+ #[ inline]
591
599
fn check_keyword_case ( & mut self , kw : Symbol , case : Case ) -> bool {
592
600
if self . check_keyword ( kw) {
593
601
return true ;
@@ -606,6 +614,7 @@ impl<'a> Parser<'a> {
606
614
/// If the next token is the given keyword, eats it and returns `true`.
607
615
/// Otherwise, returns `false`. An expectation is also added for diagnostics purposes.
608
616
// Public for rustfmt usage.
617
+ #[ inline]
609
618
pub fn eat_keyword ( & mut self , kw : Symbol ) -> bool {
610
619
if self . check_keyword ( kw) {
611
620
self . bump ( ) ;
@@ -618,6 +627,7 @@ impl<'a> Parser<'a> {
618
627
/// Eats a keyword, optionally ignoring the case.
619
628
/// If the case differs (and is ignored) an error is issued.
620
629
/// This is useful for recovery.
630
+ #[ inline]
621
631
fn eat_keyword_case ( & mut self , kw : Symbol , case : Case ) -> bool {
622
632
if self . eat_keyword ( kw) {
623
633
return true ;
@@ -635,6 +645,7 @@ impl<'a> Parser<'a> {
635
645
false
636
646
}
637
647
648
+ #[ inline]
638
649
fn eat_keyword_noexpect ( & mut self , kw : Symbol ) -> bool {
639
650
if self . token . is_keyword ( kw) {
640
651
self . bump ( ) ;
@@ -656,6 +667,7 @@ impl<'a> Parser<'a> {
656
667
self . token . is_keyword ( kw) && self . look_ahead ( 1 , |t| t. is_ident ( ) && !t. is_reserved_ident ( ) )
657
668
}
658
669
670
+ #[ inline]
659
671
fn check_or_expected ( & mut self , ok : bool , typ : TokenType ) -> bool {
660
672
if ok {
661
673
true
@@ -703,6 +715,7 @@ impl<'a> Parser<'a> {
703
715
704
716
/// Checks to see if the next token is either `+` or `+=`.
705
717
/// Otherwise returns `false`.
718
+ #[ inline]
706
719
fn check_plus ( & mut self ) -> bool {
707
720
self . check_or_expected (
708
721
self . token . is_like_plus ( ) ,
0 commit comments