Skip to content

toObject method of my message class uses an undeclared variable #53

Open
@sakekasi

Description

@sakekasi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions