summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests/arrow-functions.js
AgeCommit message (Collapse)Author
2020-05-30LibJS: Throw a TypeError when an arrow function is used as a constructorJack Karamanian
2020-05-30LibJS: Don't define the "prototype" property for arrow functionsJack Karamanian
2020-05-30LibJS: Set the bound |this| value to the |this| value of the currentJack Karamanian
scope for arrow functions
2020-05-30LibJS: Parse arrow function expression with correct precedenceMarcin Gasperowicz
The parser was chomping on commas present after the arrow function expression. eg. [x=>x,2] would parse as [x=>(x,2)] instead of [(x=>x),2]. This is not the case anymore. I've added a small test to prove this.
2020-05-28LibJS: Add strict modeMatthew Olsson
Adds the ability for a scope (either a function or the entire program) to be in strict mode. Scopes default to non-strict mode. There are two ways to determine the strict-ness of the JS engine: 1. In the parser, this can be accessed with the parser_state variable m_is_strict_mode boolean. If true, the Parser is currently parsing in strict mode. This is done so that the Parser can generate syntax errors at parse time, which is required in some cases. 2. With Interpreter.is_strict_mode(). This allows strict mode checking at runtime as opposed to compile time. Additionally, in order to test this, a global isStrictMode() function has been added to the JS ReplObject under the test-mode flag.
2020-05-22LibJS: Disallow multiple parameters in paren-less arrow functionLinus Groh
Fixes #2323.
2020-05-06LibJS: Fix syntax error for arrow function non-decl variable assignmentMatthew Olsson
A regression was introduced in dc9b4da where the parser would incorrectly parse the assignment of arrow functions to (non-declaration) variables. For example, consider: a = () => {} Because the parser was aware of default parameters, in try_parse_arrow_function, the equals sign would be interpreted as a default argument, leading to incorrect parsing of the overall expression. Also resulted in some funny behavior (a = () => {} => {} worked just fine!). The simple fix is to only look for default parameters if the arrow function is required to have parenthesis.
2020-04-14js/LibJS: Move test functions to pure javascript.Brian Gianforcaro
The addition of assert functions to Userland/js was done before we had load(..) implemented. Now that it exists, it seems like the right move the test helper functions to pure javascript instead of poluting js with random global functions.
2020-04-13LibJS: Fix test files indentation (4 spaces)Linus Groh
2020-04-05LibJS: Use the native assert() implementation now avaiable in 'js -t'Brian Gianforcaro
Switch the LibJS test suite to use the native assert implementation surfaced inside the js repl when it's launched in test mode.
2020-03-30LibJS: Add support for arrow functionsJack Karamanian