mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +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
Notes:
sideshowbarker
2024-07-17 06:28:38 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/84502f53b5 Pull-request: https://github.com/SerenityOS/serenity/pull/16133 Reviewed-by: https://github.com/ADKaster ✅
4 changed files with 1113 additions and 994 deletions
|
@ -32,6 +32,7 @@ set(SOURCES
|
|||
Module.cpp
|
||||
Parser.cpp
|
||||
ParserError.cpp
|
||||
Print.cpp
|
||||
Runtime/AbstractOperations.cpp
|
||||
Runtime/AggregateError.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…
Reference in a new issue