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:
parent
0d8b90aec6
commit
1403e56535
Notes:
sideshowbarker
2024-07-17 03:45:48 +09:00
Author: https://github.com/alimpfard
Commit: 1403e56535
Pull-request: https://github.com/SerenityOS/serenity/pull/18429
Reviewed-by: https://github.com/nico ✅
2 changed files with 23 additions and 8 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue