1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 17:38:12 +00:00

Shell: Make 'for' loops read their input as an stream

i.e. process an element as it becomes available.
This commit is contained in:
AnotherTest 2020-08-21 03:48:23 +04:30 committed by Andreas Kling
parent 9cc996b1e5
commit d4bcc689fb
2 changed files with 101 additions and 15 deletions

View file

@ -352,6 +352,7 @@ private:
class Node : public RefCounted<Node> {
public:
virtual void dump(int level) const = 0;
virtual void for_each_entry(RefPtr<Shell> shell, Function<IterationDecision(RefPtr<Value>)> callback);
virtual RefPtr<Value> run(RefPtr<Shell>) = 0;
virtual void highlight_in_editor(Line::Editor&, Shell&, HighlightMetadata = {}) = 0;
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, const HitTestResult&);
@ -657,6 +658,7 @@ public:
virtual ~Execute();
void capture_stdout() { m_capture_stdout = true; }
RefPtr<Node> command() { return m_command; }
virtual void for_each_entry(RefPtr<Shell> shell, Function<IterationDecision(RefPtr<Value>)> callback) override;
private:
virtual void dump(int level) const override;