LibJS+js: Move the value print implementation to LibJS

And make it capable of printing to any Core::Stream.
This is useful on its own and can be used in a number of places, so move
it out and make it available as JS::print().
This commit is contained in:
Ali Mohammad Pur 2022-11-22 07:50:51 +03:30 committed by Ali Mohammad Pur
parent af511a64cd
commit 84502f53b5
4 changed files with 1113 additions and 994 deletions

View file

@ -32,6 +32,7 @@ set(SOURCES
Module.cpp
Parser.cpp
ParserError.cpp
Print.cpp
Runtime/AbstractOperations.cpp
Runtime/AggregateError.cpp
Runtime/AggregateErrorConstructor.cpp

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,23 @@
/*
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2020-2022, Linus Groh <linusg@serenityos.org>
* Copyright (c) 2022, Ali Mohammad Pur <mpfard@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/HashTable.h>
#include <LibCore/Stream.h>
#include <LibJS/Runtime/Value.h>
namespace JS {
struct PrintContext {
JS::VM& vm;
Core::Stream::Stream& stream;
bool strip_ansi { false };
};
ErrorOr<void> print(JS::Value value, PrintContext&);
}

File diff suppressed because it is too large Load diff