protocolbuffers / protocolbuffers/protobuf-javascript
toObject method of my message class uses an undeclared variable
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 471
- Forks
- 91
- Avg merge
- 3h 57m
- Merged PRs (30d)
- 2
Description
What version of protobuf and what language are you using?
Version: 3.7.0
Language: Javascript
What operating system (Linux, Windows, ...) and version?
Ubuntu 16.04.5 LTS (Bitnami LAMP)
MacOS Mojave 10.14.2
What runtime / compiler are you using (e.g., python version or gcc version)
node js v11.10.1
What did you do?
Steps to reproduce the behavior:
file minimal.proto:
syntax = "proto3";
message M1 {
uint64 x = 1;
}
message M2 {
M1 m = 1;
}
run protoc --js_out="import_style=commonjs,binary:." minimal.proto
What did you expect to see
proto.M2.toObject = function(includeInstance, msg) {
var obj, f = {
m: (f = msg.getM()) && proto.M1.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
(or at least that's what it was doing when it worked with version 3.5)
What did you see instead?
proto.M2.toObject = function(includeInstance, msg) {
var obj = {
m: (f = msg.getM()) && proto.M1.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
note that the declaration of f is missing in this code
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
Anything else we should know about your project / environment
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with minimal.proto and run the provided protoc --js_out command to reproduce the generated output for M2.toObject. Compare the generated method with the expected output and verify that the undeclared f variable is no longer emitted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100