Skip to content

Commit

Permalink
Reload affected modules before calling detect_macros
Browse files Browse the repository at this point in the history
Resolves #2. Allows us to use a stock MacroPy.
  • Loading branch information
Technologicat committed Feb 10, 2020
1 parent cc58155 commit e502cb3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions imacropy/iconsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
from macropy import __version__ as macropy_version
from macropy.core.macros import ModuleExpansionContext, detect_macros

from .util import reload_macro_modules

_placeholder = "<interactive input>"
_instance = None

Expand Down Expand Up @@ -78,6 +80,7 @@ def __init__(self, extension_instance, *args, **kwargs):

def visit(self, tree):
try:
reload_macro_modules(tree, '__main__')
bindings = detect_macros(tree, '__main__') # macro imports
if bindings:
self.ext.macro_bindings_changed = True
Expand Down

0 comments on commit e502cb3

Please sign in to comment.