Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.

Commit 659d082

Browse files
committed
msgpack_rpc_stream: don't shadow the 'type' function
1 parent e343477 commit 659d082

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

nvim/msgpack_rpc_stream.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ function MsgpackRpcStream:read_start(request_cb, notification_cb, eof_cb)
102102
if not data then
103103
return eof_cb()
104104
end
105-
local status, type, id_or_cb
105+
local status, type_, id_or_cb
106106
local pos = 1
107107
local len = #data
108108
while pos <= len do
109109
-- grab a copy of pos since pcall() will set it to nil on error
110110
local oldpos = pos
111-
status, type, id_or_cb, method_or_error, args_or_result, pos = pcall(
111+
status, type_, id_or_cb, method_or_error, args_or_result, pos = pcall(
112112
self._session.receive, self._session, data, pos)
113113
if not status then
114114
-- write the full blob of bad data to a specific file
@@ -122,17 +122,17 @@ function MsgpackRpcStream:read_start(request_cb, notification_cb, eof_cb)
122122
print(string.format("Error deserialising msgpack data stream at pos %d:\n%s\n",
123123
oldpos, printable))
124124
print(string.format("... occurred after %s", self._previous_chunk))
125-
error(type)
125+
error(type_)
126126
end
127-
if type == 'request' or type == 'notification' then
128-
self._previous_chunk = string.format('%s<%s>', type, method_or_error)
129-
if type == 'request' then
127+
if type_ == 'request' or type_ == 'notification' then
128+
self._previous_chunk = string.format('%s<%s>', type_, method_or_error)
129+
if type_ == 'request' then
130130
request_cb(method_or_error, args_or_result, Response.new(self,
131131
id_or_cb))
132132
else
133133
notification_cb(method_or_error, args_or_result)
134134
end
135-
elseif type == 'response' then
135+
elseif type_ == 'response' then
136136
self._previous_chunk = string.format('response<%s,%s>', id_or_cb, args_or_result)
137137
if method_or_error == mpack.NIL then
138138
method_or_error = nil

0 commit comments

Comments
 (0)