ExecutionContext.h 1019 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2020-2021, Linus Groh <linusg@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <AK/FlyString.h>
  9. #include <LibJS/Forward.h>
  10. #include <LibJS/Runtime/MarkedValueList.h>
  11. #include <LibJS/Runtime/Value.h>
  12. namespace JS {
  13. // 9.4 Execution Contexts, https://tc39.es/ecma262/#sec-execution-contexts
  14. struct ExecutionContext {
  15. explicit ExecutionContext(Heap& heap)
  16. : arguments(heap)
  17. {
  18. }
  19. FunctionObject* function { nullptr }; // [[Function]]
  20. Realm* realm { nullptr }; // [[Realm]]
  21. Environment* lexical_environment { nullptr }; // [[LexicalEnvironment]]
  22. Environment* variable_environment { nullptr }; // [[VariableEnvironment]]
  23. ASTNode const* current_node { nullptr };
  24. FlyString function_name;
  25. Value this_value;
  26. MarkedValueList arguments;
  27. Object* arguments_object { nullptr };
  28. bool is_strict_mode { false };
  29. };
  30. }