Skip to content

Commit

Permalink
Remove can_fail attribute from bindings generator
Browse files Browse the repository at this point in the history
The binding generator no longer respects the can_fail attribute, since
its being removed from the metadata.

As a consequence all Neovim functions have an error signal. A quick grep
shows that this API is only used anyway.
  • Loading branch information
Rui Abreu Ferreira committed Sep 27, 2016
1 parent ca53cf4 commit b1bfc0f
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 10 deletions.
2 changes: 1 addition & 1 deletion bindings/function_static.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ const QList<Function> Function::knownFunctions = QList<Function>()
{% for param in f.parameters %}
<< QString("{{param.neovim_type}}")
{% endfor %}
, {% if f.can_fail%}true{%else%}false{%endif%})
, false)
{% endfor %}
;
5 changes: 0 additions & 5 deletions bindings/generate_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ def __init__(self, nvim_fun):
print('Found unknown attributes for function %s: %s' % (self.name, u_attrs))

self.argcount = len(self.parameters)
self.can_fail = self.fun.get('can_fail', False)

# Build the argument string - makes it easier for the templates
self.argstring = ', '.join(['%s %s' % (tv.native_type, tv.name) for tv in self.parameters])
Expand All @@ -154,17 +153,13 @@ def real_signature(self):
params += '%s %s' % (p.native_type, p.name)
params += ', '
notes = ''
if self.can_fail:
notes += '!fails'
return '%s %s(%s) %s' % (self.return_type.native_type,self.name,params, notes)
def signature(self):
params = ''
for p in self.parameters:
params += '%s %s' % (p.neovim_type, p.name)
params += ', '
notes = ''
if self.can_fail:
notes += '!fails'
return '%s %s(%s) %s' % (self.return_type.neovim_type,self.name,params, notes)


Expand Down
2 changes: 0 additions & 2 deletions bindings/neovim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,9 @@ void Neovim::handleResponseError(quint32 msgid, Function::FunctionId fun, const

switch(fun) {
{% for f in functions %}
{% if f.can_fail %}
case Function::NEOVIM_FN_{{f.name.upper()}}:
emit err_{{f.name}}(errMsg, res);
break;
{% endif %}
{% endfor %}
default:
m_c->setError(NeovimConnector::RuntimeMsgpackError, QString("Received error for function that should not fail: %s").arg(fun));
Expand Down
2 changes: 0 additions & 2 deletions bindings/neovim.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ public slots:
signals:
{% for f in functions %}
void on_{{f.name}}({{f.return_type.native_type}});
{% if f.can_fail %}
void err_{{f.name}}(const QString&, const QVariant&);
{% endif%}

{% endfor %}
};
Expand Down

0 comments on commit b1bfc0f

Please sign in to comment.