summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-07-26 15:16:52 +0800
committerruki <[email protected]>2017-07-26 15:16:52 +0800
commit41b7a4be4010495f6c6876534e9a78121021bb80 (patch)
treec41033bc70e2e27a8a3441167ec3a173fec2c109
parent58ccd0f2ee0de904eaabeea5d2d08581e6b2cdbb (diff)
fix import cache
-rw-r--r--xmake/core/sandbox/modules/import/core/sandbox/module.lua17
1 files changed, 9 insertions, 8 deletions
diff --git a/xmake/core/sandbox/modules/import/core/sandbox/module.lua b/xmake/core/sandbox/modules/import/core/sandbox/module.lua
index b0aa2c1ef..4a6425be7 100644
--- a/xmake/core/sandbox/modules/import/core/sandbox/module.lua
+++ b/xmake/core/sandbox/modules/import/core/sandbox/module.lua
@@ -370,12 +370,18 @@ function core_sandbox_module.import(name, opt)
, utils.ifelse(idx < #modules_directories, instance, nil) -- last modules need not fork sandbox
, module)
- -- continue to load?
- if module and isdirs then
- loadnext = true
+
+ -- cache this module
+ if not opt.nocache then
+ modules[modulekey] = {module, errors}
end
end
+ -- continue to load?
+ if module and isdirs then
+ loadnext = true
+ end
+
-- found
found = true
@@ -400,11 +406,6 @@ function core_sandbox_module.import(name, opt)
raise("cannot import module: %s, %s", name, errors)
end
- -- cache this module
- if not opt.nocache then
- modules[modulekey] = modules[modulekey] or {module, errors}
- end
-
-- get module script
local script = errors