abujehad139 / js-addin

Automatically exported from code.google.com/p/js-addin
0 stars 0 forks source link

function () { /sdf/.test('') } - Literal regex at beginning of function body throws error #38

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add this to new js file: function y() { /sdf/.test('') || alert('nope') }
2. Save the file

What is the expected output? What do you see instead?
- no error should be thrown

What version of the product are you using? On what operating system?
- using 3.6 in VS 2010 on Windows Server 2008 R2 (aka Windows 7)

Original issue reported on code.google.com by oliver.friedrich@gmail.com on 27 Jun 2013 at 11:14

GoogleCodeExporter commented 9 years ago
Thank you for your bug report.

Unfortunately this issue caused by used parsing 3rd party library that I can 
not change. Looks like this is limitation that I can not find a workaround.

So, if you are bothered with it and still want to have error checking you 
should somehow rewrite the source code.

For example this line looks like OK from parser standpoint:

function y() { var r = /sdf/.test('') || alert('nope') }

Thanks,
Olek

Original comment by mega.boich@gmail.com on 15 Jul 2013 at 11:19