diff options
| author | ruki <[email protected]> | 2019-02-17 22:18:17 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-02-18 10:09:01 +0800 |
| commit | 3d5bb63eab591dbb5f7ad9ac69894fe84e537751 (patch) | |
| tree | a7b4fde7b0d4b1b7cd7774525c1c8f3995d3b745 /xmake/core/base/interpreter.lua | |
| parent | 8e9016cc9c2ff0ad97427d22c7ea6d7349e12e57 (diff) | |
add values for scope info
Diffstat (limited to 'xmake/core/base/interpreter.lua')
| -rw-r--r-- | xmake/core/base/interpreter.lua | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua index fe957ef3c..ba7dc908f 100644 --- a/xmake/core/base/interpreter.lua +++ b/xmake/core/base/interpreter.lua @@ -537,7 +537,7 @@ function interpreter:_make(scope_kind, remove_repeat, enable_filter) if root_scope then results = self:_handle(root_scope, remove_repeat, enable_filter) end - return scopeinfo.new(scope_kind, results) + return scopeinfo.new(scope_kind, results, self) -- get the root scope info without scope kind elseif scope_kind == "root" or scope_kind == nil then @@ -546,7 +546,7 @@ function interpreter:_make(scope_kind, remove_repeat, enable_filter) if root_scope then results = self:_handle(root_scope, remove_repeat, enable_filter) end - return scopeinfo.new(scope_kind, results) + return scopeinfo.new(scope_kind, results, self) -- get the results of the given scope kind elseif scope_kind then @@ -580,7 +580,7 @@ function interpreter:_make(scope_kind, remove_repeat, enable_filter) end -- add this scope - results[scope_name] = scopeinfo.new(scope_kind, self:_handle(scope_values, remove_repeat, enable_filter)) + results[scope_name] = scopeinfo.new(scope_kind, self:_handle(scope_values, remove_repeat, enable_filter), self) end end end @@ -792,11 +792,7 @@ end -- the root api will affect these scopes -- function interpreter:rootscope_set(scope_kind) - - -- check assert(self and self._PRIVATE) - - -- set it self._PRIVATE._ROOTSCOPE = scope_kind end @@ -815,6 +811,11 @@ function interpreter:apis(scope_kind) end end +-- get api definitions +function interpreter:api_definitions() + return self._API_DEFINITIONS +end + -- register api -- -- interp:api_register(nil, "apiroot", function () end) @@ -1489,9 +1490,10 @@ end -- @endcode -- function interpreter:api_define(apis) - - -- register language apis + + -- register apis local scopes = {} + local definitions = self._API_DEFINITIONS or {} for apitype, apifuncs in pairs(apis) do for _, apifunc in ipairs(apifuncs) do @@ -1507,6 +1509,9 @@ function interpreter:api_define(apis) apifunc = apifunc[1] end + -- register api definition, "scope.apiname" => "apitype" + definitions[apifunc] = apitype + -- get api function local apiscope = nil local funcname = nil @@ -1555,6 +1560,7 @@ function interpreter:api_define(apis) end end end + self._API_DEFINITIONS = definitions end -- the builtin api: set_xmakever() |
