Linus Groh
a10d09faba
LibJS: Tweak generated source in 'new Function()' to match ES 2015 spec
...
ES 5(.1) described parsing of the function body string as:
https://www.ecma-international.org/ecma-262/5.1/#sec-15.3.2.1
7. If P is not parsable as a FormalParameterList[opt] then throw a SyntaxError exception.
8. If body is not parsable as FunctionBody then throw a SyntaxError exception.
We implemented it as building the source string of a complete function
and feeding that to the parser, with the same outcome. ES 2015+ does
exactly that, but with newlines at certain positions:
https://tc39.es/ecma262/#sec-createdynamicfunction
16. Let bodyString be the string-concatenation of 0x000A (LINE FEED), ? ToString(bodyArg), and 0x000A (LINE FEED).
17. Let prefix be the prefix associated with kind in Table 49.
18. Let sourceString be the string-concatenation of prefix, " anonymous(", P, 0x000A (LINE FEED), ") {", bodyString, and "}".
This patch updates the generated source string to match these
requirements. This will make certain edge cases work, e.g.
'new Function("-->")', where the user supplied input must be placed on
its own line to be valid syntax.
2020-10-29 22:27:55 +01:00
..
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-09-25 21:18:17 +02:00
2020-09-08 16:20:34 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-09-27 20:26:58 +02:00
2020-10-06 18:37:58 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-06-21 15:15:52 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-06-21 15:15:52 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-13 23:57:45 +02:00
2020-10-04 17:03:33 +02:00
2020-10-04 17:03:33 +02:00
2020-10-04 17:03:33 +02:00
2020-10-14 00:10:49 +02:00
2020-10-14 00:10:49 +02:00
2020-07-23 17:31:08 +02:00
2020-09-27 20:26:58 +02:00
2020-10-04 19:22:02 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-09-25 21:18:17 +02:00
2020-10-13 23:57:45 +02:00
2020-06-21 15:15:52 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-09-25 21:18:17 +02:00
2020-09-25 21:18:17 +02:00
2020-10-04 19:22:02 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-10-04 17:03:33 +02:00
2020-10-29 22:27:55 +01:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-17 23:47:07 +02:00
2020-10-17 23:23:53 +02:00
2020-10-20 08:51:41 +02:00
2020-10-20 08:51:41 +02:00
2020-10-13 23:57:45 +02:00
2020-09-08 14:15:13 +02:00
2020-09-27 20:26:58 +02:00
2020-07-23 17:31:08 +02:00
2020-10-14 00:10:49 +02:00
2020-09-27 20:26:58 +02:00
2020-10-22 17:03:40 +02:00
2020-10-22 17:03:40 +02:00
2020-09-08 13:43:03 +02:00
2020-09-08 13:43:03 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-04 17:03:33 +02:00
2020-10-04 17:03:33 +02:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-10-16 17:06:57 +02:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-07-15 18:24:55 +02:00
2020-10-14 00:10:49 +02:00
2020-07-23 17:31:08 +02:00
2020-10-17 23:47:07 +02:00
2020-10-17 23:23:53 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-22 17:48:12 +02:00
2020-09-27 20:26:58 +02:00
2020-06-06 22:13:01 +02:00
2020-09-25 21:18:17 +02:00
2020-10-08 10:02:47 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-06-21 15:15:52 +02:00
2020-10-04 19:22:02 +02:00
2020-09-29 16:45:39 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-10-04 19:22:02 +02:00
2020-06-21 15:15:52 +02:00
2020-09-27 20:26:58 +02:00
2020-06-21 15:15:52 +02:00
2020-10-17 23:23:53 +02:00
2020-10-04 17:03:33 +02:00
2020-10-17 23:47:07 +02:00
2020-10-16 16:46:27 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-09-25 21:18:17 +02:00
2020-07-13 15:07:29 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-09-27 20:26:58 +02:00
2020-06-21 15:15:52 +02:00
2020-10-15 23:49:53 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-09-27 20:26:58 +02:00
2020-10-04 19:22:02 +02:00
2020-10-13 23:57:45 +02:00
2020-09-27 20:26:58 +02:00
2020-09-27 20:26:58 +02:00
2020-07-09 23:29:28 +02:00
2020-10-13 23:57:45 +02:00
2020-07-23 17:31:08 +02:00
2020-10-13 23:57:45 +02:00
2020-06-21 15:15:52 +02:00
2020-10-13 23:57:45 +02:00
2020-10-02 18:01:27 +02:00
2020-10-22 17:48:12 +02:00
2020-10-22 17:48:12 +02:00