Opened 5 years ago

Closed 5 years ago

#516 closed defect (fixed)

JSHydra: return {foo:bar} produces broken code

Reported by: trev Assignee: trev
Priority: P3 Milestone:
Module: Automation Keywords:
Cc: Blocked By:
Blocking: #517 Platform:
Ready: yes Confidential: no
Tester: Verified working: no
Review URL(s):

http://codereview.adblockplus.org/6330303089999872

Description

How to reproduce

  1. Add return {foo: 1}; to one of our core modules imported into Adblock Plus for Chrome.
  2. Build Adblock Plus for Chrome.

Observed behaviour

The code is converted to:

return
{
  foo: bar
};

Note the newline after return, the browser will imply a semicolon there - this will be interpreted as a return statement followed by a block. Consequently, the browser will complain about a syntax error (unexpected colon).

Expected behaviour

The opening bracket of the object should be on the same line:

return {
  foo: bar
};

Change History (3)

comment:1 Changed 5 years ago by trev

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:2 Changed 5 years ago by trev

  • Blocking 517 added

comment:3 Changed 5 years ago by trev

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.