Skip to content

Commit

Permalink
Remove current_locals method from Pass1
Browse files Browse the repository at this point in the history
This is internal information, and should not be exposed to the outside
users.
  • Loading branch information
herwinw committed Jun 24, 2024
1 parent 7484ded commit 51c7a97
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/natalie/compiler/pass1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ def expand_macros(node)
@macro_expander.expand(node, locals: locals, depth: @depth, file: @file)
end

def current_locals
@locals_stack.last
end

def transform_body(body, location:, used:)
return transform_begin_node(body, used:) if body.is_a?(Prism::BeginNode)
body = body.body if body.is_a?(Prism::StatementsNode)
Expand Down Expand Up @@ -2007,7 +2003,7 @@ def transform_match_last_line_node(node, used:)
def transform_match_required_node(node, used:)
match_required_node_compiler = Transformers::MatchRequiredNode.new
code_str = match_required_node_compiler.call(node)
parser = Natalie::Parser.new(code_str, @file.path, locals: current_locals)
parser = Natalie::Parser.new(code_str, @file.path, locals: @locals_stack.last)
instructions = transform_expression(parser.ast.statements, used: false)
instructions << PushNilInstruction.new if used
instructions
Expand Down

0 comments on commit 51c7a97

Please sign in to comment.