-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement minimal macro namespacing and add tests
This commit adds just enough namespacing to resolve a macro first in the Hy compilation namespace (i.e. the module assigned to the `HyASTCompiler`), then in the namespace it was defined. Namespacing is accomplished by adding a `module` attribute to `HySymbol`, so that `HyExpression`s can be checked for this definition namespace attribute and their car symbol resolved per the above. As well, a test is included that covers module-level macros (i.e. via `__macros` and `__tags__`), AST generated for `require`, and the non-local macro namespace resolution described above. Closes #1268, closes #1650, closes #1416.
- Loading branch information
1 parent
dde28d7
commit 4b8b706
Showing
6 changed files
with
130 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(require [hy.contrib.walk [let]]) | ||
|
||
(defmacro test-module-macro [a] | ||
`(let [b 1] (+ b ~a))) | ||
|
||
(deftag test-module-tag [a] | ||
`(let [b 1] (+ b ~a))) |