diff options
| author | ruki <[email protected]> | 2022-05-28 22:23:11 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-05-28 22:23:11 +0800 |
| commit | fccfafe963bc60348fab25908dcfa9f43a39093d (patch) | |
| tree | e578d96f604257da402a997c8cb184d47d80ba49 | |
| parent | 0db757b6c79d41db3c2e3296f97dac016a4f41cc (diff) | |
fix c++modules for cl
| -rw-r--r-- | xmake/core/base/interpreter.lua | 4 | ||||
| -rw-r--r-- | xmake/core/base/path.lua | 2 | ||||
| -rw-r--r-- | xmake/core/base/scopeinfo.lua | 4 | ||||
| -rw-r--r-- | xmake/core/base/table.lua | 21 | ||||
| -rw-r--r-- | xmake/core/tool/builder.lua | 1 |
5 files changed, 20 insertions, 12 deletions
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua index 07aa701dc..27b91c4e4 100644 --- a/xmake/core/base/interpreter.lua +++ b/xmake/core/base/interpreter.lua @@ -1065,7 +1065,7 @@ function interpreter:api_register_set_values(scope_kind, ...) -- 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 - table.wraplock(value) + table.wrap_lock(value) end else -- expand values @@ -1115,7 +1115,7 @@ function interpreter:api_register_add_values(scope_kind, ...) -- 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 - table.wraplock(value) + table.wrap_lock(value) end else -- expand values diff --git a/xmake/core/base/path.lua b/xmake/core/base/path.lua index 26ac901db..421797f07 100644 --- a/xmake/core/base/path.lua +++ b/xmake/core/base/path.lua @@ -36,7 +36,7 @@ function _instance.new(p, transform) instance._RAWSTR = p instance._TRANSFORM = transform setmetatable(instance, _instance) - table.wraplock(instance) + table.wrap_lock(instance) instance:_update() return instance end diff --git a/xmake/core/base/scopeinfo.lua b/xmake/core/base/scopeinfo.lua index b826ac648..ef15fc2e1 100644 --- a/xmake/core/base/scopeinfo.lua +++ b/xmake/core/base/scopeinfo.lua @@ -119,7 +119,7 @@ function _instance:_api_set_values(name, ...) -- e.g. target: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 - table.wraplock(value) + table.wrap_lock(value) end else -- expand values @@ -168,7 +168,7 @@ function _instance:_api_add_values(name, ...) -- e.g. target: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 - table.wraplock(value) + table.wrap_lock(value) end else -- expand values diff --git a/xmake/core/base/table.lua b/xmake/core/base/table.lua index b8e83cd40..25fc92802 100644 --- a/xmake/core/base/table.lua +++ b/xmake/core/base/table.lua @@ -93,7 +93,7 @@ end function table.join(...) local result = {} for _, t in ipairs({...}) do - if type(t) == "table" and not t.__wraplocked__ then + if type(t) == "table" and not t.__wrap_locked__ then for k, v in pairs(t) do if type(k) == "number" then table.insert(result, v) else result[k] = v end @@ -108,7 +108,7 @@ end -- join all objects and tables to self function table.join2(self, ...) for _, t in ipairs({...}) do - if type(t) == "table" and not t.__wraplocked__ then + if type(t) == "table" and not t.__wrap_locked__ then for k, v in pairs(t) do if type(k) == "number" then table.insert(self, v) else self[k] = v end @@ -310,7 +310,7 @@ end -- unwrap array if be only one value function table.unwrap(array) - if type(array) == "table" and not array.__wraplocked__ then + if type(array) == "table" and not array.__wrap_locked__ then if #array == 1 then return array[1] end @@ -323,7 +323,7 @@ function table.wrap(value) if nil == value then return {} end - if type(value) ~= "table" or value.__wraplocked__ then + if type(value) ~= "table" or value.__wrap_locked__ then return {value} end return value @@ -332,10 +332,17 @@ end -- lock table value to avoid unwrap -- -- a = {1}, wrap(a): {1}, unwrap(a): 1 --- a = wraplock({1}), wrap(a): {a}, unwrap(a): a -function table.wraplock(value) +-- a = wrap_lock({1}), wrap(a): {a}, unwrap(a): a +function table.wrap_lock(value) if type(value) == "table" then - value.__wraplocked__ = true + value.__wrap_locked__ = true + end +end + +-- unlock table value to unwrap +function table.wrap_unlock(value) + if type(value) == "table" then + value.__wrap_locked__ = nil end end diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua index e21b2bf3b..ff792325a 100644 --- a/xmake/core/tool/builder.lua +++ b/xmake/core/tool/builder.lua @@ -384,6 +384,7 @@ function builder:_preprocess_flags(flags) else -- may be a table group? e.g. {"-I", "/xxx"} if #flag > 0 then + table.wrap_unlock(flag) table.join2(results, flag) end end |
