protocolbuffers / protocolbuffers/protobuf-javascript

toObject method of my message class uses an undeclared variable

Offen
#53 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug javascript port-fix triaged
Vorherrschende Sprache
JavaScript
Sterne
471
Forks
91
Ø Merge
3 Std. 57 Min.
Gemergte PRs (30 T.)
2

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit minimal.proto und führe den bereitgestellten protoc --js_out-Befehl aus, um die generierte Ausgabe für M2.toObject zu reproduzieren. Vergleiche die generierte Methode mit der erwarteten Ausgabe und überprüfe, dass die nicht deklarierte Variable f nicht mehr ausgegeben wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.