mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:58:11 +00:00
Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
This commit is contained in:
parent
e5f09ea170
commit
3f3f45580a
762 changed files with 8315 additions and 8316 deletions
|
@ -11,15 +11,15 @@
|
|||
#include <LibJS/Script.h>
|
||||
#include <LibTest/TestCase.h>
|
||||
|
||||
#define SETUP_AND_PARSE(source) \
|
||||
auto vm = JS::VM::create(); \
|
||||
auto ast_interpreter = JS::Interpreter::create<JS::GlobalObject>(*vm); \
|
||||
\
|
||||
auto script_or_error = JS::Script::parse(source, ast_interpreter->realm()); \
|
||||
EXPECT(!script_or_error.is_error()); \
|
||||
\
|
||||
auto script = script_or_error.release_value(); \
|
||||
auto const& program = script->parse_node(); \
|
||||
#define SETUP_AND_PARSE(source) \
|
||||
auto vm = JS::VM::create(); \
|
||||
auto ast_interpreter = JS::Interpreter::create<JS::GlobalObject>(*vm); \
|
||||
\
|
||||
auto script_or_error = JS::Script::parse(source##sv, ast_interpreter->realm()); \
|
||||
EXPECT(!script_or_error.is_error()); \
|
||||
\
|
||||
auto script = script_or_error.release_value(); \
|
||||
auto const& program = script->parse_node(); \
|
||||
JS::Bytecode::Interpreter bytecode_interpreter(ast_interpreter->global_object(), ast_interpreter->realm());
|
||||
|
||||
#define EXPECT_NO_EXCEPTION(executable) \
|
||||
|
@ -110,7 +110,7 @@ TEST_CASE(loading_multiple_files)
|
|||
}
|
||||
|
||||
{
|
||||
auto test_file_script_or_error = JS::Script::parse("if (f() !== 'hello') throw new Exception('failed'); ", ast_interpreter->realm());
|
||||
auto test_file_script_or_error = JS::Script::parse("if (f() !== 'hello') throw new Exception('failed'); "sv, ast_interpreter->realm());
|
||||
EXPECT(!test_file_script_or_error.is_error());
|
||||
|
||||
auto test_file_script = test_file_script_or_error.release_value();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue