Skip to content

Commit

Permalink
Fixed: Prevent parse errors when generating service method names, see #…
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Nov 27, 2017
1 parent 478f332 commit 6229799
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ Service.prototype.remove = function remove(object) {
Service.prototype.create = function create(rpcImpl, requestDelimited, responseDelimited) {
var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited);
for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) {
rpcService[util.lcFirst((method = this._methodsArray[i]).resolve().name)] = util.codegen(["r","c"], util.lcFirst(method.name))("return this.rpcCall(m,q,s,r,c)")({
var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\w_]/g, "");
rpcService[methodName] = util.codegen(["r","c"], util.isReserved(methodName) ? methodName + "_" : methodName)("return this.rpcCall(m,q,s,r,c)")({
m: method,
q: method.resolvedRequestType.ctor,
s: method.resolvedResponseType.ctor
Expand Down

0 comments on commit 6229799

Please sign in to comment.