mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 19:07:35 +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:
parent
acda12597a
commit
7767f9be37
2 changed files with 11 additions and 11 deletions
|
@ -77,17 +77,17 @@ ThrowCompletionOr<Value> Interpreter::run(Script& script_record)
|
||||||
// 10. Push scriptContext onto the execution context stack; scriptContext is now the running execution context.
|
// 10. Push scriptContext onto the execution context stack; scriptContext is now the running execution context.
|
||||||
TRY(vm.push_execution_context(script_context, global_object));
|
TRY(vm.push_execution_context(script_context, global_object));
|
||||||
|
|
||||||
// 11. Let scriptBody be scriptRecord.[[ECMAScriptCode]].
|
// 11. Let script be scriptRecord.[[ECMAScriptCode]].
|
||||||
auto& script_body = script_record.parse_node();
|
auto& script = script_record.parse_node();
|
||||||
|
|
||||||
// 12. Let result be GlobalDeclarationInstantiation(scriptBody, globalEnv).
|
// 12. Let result be GlobalDeclarationInstantiation(script, globalEnv).
|
||||||
auto instantiation_result = script_body.global_declaration_instantiation(*this, global_object, global_environment);
|
auto instantiation_result = script.global_declaration_instantiation(*this, global_object, global_environment);
|
||||||
Completion result = instantiation_result.is_throw_completion() ? instantiation_result.throw_completion() : normal_completion({});
|
Completion result = instantiation_result.is_throw_completion() ? instantiation_result.throw_completion() : normal_completion({});
|
||||||
|
|
||||||
// 13. If result.[[Type]] is normal, then
|
// 13. If result.[[Type]] is normal, then
|
||||||
if (result.type() == Completion::Type::Normal) {
|
if (result.type() == Completion::Type::Normal) {
|
||||||
// a. Set result to the result of evaluating scriptBody.
|
// a. Set result to the result of evaluating script.
|
||||||
result = script_body.execute(*this, global_object);
|
result = script.execute(*this, global_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 14. If result.[[Type]] is normal and result.[[Value]] is empty, then
|
// 14. If result.[[Type]] is normal and result.[[Value]] is empty, then
|
||||||
|
|
|
@ -15,16 +15,16 @@ namespace JS {
|
||||||
// 16.1.5 ParseScript ( sourceText, realm, hostDefined ), https://tc39.es/ecma262/#sec-parse-script
|
// 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)
|
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 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())
|
if (parser.has_errors())
|
||||||
return parser.errors();
|
return parser.errors();
|
||||||
|
|
||||||
// 3. Return Script Record { [[Realm]]: realm, [[ECMAScriptCode]]: body, [[HostDefined]]: hostDefined }.
|
// 3. Return Script Record { [[Realm]]: realm, [[ECMAScriptCode]]: script, [[HostDefined]]: hostDefined }.
|
||||||
return adopt_ref(*new Script(realm, filename, move(body), host_defined));
|
return adopt_ref(*new Script(realm, filename, move(script), host_defined));
|
||||||
}
|
}
|
||||||
|
|
||||||
Script::Script(Realm& realm, StringView filename, NonnullRefPtr<Program> parse_node, HostDefined* host_defined)
|
Script::Script(Realm& realm, StringView filename, NonnullRefPtr<Program> parse_node, HostDefined* host_defined)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue