Skip to content

Commit 04bd571

Browse files
committed
fix(vm): fix runOperator missing uri and isCallable being nil
1 parent 0945478 commit 04bd571

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

script/vm/infer.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,12 @@ function mt:hasFunction(uri)
383383
or self._hasDocFunction == true
384384
end
385385

386+
---@param uri uri
387+
---@return boolean
388+
function mt:isCallable(uri)
389+
return self:hasFunction(uri) or #vm.getOperators("call", self.node) ~= 0
390+
end
391+
386392
---@param uri uri
387393
function mt:_computeViews(uri)
388394
if self.views then

script/vm/operator.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ end
9797
---@param op string
9898
---@param node vm.node
9999
---@return parser.object[]
100-
function vm.getOperators(op, node)
101-
local uri = guide.getUri(node)
100+
function vm.getOperators(op, node, uri)
102101
---@type parser.object[]
103102
local operators = {}
104103
for c in node:eachObject() do
@@ -126,7 +125,8 @@ end
126125
---@return vm.node?
127126
function vm.runOperator(op, exp, value)
128127
local node = vm.compileNode(exp)
129-
local operators = vm.getOperators(op, node)
128+
local uri = guide.getUri(exp)
129+
local operators = vm.getOperators(op, node, uri)
130130
local result = checkOperators(operators, op, value, nil)
131131
return result
132132
end

0 commit comments

Comments
 (0)