summaryrefslogtreecommitdiff
path: root/xmake
diff options
context:
space:
mode:
Diffstat (limited to 'xmake')
-rw-r--r--xmake/core/base/interpreter.lua4
-rw-r--r--xmake/core/base/scopeinfo.lua4
-rw-r--r--xmake/core/base/table.lua8
3 files changed, 8 insertions, 8 deletions
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua
index a226d3db2..50d7f3149 100644
--- a/xmake/core/base/interpreter.lua
+++ b/xmake/core/base/interpreter.lua
@@ -1066,7 +1066,7 @@ function interpreter:api_register_set_values(scope_kind, ...)
if extra_config and extra_config.expand == false then
for _, value in ipairs(values) do
if type(value) == "table" then
- setmetatable(value, {})
+ value.__object__ = true
end
end
else
@@ -1118,7 +1118,7 @@ function interpreter:api_register_add_values(scope_kind, ...)
if extra_config and extra_config.expand == false then
for _, value in ipairs(values) do
if type(value) == "table" then
- setmetatable(value, {})
+ value.__object__ = true
end
end
else
diff --git a/xmake/core/base/scopeinfo.lua b/xmake/core/base/scopeinfo.lua
index 02fb89299..4e0d5a73c 100644
--- a/xmake/core/base/scopeinfo.lua
+++ b/xmake/core/base/scopeinfo.lua
@@ -120,7 +120,7 @@ function _instance:_api_set_values(name, ...)
if extra_config and extra_config.expand == false then
for _, value in ipairs(values) do
if type(value) == "table" then
- setmetatable(value, {})
+ value.__object__ = true
end
end
else
@@ -171,7 +171,7 @@ function _instance:_api_add_values(name, ...)
if extra_config and extra_config.expand == false then
for _, value in ipairs(values) do
if type(value) == "table" then
- setmetatable(value, {})
+ value.__object__ = true
end
end
else
diff --git a/xmake/core/base/table.lua b/xmake/core/base/table.lua
index 73556c9fc..232f6962a 100644
--- a/xmake/core/base/table.lua
+++ b/xmake/core/base/table.lua
@@ -165,9 +165,9 @@ end
-- copy the table to self
function table.copy2(self, copied)
- assert(type(copied) == "table")
table.clear(self)
- for k, v in pairs(copied) do
+ copied = copied or {}
+ for k, v in pairs(table.wrap(copied)) do
self[k] = v
end
end
@@ -310,7 +310,7 @@ end
-- unwrap object if be only one
function table.unwrap(object)
- if type(object) == "table" and not getmetatable(object) then
+ if type(object) == "table" and not object.__object__ then
if #object == 1 then
return object[1]
end
@@ -323,7 +323,7 @@ function table.wrap(object)
if nil == object then
return {}
end
- if type(object) ~= "table" or getmetatable(object) then -- maybe object, we need wrap it too
+ if type(object) ~= "table" or object.__object__ then
return {object}
end
return object