summaryrefslogtreecommitdiff
path: root/xmake/core/base
diff options
context:
space:
mode:
authorruki <[email protected]>2016-04-11 14:08:47 +0800
committerruki <[email protected]>2016-04-11 14:08:47 +0800
commit833bfb207b3f924eaa81feb496cf74e6223d0041 (patch)
tree0b1774ba14cbe63ecb6eb347deea19975f2c8554 /xmake/core/base
parent71296f55db2d5b0a9249592c3428797708cd0683 (diff)
add new tool module
Diffstat (limited to 'xmake/core/base')
-rw-r--r--xmake/core/base/deprecated/interpreter.lua2
-rw-r--r--xmake/core/base/filter.lua14
-rw-r--r--xmake/core/base/interpreter.lua2
3 files changed, 7 insertions, 11 deletions
diff --git a/xmake/core/base/deprecated/interpreter.lua b/xmake/core/base/deprecated/interpreter.lua
index 22e0cde00..ec06d8866 100644
--- a/xmake/core/base/deprecated/interpreter.lua
+++ b/xmake/core/base/deprecated/interpreter.lua
@@ -122,7 +122,7 @@ function deprecated_interpreter:api_register_set_script(scope_kind, prefix, ...)
utils.warning("please uses on_%s(), \"set_%s()\" has been deprecated!", name, name, scope)
-- make sandbox instance with the given script
- local instance, errors = sandbox.new(script, self)
+ local instance, errors = sandbox.new(script, self:filter(), self:rootdir())
if not instance then
os.raise("set_%s(): %s", name, errors)
end
diff --git a/xmake/core/base/filter.lua b/xmake/core/base/filter.lua
index a23bc25a4..7a77a98a1 100644
--- a/xmake/core/base/filter.lua
+++ b/xmake/core/base/filter.lua
@@ -29,18 +29,14 @@ local table = require("base/table")
local utils = require("base/utils")
local string = require("base/string")
--- init filter
-function filter.init(handler)
+-- new filter instance
+function filter.new(handler)
-- init an filter instance
- local self = {_HANDLER = handler}
+ local self = table.inherit(filter)
- -- inherit the interfaces of filter
- for k, v in pairs(filter) do
- if type(v) == "function" then
- self[k] = v
- end
- end
+ -- save handler
+ self._HANDLER = handler
-- ok
return self
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua
index 97be6a9e7..47b4d02a7 100644
--- a/xmake/core/base/interpreter.lua
+++ b/xmake/core/base/interpreter.lua
@@ -742,7 +742,7 @@ function interpreter:api_register_on_script(scope_kind, prefix, ...)
local implementation = function (self, scope, name, script)
-- make sandbox instance with the given script
- local instance, errors = sandbox.new(script, self)
+ local instance, errors = sandbox.new(script, self:filter(), self:rootdir())
if not instance then
os.raise("on_%s(): %s", name, errors)
end