Skip to content

Commit

Permalink
Fix generation when a method is called "request".
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmorgan authored and skybrian committed Nov 3, 2016
1 parent a00b505 commit 5f24f72
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/service_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ class ServiceGenerator {
out.addBlock("switch (method) {", "}", () {
for (MethodDescriptorProto m in _methodDescriptors) {
var methodName = _methodName(m.name);
out.println("case '${m.name}': return $methodName(ctx, request);");
out.println(
"case '${m.name}': return this.$methodName(ctx, request);");
}
out.println("default: "
"throw new ArgumentError('Unknown method: \$method');");
Expand Down
2 changes: 1 addition & 1 deletion test/file_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ abstract class TestServiceBase extends GeneratedService {
Future<GeneratedMessage> handleCall(ServerContext ctx, String method, GeneratedMessage request) {
switch (method) {
case 'Ping': return ping(ctx, request);
case 'Ping': return this.ping(ctx, request);
default: throw new ArgumentError('Unknown method: $method');
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/service_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ abstract class TestServiceBase extends GeneratedService {
Future<GeneratedMessage> handleCall(ServerContext ctx, String method, GeneratedMessage request) {
switch (method) {
case 'AMethod': return aMethod(ctx, request);
case 'AnotherMethod': return anotherMethod(ctx, request);
case 'AMethod': return this.aMethod(ctx, request);
case 'AnotherMethod': return this.anotherMethod(ctx, request);
default: throw new ArgumentError('Unknown method: $method');
}
}
Expand Down

0 comments on commit 5f24f72

Please sign in to comment.