ExecutionContext.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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/PrivateEnvironment.h>
  12. #include <LibJS/Runtime/Value.h>
  13. namespace JS {
  14. // 9.4 Execution Contexts, https://tc39.es/ecma262/#sec-execution-contexts
  15. struct ExecutionContext {
  16. explicit ExecutionContext(Heap& heap)
  17. : arguments(heap)
  18. {
  19. }
  20. FunctionObject* function { nullptr }; // [[Function]]
  21. Realm* realm { nullptr }; // [[Realm]]
  22. Environment* lexical_environment { nullptr }; // [[LexicalEnvironment]]
  23. Environment* variable_environment { nullptr }; // [[VariableEnvironment]]
  24. PrivateEnvironment* private_environment { nullptr }; // [[PrivateEnvironment]]
  25. ASTNode const* current_node { nullptr };
  26. FlyString function_name;
  27. Value this_value;
  28. MarkedValueList arguments;
  29. bool is_strict_mode { false };
  30. };
  31. }