@@ -11,6 +11,7 @@ Licensed under MIT License, see LICENSE.md
1111module ModuleInterfaceTools
1212
1313const debug = Ref (false )
14+ const showeval = Ref (false )
1415
1516const V6_COMPAT = VERSION < v " 0.7-"
1617const BIG_ENDIAN = (ENDIAN_BOM == 0x01020304 )
7879
7980function m_eval (mod, expr)
8081 try
82+ showeval[] && println (" m_eval($mod , $expr )" )
8183 Core. eval (mod, expr)
8284 catch ex
8385 println (" m_eval($mod , $expr )" );
@@ -252,13 +254,13 @@ function _add_symbols(curmod, grp, exprs)
252254end
253255
254256has_api (mod) = isdefined (mod, :__api__ )
255- get_api (mod) = m_eval (mod , :__api__ )
257+ get_api (curmod, mod) = m_eval (curmod , :( $ mod . __api__ ) )
256258
257259function _api_extend (curmod, modules, cpy:: Bool )
258260 for nam in modules
259261 mod = m_eval (curmod, nam)
260262 if has_api (mod)
261- api = get_api (mod)
263+ api = get_api (curmod, mod)
262264 _do_list (curmod, cpy, :import , Base, :Base , :base , api)
263265 _do_list (curmod, cpy, :import , mod, nam, :public! , api)
264266 _do_list (curmod, cpy, :import , mod, nam, :develop! , api)
@@ -275,7 +277,7 @@ function _api_use(curmod, modules, cpy::Bool)
275277 for nam in modules
276278 mod = m_eval (curmod, nam)
277279 if has_api (mod)
278- api = get_api (mod)
280+ api = get_api (curmod, mod)
279281 _do_list (curmod, cpy, :using , mod, nam, :public , api)
280282 _do_list (curmod, cpy, :using , mod, nam, :public! , api)
281283 else
288290function _api_export (curmod, modules)
289291 for nam in modules
290292 mod = m_eval (curmod, nam)
291- api = get_api (mod)
292293 if has_api (mod)
293- api = get_api (mod)
294+ api = get_api (curmod, mod)
294295 m_eval (curmod, Expr ( :export , getfield (api, :modules )... ))
295296 m_eval (curmod, Expr ( :export , getfield (api, :public )... ))
296297 m_eval (curmod, Expr ( :export , getfield (api, :public! )... ))
@@ -354,7 +355,8 @@ function _api(curmod::Module, cmd::Symbol, exprs)
354355 for nam in modules
355356 mod = m_eval (curmod, nam)
356357 if has_api (mod)
357- for sym in getfield (get_api (mod), :modules )
358+ api = get_api (curmod, mod)
359+ for sym in getfield (api, :modules )
358360 if isdefined (mod, sym)
359361 m_eval (curmod, :(using $ nam.$ sym))
360362 cpy && m_eval (curmod, :( push! (__tmp_api__. modules, $ (QuoteNode (sym)) )))
0 commit comments