-
Notifications
You must be signed in to change notification settings - Fork 9
support old-style macros #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -145,8 +145,16 @@ function expand_macro(ctx, ex) | |
| end | ||
| macro_invocation_world = Base.get_world_counter() | ||
| expanded = try | ||
| # TODO: Allow invoking old-style macros for compat | ||
| invokelatest(macfunc, macro_args...) | ||
| if applicable(macfunc, macro_args...) | ||
| invokelatest(macfunc, macro_args...) | ||
| else | ||
| # try old-style macro | ||
| args = [Expr(x) for x in macro_args[2:end]] | ||
| line, _ = source_location(macname) | ||
| file = filename(macname) | ||
| line_number_node = Base.LineNumberNode(line, file) | ||
| invokelatest(macfunc, line_number_node, ctx.current_layer.mod, args...) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah right. So this approach doesn't work if the old macro returns an AST, because that AST will be In that case we need full bidirectional |
||
| end | ||
| catch exc | ||
| if exc isa MacroExpansionError | ||
| # Add context to the error. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.