mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +00:00
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:
parent
af511a64cd
commit
84502f53b5
4 changed files with 1113 additions and 994 deletions
|
@ -32,6 +32,7 @@ set(SOURCES
|
||||||
Module.cpp
|
Module.cpp
|
||||||
Parser.cpp
|
Parser.cpp
|
||||||
ParserError.cpp
|
ParserError.cpp
|
||||||
|
Print.cpp
|
||||||
Runtime/AbstractOperations.cpp
|
Runtime/AbstractOperations.cpp
|
||||||
Runtime/AggregateError.cpp
|
Runtime/AggregateError.cpp
|
||||||
Runtime/AggregateErrorConstructor.cpp
|
Runtime/AggregateErrorConstructor.cpp
|
||||||
|
|
1011
Userland/Libraries/LibJS/Print.cpp
Normal file
1011
Userland/Libraries/LibJS/Print.cpp
Normal file
File diff suppressed because it is too large
Load diff
23
Userland/Libraries/LibJS/Print.h
Normal file
23
Userland/Libraries/LibJS/Print.h
Normal 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
Loading…
Add table
Add a link
Reference in a new issue