@@ -11,6 +11,7 @@ Licensed under MIT License, see LICENSE.md
11
11
module ModuleInterfaceTools
12
12
13
13
const debug = Ref (false )
14
+ const showeval = Ref (false )
14
15
15
16
const V6_COMPAT = VERSION < v " 0.7-"
16
17
const BIG_ENDIAN = (ENDIAN_BOM == 0x01020304 )
78
79
79
80
function m_eval (mod, expr)
80
81
try
82
+ showeval[] && println (" m_eval($mod , $expr )" )
81
83
Core. eval (mod, expr)
82
84
catch ex
83
85
println (" m_eval($mod , $expr )" );
@@ -252,13 +254,13 @@ function _add_symbols(curmod, grp, exprs)
252
254
end
253
255
254
256
has_api (mod) = isdefined (mod, :__api__ )
255
- get_api (mod) = m_eval (mod , :__api__ )
257
+ get_api (curmod, mod) = m_eval (curmod , :( $ mod . __api__ ) )
256
258
257
259
function _api_extend (curmod, modules, cpy:: Bool )
258
260
for nam in modules
259
261
mod = m_eval (curmod, nam)
260
262
if has_api (mod)
261
- api = get_api (mod)
263
+ api = get_api (curmod, mod)
262
264
_do_list (curmod, cpy, :import , Base, :Base , :base , api)
263
265
_do_list (curmod, cpy, :import , mod, nam, :public! , api)
264
266
_do_list (curmod, cpy, :import , mod, nam, :develop! , api)
@@ -275,7 +277,7 @@ function _api_use(curmod, modules, cpy::Bool)
275
277
for nam in modules
276
278
mod = m_eval (curmod, nam)
277
279
if has_api (mod)
278
- api = get_api (mod)
280
+ api = get_api (curmod, mod)
279
281
_do_list (curmod, cpy, :using , mod, nam, :public , api)
280
282
_do_list (curmod, cpy, :using , mod, nam, :public! , api)
281
283
else
288
290
function _api_export (curmod, modules)
289
291
for nam in modules
290
292
mod = m_eval (curmod, nam)
291
- api = get_api (mod)
292
293
if has_api (mod)
293
- api = get_api (mod)
294
+ api = get_api (curmod, mod)
294
295
m_eval (curmod, Expr ( :export , getfield (api, :modules )... ))
295
296
m_eval (curmod, Expr ( :export , getfield (api, :public )... ))
296
297
m_eval (curmod, Expr ( :export , getfield (api, :public! )... ))
@@ -354,7 +355,8 @@ function _api(curmod::Module, cmd::Symbol, exprs)
354
355
for nam in modules
355
356
mod = m_eval (curmod, nam)
356
357
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 )
358
360
if isdefined (mod, sym)
359
361
m_eval (curmod, :(using $ nam.$ sym))
360
362
cpy && m_eval (curmod, :( push! (__tmp_api__. modules, $ (QuoteNode (sym)) )))
0 commit comments