Remove unused f expression from jscode gen. (#5573)

Varadic assignment in javascript where the right hand expression is an
object yields a single set assignment with the right most lefthand variable,
while leaving the other left side expressions undefined.

For example:
var a,b = {}

will only initialize a to undefined. But will set b to the {} value.

--

For this code since f is never used, it is a safe operation to remove
it.
pull/5580/head
Sam Saccone 6 years ago committed by Paul Yang
parent a2a0afb546
commit 94a1819c7a
  1. 2
      src/google/protobuf/compiler/js/js_generator.cc

@ -2272,7 +2272,7 @@ void Generator::GenerateClassToObject(const GeneratorOptions& options,
" * @suppress {unusedLocalVariables} f is only used for nested messages\n"
" */\n"
"$classname$.toObject = function(includeInstance, msg) {\n"
" var f, obj = {",
" var obj = {",
"classname", GetMessagePath(options, desc));
bool first = true;

Loading…
Cancel
Save