Skip to content

Commit

Permalink
Add module alias to enums. Fixes #454
Browse files Browse the repository at this point in the history
  • Loading branch information
stanley-cheung committed Feb 27, 2019
1 parent aecdc2c commit 459487e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions javascript/net/grpc/web/grpc_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,11 @@ string JSElementType(const FieldDescriptor *desc, const FileDescriptor *file)
js_field_type = "string";
break;
case FieldDescriptor::TYPE_ENUM:
js_field_type = StripPrefixString(desc->enum_type()->full_name(),
desc->enum_type()->file()->package());
if (desc->enum_type()->file() != file) {
js_field_type = ModuleAlias(desc->enum_type()->file()->name());
}
js_field_type += StripPrefixString(desc->enum_type()->full_name(),
desc->enum_type()->file()->package());
if (!js_field_type.empty() && js_field_type[0] == '.') {
js_field_type = js_field_type.substr(1);
}
Expand Down

0 comments on commit 459487e

Please sign in to comment.