Skip to content

Commit

Permalink
Make assignments in writer->set_state() and writer->defer_call() local
Browse files Browse the repository at this point in the history
  • Loading branch information
Witiko committed Sep 2, 2021
1 parent c1fd53b commit 9261349
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions markdown.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -15771,8 +15771,8 @@ function M.writer.new(options)
% \end{markdown}
% \begin{macrocode}
function self.set_state(s)
previous_state = self.get_state()
for key, value in pairs(state) do
local previous_state = self.get_state()
for key, value in pairs(s) do
self[key] = value
end
return previous_state
Expand All @@ -15788,9 +15788,9 @@ function M.writer.new(options)
% \end{markdown}
% \begin{macrocode}
function self.defer_call(f)
state = self.get_state()
local previous_state = self.get_state()
return function(...)
state = self.set_state(state)
local state = self.set_state(previous_state)
local return_value = f(...)
self.set_state(state)
return return_value
Expand Down

0 comments on commit 9261349

Please sign in to comment.