1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:07:36 +00:00

Shell: Give commands and globs a source position

This will help us have nicer error reporting.
This commit is contained in:
AnotherTest 2021-01-03 12:36:25 +03:30 committed by Andreas Kling
parent cdebdaea2d
commit 3d51bcaa4e
2 changed files with 36 additions and 10 deletions

View file

@ -225,6 +225,7 @@ struct Command {
mutable RefPtr<Pipeline> pipeline;
Vector<NodeWithAction> next_chain;
Optional<Position> position;
};
struct HitTestResult {
@ -258,8 +259,8 @@ public:
{
}
CommandValue(Vector<String> argv)
: m_command({ move(argv), {}, true, false, true, false, nullptr, {} })
CommandValue(Vector<String> argv, Position position)
: m_command({ move(argv), {}, true, false, true, false, nullptr, {}, move(position) })
{
}
@ -347,13 +348,15 @@ public:
virtual Vector<String> resolve_as_list(RefPtr<Shell>) override;
virtual ~GlobValue();
virtual bool is_glob() const override { return true; }
GlobValue(String glob)
GlobValue(String glob, Position position)
: m_glob(move(glob))
, m_generation_position(move(position))
{
}
private:
String m_glob;
Position m_generation_position;
};
class SimpleVariableValue final : public Value {