Changes between Initial Version and Version 8 of Ticket #54


Ignore:
Timestamp:
02/20/2015 08:56:23 AM (5 years ago)
Author:
sebastian
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #54

    • Property Cc trev sebastian added
    • Property Summary changed from Transpiling of for-each leads to problems if array is modified within the loop to Transpiling of for-of leads to problems if array is modified within the loop
    • Property Priority changed from Unknown to P4
    • Property Platform changed from to Unknown
    • Property Ready set
  • Ticket #54 – Description

    initial v8  
    1 === Environment === 
    2 Chrome, Opera, Safari 
    3  
    41=== How to reproduce === 
    52 1. Write the following code 
    63{{{ 
    74let a = {b: [1, 2, 3]}; 
    8 for each (let c in a.b) 
     5for (let c of a.b) 
    96{ 
    107  console.log(c); 
     
    1310}}} 
    1411 2. Transpile it using JSHydra 
    15  3. Output is going to be 
     12 
     13=== Observed behaviour === 
     14The generated code looks like: 
    1615{{{ 
    1716var a = {b: [1, 2, 3]}; 
     
    2322}}} 
    2423 
    25 === Observed behaviour === 
    26 In Chrome, Opera and Safari the output is: 
     24Hence, running the code leads to: 
    2725{{{ 
    28 1 
     26TypeError: Cannot read property 'length' of undefined 
    2927}}} 
    3028 
    3129=== Expected behaviour === 
    32 In Firefox the output is: 
     30 
     31The generated code should rather look like: 
     32{{{ 
     33var a = {b: [1, 2, 3]}; 
     34for (var x = a.b, i = 0; i = 0; i < x.length; ++) 
     35{ 
     36  console.log(x[i]); 
     37  delete a.b; 
     38} 
     39}}} 
     40 
     41Mimicking the behavior on Firefox, producing following output: 
    3342{{{ 
    34431