Modify the inscribe decorator to accept a dict.

This commit is contained in:
Simon Forman 2021-11-24 15:05:55 -08:00
parent 0c51a3fc7d
commit d96f0bbb99
1 changed files with 3 additions and 4 deletions

View File

@ -58,9 +58,9 @@ HELP_TEMPLATE = '''\
_dictionary = {}
def inscribe(function):
def inscribe(function, d=_dictionary):
'''A decorator to inscribe functions into the default dictionary.'''
_dictionary[function.name] = function
d[function.name] = function
return function
@ -351,8 +351,7 @@ def inscribe_(stack, expression, dictionary):
'''
(name, body), stack = stack
d = Def(name, body)
dictionary[d.name] = d
inscribe(Def(name, body), dictionary)
return stack, expression, dictionary