six icon indicating copy to clipboard operation
six copied to clipboard

ES5 'set' throws error.

Open Synvox opened this issue 12 years ago • 4 comments

I tried the following in both the online repl and locally though npm.

class Blah {
  get a(){
    alert('getting a');
  }
  set a(){
    alert('setting a');
  }
}

Line 5: Unexpected token )

and...

class Blah {
  get a(){
    alert('getting a');
  }
  set b(){
    alert('setting b');
  }
}

Line 5: Unexpected token )

Synvox avatar Nov 15 '12 23:11 Synvox

Thank you for reporting this, I will look in to it and have a fix in as soon as I track down the issue (I have a few ideas where it might be)

matthewrobb avatar Nov 15 '12 23:11 matthewrobb

Ok. Thank a lot. The same happens with:

a={
  set a:function(){}
}

and

a={
  get a:function(){}
}

Synvox avatar Nov 16 '12 00:11 Synvox

neither of those last two examples are valid ES5

a={
  [g|s]et a(){  }
}

matthewrobb avatar Nov 16 '12 00:11 matthewrobb

Woah. My bad. Forget that comment was posted.

Synvox avatar Nov 16 '12 01:11 Synvox