diff --git a/Shell/AST.cpp b/Shell/AST.cpp index f6d6ad084f..1998c67404 100644 --- a/Shell/AST.cpp +++ b/Shell/AST.cpp @@ -123,18 +123,6 @@ void AK::Formatter::format(FormatBuilder& builder, const Sh namespace Shell::AST { -template -static inline NonnullRefPtr create(Args... args) -{ - return adopt(*new T(args...)); -} - -template -static inline NonnullRefPtr create(std::initializer_list> arg) -{ - return adopt(*new T(arg)); -} - static inline void print_indented(const String& str, int indent) { for (auto i = 0; i < indent; ++i) @@ -1829,7 +1817,7 @@ RefPtr Pipe::run(RefPtr shell) if (first_in_right.pipeline) { last_in_left.pipeline = first_in_right.pipeline; } else { - auto pipeline = adopt(*new Pipeline); + auto pipeline = create(); last_in_left.pipeline = pipeline; first_in_right.pipeline = pipeline; } diff --git a/Shell/AST.h b/Shell/AST.h index f3fb8cd39d..d22f103593 100644 --- a/Shell/AST.h +++ b/Shell/AST.h @@ -41,6 +41,18 @@ namespace Shell::AST { +template +static inline NonnullRefPtr create(Args... args) +{ + return adopt(*new T(args...)); +} + +template +static inline NonnullRefPtr create(std::initializer_list> arg) +{ + return adopt(*new T(arg)); +} + struct HighlightMetadata { bool is_first_in_list { true }; };