summaryrefslogtreecommitdiff
path: root/xmake/core/base/interpreter.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-08-10 00:50:52 +0800
committerruki <[email protected]>2021-08-10 00:50:52 +0800
commit119b04dfa9e6971f324ba65d94737ad7eb31bc83 (patch)
tree98fe9942a10ce358824aa8a8d389bfc1ecb9c31e /xmake/core/base/interpreter.lua
parentae33b24ea5ecb6608168e869bb8ee94e0f674c98 (diff)
support to run snippets
Diffstat (limited to 'xmake/core/base/interpreter.lua')
-rw-r--r--xmake/core/base/interpreter.lua17
1 files changed, 15 insertions, 2 deletions
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua
index 2f26e20ce..ecfcc7270 100644
--- a/xmake/core/base/interpreter.lua
+++ b/xmake/core/base/interpreter.lua
@@ -1225,13 +1225,19 @@ function interpreter:api_register_set_dictionary(scope_kind, ...)
assert(self)
-- define implementation
- local implementation = function (self, scope, name, dict_or_key, value)
+ local implementation = function (self, scope, name, dict_or_key, value, extra_config)
-- check
if type(dict_or_key) == "table" then
scope[name] = dict_or_key
elseif type(dict_or_key) == "string" and value ~= nil then
scope[name] = {[dict_or_key] = value}
+ -- save extra config
+ if extra_config and table.is_dictionary(extra_config) then
+ scope["__extra_" .. name] = scope["__extra_" .. name] or {}
+ local extrascope = scope["__extra_" .. name]
+ extrascope[dict_or_key] = extra_config
+ end
else
-- error
os.raise("set_%s(%s): invalid value type!", name, type(dict))
@@ -1249,14 +1255,21 @@ function interpreter:api_register_add_dictionary(scope_kind, ...)
assert(self)
-- define implementation
- local implementation = function (self, scope, name, dict_or_key, value)
+ local implementation = function (self, scope, name, dict_or_key, value, extra_config)
-- check
scope[name] = scope[name] or {}
if type(dict_or_key) == "table" then
table.join2(scope[name], dict_or_key)
+ extra_config = value
elseif type(dict_or_key) == "string" and value ~= nil then
scope[name][dict_or_key] = value
+ -- save extra config
+ if extra_config and table.is_dictionary(extra_config) then
+ scope["__extra_" .. name] = scope["__extra_" .. name] or {}
+ local extrascope = scope["__extra_" .. name]
+ extrascope[dict_or_key] = extra_config
+ end
else
-- error
os.raise("add_%s(%s): invalid value type!", name, type(dict))