From 51c7a972cec34cb32c49846912d4752a91ca4b46 Mon Sep 17 00:00:00 2001 From: Herwin Date: Mon, 24 Jun 2024 10:57:33 +0200 Subject: [PATCH] Remove current_locals method from Pass1 This is internal information, and should not be exposed to the outside users. --- lib/natalie/compiler/pass1.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/natalie/compiler/pass1.rb b/lib/natalie/compiler/pass1.rb index bc4cf8730..7fed9a17f 100644 --- a/lib/natalie/compiler/pass1.rb +++ b/lib/natalie/compiler/pass1.rb @@ -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) @@ -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