Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generated code incorrectly refers to $util instead of util #732

Closed
tamird opened this issue Mar 27, 2017 · 2 comments
Closed

generated code incorrectly refers to $util instead of util #732

tamird opened this issue Mar 27, 2017 · 2 comments

Comments

@tamird
Copy link

tamird commented Mar 27, 2017

In CockroachDB we have some protos in the util package, but the protobufjs generated code trips on this and generates code like this:

            UnresolvedAddr.decode = function decode(reader, length) {
                if (!(reader instanceof $Reader))
                    reader = $Reader.create(reader);
                let end = length === undefined ? reader.len : reader.pos + length, message = new $root.cockroach.$util.UnresolvedAddr();
                while (reader.pos < end) {
                    let tag = reader.uint32();
                    switch (tag >>> 3) {
                    case 1:
                        message.network_field = reader.string();
                        break;
                    case 2:
                        message.address_field = reader.string();
                        break;
                    default:
                        reader.skipType(tag & 7);
                        break;
                    }
                }
                return message;
            };

Note that $root.cockroach.$util should be $root.cockroach.util.

@dcodeIO
Copy link
Member

dcodeIO commented Mar 27, 2017

Got a bit lost in espree's AST so please let me know if this fixes your issue(s). Might affect the PR.

@tamird
Copy link
Author

tamird commented Mar 27, 2017

Fixes my issue, hurray! Rebased the PR as well.

@tamird tamird closed this as completed Mar 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants