Opened 6 years ago

Last modified 19 months ago

#54 closed defect

Transpiling of for-each leads to problems if array is modified within the loop — at Initial Version

Reported by: greiner Assignee: greiner
Priority: P4 Milestone:
Module: Automation Keywords: jshydra
Cc: trev, sebastian Blocked By:
Blocking: Platform: Unknown
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description

Environment

Chrome, Opera, Safari

How to reproduce

  1. Write the following code
    let a = {b: [1, 2, 3]};
    for each (let c in a.b)
    {
      console.log(c);
      delete a.b;
    }
    
  2. Transpile it using JSHydra
  3. Output is going to be
    var a = {b: [1, 2, 3]};
    for (var i = 0; i < a.b.length; ++)
    {
      console.log(a.b[i]);
      delete a.b;
    }
    

Observed behaviour

In Chrome, Opera and Safari the output is:

1

Expected behaviour

In Firefox the output is:

1
2
3

Change History (0)

Note: See TracTickets for help on using tickets.