summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-05-25 22:48:03 +0800
committerruki <[email protected]>2020-05-25 10:48:21 +0800
commit187f0a4648d0ffadcb8d80b3481b570af9b996b9 (patch)
tree5e7ec5470c9a5aeeb57b90040679ba0019ac3d8a
parentbca5559faa5c0d71f286aa95b070eb99dc186042 (diff)
fix interpreter
-rw-r--r--xmake/core/base/interpreter.lua17
-rw-r--r--xmake/core/base/scopeinfo.lua12
2 files changed, 13 insertions, 16 deletions
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua
index 1c301e891..854212cc9 100644
--- a/xmake/core/base/interpreter.lua
+++ b/xmake/core/base/interpreter.lua
@@ -1118,16 +1118,13 @@ function interpreter:api_register_set_keyvalues(scope_kind, ...)
extra_config = nil
end
- -- expand values if only one
- values = table.unwrap(values)
-
-- save values to "name"
scope[name] = scope[name] or {}
- scope[name][key] = values
+ scope[name][key] = table.unwrap(values) -- expand values if only one
-- save values to "name.key"
local name_key = name .. "." .. key
- scope[name_key] = values
+ scope[name_key] = scope[name][key]
-- fix override attributes
scope["__override_" .. name] = false
@@ -1165,12 +1162,14 @@ function interpreter:api_register_add_keyvalues(scope_kind, ...)
extra_config = nil
end
- -- expand values if only one
- values = table.unwrap(values)
-
-- save values to "name"
scope[name] = scope[name] or {}
- scope[name][key] = table.join2(table.wrap(scope[name][key]), values)
+ if scope[name][key] == nil then
+ -- expand values if only one
+ scope[name][key] = table.unwrap(values)
+ else
+ scope[name][key] = table.join2(table.wrap(scope[name][key]), values)
+ end
-- save values to "name.key"
local name_key = name .. "." .. key
diff --git a/xmake/core/base/scopeinfo.lua b/xmake/core/base/scopeinfo.lua
index c8bd2fec7..350d2ef95 100644
--- a/xmake/core/base/scopeinfo.lua
+++ b/xmake/core/base/scopeinfo.lua
@@ -173,9 +173,6 @@ function _instance:_api_set_keyvalues(name, key, ...)
extra_config = nil
end
- -- expand values if only one
- values = table.unwrap(values)
-
-- save values to "name"
scope[name] = scope[name] or {}
scope[name][key] = self:_api_handle(values)
@@ -213,12 +210,13 @@ function _instance:_api_add_keyvalues(name, key, ...)
extra_config = nil
end
- -- expand values if only one
- values = table.unwrap(values)
-
-- save values to "name"
scope[name] = scope[name] or {}
- scope[name][key] = self:_api_handle(table.join2(table.wrap(scope[name][key]), values))
+ if scope[name][key] == nil then
+ scope[name][key] = self:_api_handle(values)
+ else
+ scope[name][key] = self:_api_handle(table.join2(table.wrap(scope[name][key]), values))
+ end
-- save values to "name.key"
local name_key = name .. "." .. key