hy/hy
Brandon T. Willard 010986e8ca Implement minimal macro namespacing and add tests
This commit adds just enough namespacing to resolve a macro first in the macro's
defining module's namespace (i.e. the module assigned to the `HyASTCompiler`),
then in the namespace/module it's evaluated in.  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 couple tests have been added that cover
- the loading of module-level macros
  - e.g. that only macros defined in the `require`d module are added
- the AST generated for `require`
  - using macros loaded from modules imported via bytecode
- the non-local macro namespace resolution described above
  - a `require`d macro that uses a macro `require` exclusively in its
    module-level namespace
- and that (second-degree `require`d) macros can reference variables within
  their module-level namespaces.

Closes hylang/hy#1268, closes hylang/hy#1650, closes hylang/hy#1416.
2018-11-08 22:57:17 -06:00
..
contrib Produce Python AST for require statements and skip self requires 2018-11-08 22:57:17 -06:00
core Produce Python AST for require statements and skip self requires 2018-11-08 22:57:17 -06:00
extra Produce Python AST for require statements and skip self requires 2018-11-08 22:57:17 -06:00
lex Delay importing the lexer and parser 2018-08-18 18:05:40 -04:00
__init__.py Remove support for cons cells 2018-04-12 16:45:17 -07:00
__main__.py Make all files comply with license-header policy 2017-04-27 14:16:57 -07:00
_compat.py Implement new importer using PEP-302 semantics 2018-08-25 22:50:38 -05:00
cmdline.py Produce Python AST for require statements and skip self requires 2018-11-08 22:57:17 -06:00
compiler.py Produce Python AST for require statements and skip self requires 2018-11-08 22:57:17 -06:00
completer.py Produce Python AST for require statements and skip self requires 2018-11-08 22:57:17 -06:00
errors.py Update copyright years 2018-01-01 10:38:33 -05:00
importer.py Produce Python AST for require statements and skip self requires 2018-11-08 22:57:17 -06:00
macros.py Implement minimal macro namespacing and add tests 2018-11-08 22:57:17 -06:00
model_patterns.py Fix handling of unpacking in method calls and attribute lookups 2018-07-24 09:45:00 -07:00
models.py Implement minimal macro namespacing and add tests 2018-11-08 22:57:17 -06:00