75 Commits

Author SHA1 Message Date
Zoltan Herczeg
84bc1e03fb
Detect assignment pattern for for-in/of (#4140)
Furthermore do not allow default value for rest parameter

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-08-24 14:47:10 +02:00
Dániel Bátyai
26a299adf0
Fix block-scoped var/function redeclarations (#4080)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-07-31 17:43:15 +02:00
Robert Fancsik
f98d7f24a7
Support super property reference in object methods/accessors (#3940)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-03 12:16:23 +02:00
Zoltan Herczeg
9e18ff29c6
Implement ... support for object initializers. (#3968)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-07-02 15:04:21 +02:00
Zoltan Herczeg
37049c4968
Support catch statement without argument. (#3956)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-30 18:00:40 +02:00
Zoltan Herczeg
cd949d9d64
Rework flags representing arrow functions and complex arguments (#3957)
This allows detecting cases which was not possible before.

Fixes #3944

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-30 14:00:35 +02:00
Csaba Osztrogonác
122480aa61
JERRY_BUILTIN_xxx macros should depend on JERRY_ESNEXT (#3920)
JERRY_BUILTIN_xxx (ES2015+) features don't build without enabling
JERRY_ESNEXT macro, this invalid configuration shouldn't be allowed.
Additionally remove unnecessary JERRY_ESNEXT ifdef guards.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-06-30 13:54:50 +02:00
Zoltan Herczeg
5535ea88ac
Implement for-await-of statement. (#3946)
AsyncIteratorClose has not supported yet.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-30 11:21:50 +02:00
Zoltan Herczeg
5d8c5f3e92
Support comma after last argument for function declarations (#3910)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-24 10:41:03 +02:00
Zoltan Herczeg
b2a6109430
Implement async generators (#3916)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-22 13:54:18 +02:00
Dániel Bátyai
fde0d556ac
Re-target for ES.Next (#3901)
A list of changes:
- 'es2015-subset' profile is deprecated, and an 'es.next' profile is added.
- The default profile is changed to 'es.next'
- Renamed the JERRY_ES2015 guard to JERRY_ESNEXT
- Renamed JERRY_ES2015_BUILTIN_* guards to JERRY_BUILTIN_*
- Moved es2015 specific tests to a new 'es.next' subdirectory
- Updated docs, targets, and test runners to reflect these changes

Resolves #3737.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-06-12 17:55:00 +02:00
Rafal Walczyna
049a0c43f6
Fix ReferenceError for let/const variables in of/in for loop (#3885)
ReferenceError should be thrown when variable is used before assignment

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-06-10 12:39:02 +02:00
Zoltan Herczeg
36bf1ec09d
Implement argument redefinition with var statement. (#3811)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-08 13:43:50 +02:00
Robert Fancsik
69f8e78c2f
Fix error handling in scanner when in case of OOM (#3793)
This patch fixes #3786 and fixes #3788.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-05-27 14:40:43 +02:00
Zoltan Herczeg
1f00d750b7
Implement parsing await. (#3738)
Several bugs fixed for parsing yield as well.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-05-15 22:26:05 +02:00
Zoltan Herczeg
4dc2cb3328
Implement proper creation of function arguments, let and const declarations. (#3725)
After the rework it is possible to detect use before init errors for function arguments.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-05-12 14:38:17 +02:00
Zoltan Herczeg
132a2008c9
Fix function argument handling issues caused by the parser. (#3705)
1) Nested function declarations should not overwrite arguments.
2) Functions should be created in the correct scope.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-05-04 14:55:46 +02:00
Zoltan Herczeg
9e6c44be4f
Fix function declaration issues inside catch blocks. (#3700)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-29 13:53:14 +02:00
Zoltan Herczeg
85401db547
Support function statements after 'if' or 'else'. (#3699)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-29 13:50:01 +02:00
Zoltan Herczeg
52f1476061
Fix assignment expression pre-scanning for arrow functions. (#3688)
Fixes #3656.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-21 11:25:36 +02:00
Robert Fancsik
7f67795326
Spread operator should not update the scanner context's binding type (#3613)
This patch fixes #3595.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-03-16 14:52:05 +01:00
Robert Fancsik
bfd2639634
Rework the core of class parsing/runtime semantic (#3598)
Changes:
 - Use the pre-scanner to provide information for the parser about the existence of the class constructor
 - The allocation of the super declarative environment is no longer needed
 - The VM frame context holds the information about the this binding status
 - Reduce the number of class related VM/CBC instructions
 - Improve ecma_op_function_{construct, call} to properly set new.target

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-03-16 14:37:47 +01:00
Zoltan Herczeg
bd2696f7c7
Add global status flags for the parser. (#3572)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-02-24 11:22:20 +01:00
Dániel Bátyai
68909fc5de
Fix lexical scoping between scripts (#3558)
This change fixes the handling of lexical blocks when executing multiple
scripts, and also fixes a few issues with module environments.

After this change, all script files will run in the same context and
will have access to lexically scoped global variables of previous
scripts, and module environments will no longer have a bound global
'this' value.

The REPL implementation in main-unix is also fixed to correctly handle
lexically scoped variables.

Fixes #3561.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-02-21 13:30:48 +01:00
Zoltan Herczeg
fda02d4b2a
Fix local scoping for functions. (#3559)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-02-18 09:49:03 +01:00
Robert Fancsik
4a331b2edc
Add builtin GeneratorFunction support (#3499)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-01-15 12:01:58 +01:00
Zoltan Herczeg
d6070a9fed Call filter arguments after the global arguments are parsed. (#3511)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-01-14 15:10:19 +01:00
Péter Gál
0fd1ed6f27 Add support for new.target (#3469)
Notable changes:
* Extracted the pure JS/builtin and external C method invocations
  into two new methods (`ecma_op_function_call_{simple, external}`).
* Updated parser/scanner to handle "new.target" correctly.
* Added JS test case.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2020-01-14 13:34:19 +01:00
Robert Fancsik
d0e8629342 Support nested destructuring patterns in catch header (#3488)
This patch fixes #3433.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-01-13 11:39:07 +01:00
Zoltan Herczeg
fa2ddb2466 Create a new file for scanner operations. (#3475)
Compared to utils, the functions here scan the input (e.g. uses lexer_next_token).

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-01-06 11:05:39 +01:00
Zoltan Herczeg
8cb2be6001
Support parsing async modifiers for functions. (#3460)
Only parsing is implemented, so the async functions currently behave
like normal function except they return with a resolved Promise object
when the function is terminated correctly.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-20 09:55:41 +01:00
Robert Fancsik
ea5ad2a06f Fix the parsing/scanning of empty return statement (#3468)
This patch fixes #3467.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-12-19 19:31:59 +01:00
Robert Fancsik
9596a7e1d6
Implement tagged template literals (#3456)
Missing features: snapshot support

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-12-19 19:10:45 +01:00
Zoltan Herczeg
3c0beaf87d Support strict mode detection in the pre-scanner. (#3450)
Furthermode an error is thrown when 'use strict' is used in a function with non-simple arguments
and function arguments are not moved to lexical environment when unmapped arguments are present.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-17 10:59:03 +01:00
Zoltan Herczeg
b1237dbc5a Detect keyword type even if the keyword is identifier. (#3448)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-16 13:36:26 +01:00
Zoltan Herczeg
40d930d62c Implement \u{hex} support. (#3447)
A large rework because surrogate pairs must be combined.

Currently only the 0x10C80..0x10CF2 is accepted as valid identifier character from the non-basic plane.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-16 11:26:02 +01:00
Zoltan Herczeg
531f1e9687 Support let identifier in non-strict mode. (#3427)
This code adds a lot of checks and complexity to the code.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-10 14:32:08 +01:00
Zoltan Herczeg
5ceffd209e Fix post increase / decrease in the pre-scanner. (#3430)
Fixes #3397.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-06 13:53:34 +01:00
Zoltan Herczeg
1a4972fc3f Implement yield* operation in generator functions. (#3407)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-05 13:50:53 +01:00
Zoltan Herczeg
31988877b2 Support destructuring bindings as catch variables. (#3399)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-03 12:52:20 +01:00
Zoltan Herczeg
fee3a600af Support assignment expressions in the pre-scanner. (#3382)
Fixes #3355.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-29 15:47:47 +01:00
Zoltan Herczeg
8956eff2bd Implement generator support for object initializers and classes. (#3372)
Large part of the code is also reworked.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-29 12:28:51 +01:00
Zoltan Herczeg
110f75c99d Implement the core of the generator functions. (#3368)
Some things are missing:
 - yield* support
 - generator definition in object literal
 - the hidden GeneratorFunction

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-28 11:54:27 +01:00
Robert Fancsik
aeb8431aff Fix the scanning of default array/object literals. (#3367)
Scanning should continue with `SCAN_MODE_POST_PRIMARY_EXPRESSION` in all cases.

Fixes #3360.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-26 13:07:28 +01:00
Zoltan Herczeg
70566a52fb Improve eval call parsing. (#3330)
Eval calls are recognised when the eval identifier is encapsulated in brackets.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-19 15:55:53 +01:00
Robert Fancsik
22766a855e Implement spread operator for function call arguments (#3329)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-19 14:06:12 +01:00
Zoltan Herczeg
bf630c0c54 Implement binding pattern support for rest argument and for statement. (#3327)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-19 14:02:17 +01:00
Zoltan Herczeg
8bdb32cc88 Implement function destructuring argument support. (#3322)
Furthermore create unmapped arguments objects if a function has a non-simple argument.
A few destructuring pattern issues were fixed as well.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-18 14:15:36 +01:00
Robert Fancsik
fca0c94002 Fix the initialization of let/const patterns when block context is needed. (#3320)
Also some code cuplication is removed.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-15 14:38:14 +01:00
Robert Fancsik
213544ae47 Implement array/object destructuring (#3305)
This patch implements the core functionality of destructuring patterns.
Function argument/for in-of pattern are currently unsupported.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-14 13:49:49 +01:00