Status: New
Owner: ----

New issue 3384 by [email protected]: `Function('/foo/x')` should throw
http://code.google.com/p/v8/issues/detail?id=3384

https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primary-expression-regular-expression-literals-static-semantics-early-errors says:

It is a Syntax Error if FlagText of RegularExpressionLiteral contains any character other than "g", "i", "m", "u", or "y", or if it contains the same character more than once.

So this is the desired behavior:

    > Function('/foo/x')
    SyntaxError: invalid regular expression flag x

    > Function('/foo/gg')
    SyntaxError: invalid regular expression flag x

However, V8 only throws when the function is called (i.e. it's not an early error in V8).

Test case that should return 'PASS' but returns 'FAIL' on V8:

var result; try { Function('/foo/gg'); result = 'FAIL'; } catch (exception) { result = 'PASS'; } result

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to