1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00
serenity/Userland/Libraries/LibJS
Luke Wilde 5bc3371226 LibJS: Perform received abrupt generator completions in the generator
Previously, throw and return completions would not be executed inside
the generator. This is incorrect, as throw and return need to perform
unwinds which can potentially execute more code inside the generator,
such as finally blocks.

This is done by also passing the completion type alongside the passed
in value. The continuation block will immediately extract and type and
value and perform the appropriate operation for the given type.

For normal completions, this is continuing as normal.
For throw completions, it will perform `throw <value>`.
For return completions, it will perform `return <value>`, which is a
`Yield return` in this case due to being inside a generator.

This also refactors GeneratorObject to properly send across the
completion type and value to the generator inside of trying to operate
on the completions itself.

This is a prerequisite for yield*, as it performs special iterator
operations when receiving a throw/return completion and does not
complete the generator like the regular yield would.

There's still more work to be done to make GeneratorObject::execute
be closer to the spec. It's mostly a restructuring of the existing
GeneratorObject::next_impl.
2022-11-26 12:55:59 +01:00
..
Bytecode LibJS: Perform received abrupt generator completions in the generator 2022-11-26 12:55:59 +01:00
Contrib/Test262 LibJS: Add missing <AK/TypeCasts.h> include in $262Object.cpp 2022-11-23 16:05:59 +00:00
Heap LibJS+LibWeb: Return non-const types from Ptr class operators 2022-11-19 14:37:31 +00:00
Runtime LibJS: Perform received abrupt generator completions in the generator 2022-11-26 12:55:59 +01:00
Tests LibJS: Fix UTF-16 corruption in String.prototype.replace() 2022-11-19 11:30:06 -07:00
AST.cpp LibJS: Shrink Identifier's environment coordinate cache 2022-11-22 21:13:35 +01:00
AST.h LibJS: Avoid unnecessary SourceRange construction in parse_program() 2022-11-24 16:06:20 +00:00
CMakeLists.txt LibJS+js: Move the value print implementation to LibJS 2022-11-26 02:23:15 +03:30
Console.cpp LibJS+js: Disable console debug messages outside Serenity only for js 2022-10-16 02:06:02 +03:30
Console.h LibJS+js: Disable console debug messages outside Serenity only for js 2022-10-16 02:06:02 +03:30
CyclicModule.cpp LibJS+LibWeb: Move JS::ModuleRequest to its own header file 2022-11-23 16:05:59 +00:00
CyclicModule.h LibJS+LibWeb: Make CyclicModule.h not include AST.h 2022-11-23 16:05:59 +00:00
Forward.h LibJS+LibWeb: Move JS::ModuleRequest to its own header file 2022-11-23 16:05:59 +00:00
Interpreter.cpp LibJS: Make Script and Module GC-allocated 2022-09-06 00:27:09 +02:00
Interpreter.h LibJS: Make Interpreter.h not include AST.h 2022-11-23 16:05:59 +00:00
Lexer.cpp LibJS: Treat '\\' as an escaped character in template literals 2022-11-15 12:00:36 +00:00
Lexer.h LibJS: Reduce AST memory usage by shrink-wrapping source range info 2022-11-22 21:13:35 +01:00
MarkupGenerator.cpp LibJS: Reduce AST memory usage by shrink-wrapping source range info 2022-11-22 21:13:35 +01:00
MarkupGenerator.h WebContent+LibWeb+LibJS: Report exceptions to the JS console 2022-10-15 01:25:12 +02:00
Module.cpp LibJS: Make CyclicModule.h not include PromiseCapability.h 2022-11-23 16:05:59 +00:00
Module.h LibJS: Add [[HostDefined]] field to Modules 2022-10-06 16:41:36 +02:00
Parser.cpp LibJS: Avoid unnecessary SourceRange construction in parse_program() 2022-11-24 16:06:20 +00:00
Parser.h LibJS: Make FunctionNode::Parameter be a standalone FunctionParameter 2022-11-23 16:05:59 +00:00
ParserError.cpp LibJS: Make Parser::Error a standalone ParserError class 2022-11-23 16:05:59 +00:00
ParserError.h LibJS: Make Parser::Error a standalone ParserError class 2022-11-23 16:05:59 +00:00
Print.cpp LibJS+js: Move the value print implementation to LibJS 2022-11-26 02:23:15 +03:30
Print.h LibJS+js: Move the value print implementation to LibJS 2022-11-26 02:23:15 +03:30
SafeFunction.h LibJS: Don't register SafeFunction-to-function-pointer with JS::Heap 2022-10-20 15:16:23 +02:00
Script.cpp LibJS: Make Parser::Error a standalone ParserError class 2022-11-23 16:05:59 +00:00
Script.h LibJS: Make Script.h not include AST.h 2022-11-23 16:05:59 +00:00
SourceCode.cpp LibJS: Unbreak test262-parser-tests after source range caching changes 2022-11-24 18:01:52 +01:00
SourceCode.h LibJS: Make Error stack trace generation faster with a line break cache 2022-11-24 16:06:20 +00:00
SourceRange.h LibJS: Reduce AST memory usage by shrink-wrapping source range info 2022-11-22 21:13:35 +01:00
SourceTextModule.cpp LibJS+LibWeb: Make CyclicModule.h not include AST.h 2022-11-23 16:05:59 +00:00
SourceTextModule.h LibJS: Make SourceTextModule.h not include AST.h or Parser.h 2022-11-23 16:05:59 +00:00
SyntaxHighlighter.cpp LibJS: Remove a bunch of gratuitous JS namespace qualifiers 2022-04-03 15:19:33 +01:00
SyntaxHighlighter.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
SyntheticModule.cpp LibJS: Make Script and Module GC-allocated 2022-09-06 00:27:09 +02:00
SyntheticModule.h LibJS: Make Script and Module GC-allocated 2022-09-06 00:27:09 +02:00
Token.cpp LibJS: Make Token use the new double parser 2022-10-23 15:48:45 +02:00
Token.h Everywhere: Explicitly specify the size in StringView constructors 2022-07-12 23:11:35 +02:00