1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

Shell: Place all variables in the closest nonlocal frame in POSIX mode

This commit is contained in:
Ali Mohammad Pur 2023-04-19 12:21:03 +03:30 committed by Ali Mohammad Pur
parent 0d8b90aec6
commit 1403e56535
Notes: sideshowbarker 2024-07-17 03:45:48 +09:00
2 changed files with 23 additions and 8 deletions

View file

@ -191,15 +191,21 @@ public:
RefPtr<Line::Editor> editor() const { return m_editor; }
enum class LocalFrameKind {
FunctionOrGlobal,
Block,
};
struct LocalFrame {
LocalFrame(DeprecatedString name, HashMap<DeprecatedString, RefPtr<AST::Value>> variables)
LocalFrame(DeprecatedString name, HashMap<DeprecatedString, RefPtr<AST::Value>> variables, LocalFrameKind kind = LocalFrameKind::Block)
: name(move(name))
, local_variables(move(variables))
, is_function_frame(kind == LocalFrameKind::FunctionOrGlobal)
{
}
DeprecatedString name;
HashMap<DeprecatedString, RefPtr<AST::Value>> local_variables;
bool is_function_frame;
};
struct Frame {
@ -218,7 +224,7 @@ public:
bool should_destroy_frame { true };
};
[[nodiscard]] Frame push_frame(DeprecatedString name);
[[nodiscard]] Frame push_frame(DeprecatedString name, LocalFrameKind = LocalFrameKind::Block);
void pop_frame();
struct Promise {