summaryrefslogtreecommitdiff
path: root/Shell
diff options
context:
space:
mode:
Diffstat (limited to 'Shell')
-rw-r--r--Shell/AST.cpp14
-rw-r--r--Shell/AST.h12
2 files changed, 13 insertions, 13 deletions
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<Shell::AST::Command>::format(FormatBuilder& builder, const Sh
namespace Shell::AST {
-template<typename T, typename... Args>
-static inline NonnullRefPtr<T> create(Args... args)
-{
- return adopt(*new T(args...));
-}
-
-template<typename T>
-static inline NonnullRefPtr<T> create(std::initializer_list<NonnullRefPtr<Value>> 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<Value> Pipe::run(RefPtr<Shell> shell)
if (first_in_right.pipeline) {
last_in_left.pipeline = first_in_right.pipeline;
} else {
- auto pipeline = adopt(*new Pipeline);
+ auto pipeline = create<Pipeline>();
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<typename T, typename... Args>
+static inline NonnullRefPtr<T> create(Args... args)
+{
+ return adopt(*new T(args...));
+}
+
+template<typename T>
+static inline NonnullRefPtr<T> create(std::initializer_list<NonnullRefPtr<Value>> arg)
+{
+ return adopt(*new T(arg));
+}
+
struct HighlightMetadata {
bool is_first_in_list { true };
};