Skip to content

Commit deefe9a

Browse files
committed
Use Ripper::EXPR_LABEL directly
Since this is only used from outside RipperStateLex, there's no longer any benefit to using the indirect reference rather than just going straight to Ripper.
1 parent 5996255 commit deefe9a

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

lib/rdoc/parser/ripper_state_lex.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class RDoc::Parser::RipperStateLex
1313
EXPR_ENDFN = Ripper::EXPR_ENDFN
1414
EXPR_ARG = Ripper::EXPR_ARG
1515
EXPR_FNAME = Ripper::EXPR_FNAME
16-
EXPR_LABEL = Ripper::EXPR_LABEL
1716

1817
class InnerStateLex < Ripper::Filter
1918
def initialize(code)

lib/rdoc/parser/ruby.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ def get_included_module_with_optional_parens
513513
when :on_comment, :on_embdoc then
514514
@read.pop
515515
if :on_nl == end_token[:kind] and "\n" == tk[:text][-1] and
516-
(!continue or (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) != 0) then
516+
(!continue or (tk[:state] & Ripper::EXPR_LABEL) != 0) then
517517
break if !continue and nest <= 0
518518
end
519519
when :on_comma then
@@ -526,7 +526,7 @@ def get_included_module_with_optional_parens
526526
nest += 1
527527
when 'if', 'unless', 'while', 'until', 'rescue'
528528
# postfix if/unless/while/until/rescue must be EXPR_LABEL
529-
nest += 1 unless (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) != 0
529+
nest += 1 unless (tk[:state] & Ripper::EXPR_LABEL) != 0
530530
when 'end'
531531
nest -= 1
532532
break if nest == 0
@@ -1041,7 +1041,7 @@ def parse_constant_body container, constant, is_array_or_hash # :nodoc:
10411041
elsif (:on_kw == tk[:kind] && 'def' == tk[:text]) then
10421042
nest += 1
10431043
elsif (:on_kw == tk[:kind] && %w{do if unless case begin}.include?(tk[:text])) then
1044-
if (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) == 0
1044+
if (tk[:state] & Ripper::EXPR_LABEL) == 0
10451045
nest += 1
10461046
end
10471047
elsif [:on_rparen, :on_rbrace, :on_rbracket].include?(tk[:kind]) ||
@@ -1662,7 +1662,7 @@ def parse_method_or_yield_parameters(method = nil,
16621662
when :on_comment, :on_embdoc then
16631663
@read.pop
16641664
if :on_nl == end_token[:kind] and "\n" == tk[:text][-1] and
1665-
(!continue or (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) != 0) then
1665+
(!continue or (tk[:state] & Ripper::EXPR_LABEL) != 0) then
16661666
if method && method.block_params.nil? then
16671667
unget_tk tk
16681668
read_documentation_modifiers method, modifiers
@@ -1882,7 +1882,7 @@ def parse_statements(container, single = NORMAL, current_method = nil,
18821882
end
18831883

18841884
when 'until', 'while' then
1885-
if (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) == 0
1885+
if (tk[:state] & Ripper::EXPR_LABEL) == 0
18861886
nest += 1
18871887
skip_optional_do_after_expression
18881888
end
@@ -1898,7 +1898,7 @@ def parse_statements(container, single = NORMAL, current_method = nil,
18981898
skip_optional_do_after_expression
18991899

19001900
when 'case', 'do', 'if', 'unless', 'begin' then
1901-
if (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) == 0
1901+
if (tk[:state] & Ripper::EXPR_LABEL) == 0
19021902
nest += 1
19031903
end
19041904

0 commit comments

Comments
 (0)