1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +00:00

LibJS: Rename some variables from "script body" to "script"

This is an editorial change in the ECMA-262 spec.

See: 38a2584
This commit is contained in:
Linus Groh 2022-05-01 01:13:33 +02:00
parent acda12597a
commit 7767f9be37
2 changed files with 11 additions and 11 deletions

View file

@ -15,16 +15,16 @@ namespace JS {
// 16.1.5 ParseScript ( sourceText, realm, hostDefined ), https://tc39.es/ecma262/#sec-parse-script
Result<NonnullRefPtr<Script>, Vector<Parser::Error>> Script::parse(StringView source_text, Realm& realm, StringView filename, HostDefined* host_defined, size_t line_number_offset)
{
// 1. Let body be ParseText(sourceText, Script).
// 1. Let script be ParseText(sourceText, Script).
auto parser = Parser(Lexer(source_text, filename, line_number_offset));
auto body = parser.parse_program();
auto script = parser.parse_program();
// 2. If body is a List of errors, return body.
// 2. If script is a List of errors, return body.
if (parser.has_errors())
return parser.errors();
// 3. Return Script Record { [[Realm]]: realm, [[ECMAScriptCode]]: body, [[HostDefined]]: hostDefined }.
return adopt_ref(*new Script(realm, filename, move(body), host_defined));
// 3. Return Script Record { [[Realm]]: realm, [[ECMAScriptCode]]: script, [[HostDefined]]: hostDefined }.
return adopt_ref(*new Script(realm, filename, move(script), host_defined));
}
Script::Script(Realm& realm, StringView filename, NonnullRefPtr<Program> parse_node, HostDefined* host_defined)