Skip to content

Commit 9b7b92a

Browse files
committed
Fixed reserved names re, also ensure valid service method names, see #559
1 parent be3e0d9 commit 9b7b92a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cli/targets/static.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function pushComment(lines) {
7474
push(" */");
7575
}
7676

77-
var reservedRe = /^do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof$/;
77+
var reservedRe = /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/;
7878

7979
function name(name) {
8080
if (!name)
@@ -402,7 +402,7 @@ function buildService(ref, service) {
402402
"@param {function(?Error, " + method.resolvedResponseType.fullName.substring(1) + "=)} callback Node-style callback called with the error, if any, and " + method.resolvedResponseType.name,
403403
"@returns {undefined}"
404404
]);
405-
push(name(service.name) + ".prototype." + name(lcName) + " = function " + name(lcName) + "(request, callback) {");
405+
push(name(service.name) + ".prototype[" + JSON.stringify(lcName) + "] = function " + name(lcName) + "(request, callback) {");
406406
++indent;
407407
push("var requestData;");
408408
push("try {");

0 commit comments

Comments
 (0)