summaryrefslogtreecommitdiff
path: root/xmake/core/base/interpreter.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-03-02 23:20:48 +0800
committerruki <[email protected]>2022-03-02 23:20:48 +0800
commitcfdffbc896a2999c594caccfdaa323df16e3950b (patch)
tree233d14b1ac1e8c918b0d1e23aa76f87b06e4e69e /xmake/core/base/interpreter.lua
parent6026401e3bc55e0b5974c0aa18aefe4d7135fe89 (diff)
improve table.wrap and unwrap
Diffstat (limited to 'xmake/core/base/interpreter.lua')
-rw-r--r--xmake/core/base/interpreter.lua28
1 files changed, 24 insertions, 4 deletions
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua
index 8a4ed906c..a226d3db2 100644
--- a/xmake/core/base/interpreter.lua
+++ b/xmake/core/base/interpreter.lua
@@ -1059,8 +1059,18 @@ function interpreter:api_register_set_values(scope_kind, ...)
extra_config = nil
end
- -- expand values
- if not extra_config or extra_config.expand ~= false then
+ -- @note we need mark table value as meta object to avoid wrap/unwrap
+ -- if these values cannot be expanded, especially when there is only one value
+ --
+ -- e.g. set_shflags({"-Wl,-exported_symbols_list", exportfile}, {force = true, expand = false})
+ if extra_config and extra_config.expand == false then
+ for _, value in ipairs(values) do
+ if type(value) == "table" then
+ setmetatable(value, {})
+ end
+ end
+ else
+ -- expand values
values = table.join(table.unpack(values))
end
@@ -1101,8 +1111,18 @@ function interpreter:api_register_add_values(scope_kind, ...)
extra_config = nil
end
- -- expand values
- if not extra_config or extra_config.expand ~= false then
+ -- @note we need mark table value as meta object to avoid wrap/unwrap
+ -- if these values cannot be expanded, especially when there is only one value
+ --
+ -- e.g. add_shflags({"-Wl,-exported_symbols_list", exportfile}, {force = true, expand = false})
+ if extra_config and extra_config.expand == false then
+ for _, value in ipairs(values) do
+ if type(value) == "table" then
+ setmetatable(value, {})
+ end
+ end
+ else
+ -- expand values
values = table.join(table.unpack(values))
end