starlight icon indicating copy to clipboard operation
starlight copied to clipboard

Double return statement

Open MangelMaxime opened this issue 9 years ago • 0 comments

Hello,

it's seems like starlight is adding a return []; statement at the end of a function.

The problem is when we specify an explicit return statement like so:

function increment ()
  counter = counter + 1
  updateUI()
  return ""
end

It will generate the following Javascript:

$set($, 'increment', (__star_tmp = function func$increment(...args){let $3 = $1.extend(), $ = $3;
;
$set($, 'counter', __star_op_add($get($, 'counter'), 1));
__star_call($get($, 'updateUI'));
return [""];; return [];}, __star_tmp.toString=()=>'function: 0x2', __star_tmp));

Here we saw that there two return statement the explicit and implicit one. So browsers like Firefox are emitting a warning.

For information, I am using the grunt configuration.

MangelMaxime avatar Jun 13 '16 20:06 MangelMaxime