Commit Graph

13 Commits

Author SHA1 Message Date
Timothy Flynn
ec492a1a08 Everywhere: Run clang-format
The following command was used to clang-format these files:

    clang-format-18 -i $(find . \
        -not \( -path "./\.*" -prune \) \
        -not \( -path "./Base/*" -prune \) \
        -not \( -path "./Build/*" -prune \) \
        -not \( -path "./Toolchain/*" -prune \) \
        -not \( -path "./Ports/*" -prune \) \
        -type f -name "*.cpp" -o -name "*.mm" -o -name "*.h")

There are a couple of weird cases where clang-format now thinks that a
pointer access in an initializer list, e.g. `m_member(ptr->foo)`, is a
lambda return statement, and it puts spaces around the `->`.
2024-04-24 16:50:01 -04:00
Dan Klishch
ec16556fea JSSpecCompiler: Add option to silence all diagnostics and use in tests
In the future, we will probably want to test regressions in diagnostics
too but let's not do that for now.
2024-03-25 14:28:52 -06:00
Dan Klishch
4d8f74c149 JSSpecCompiler: Parse method headers 2024-02-24 15:03:08 -07:00
Dan Klishch
a35a751f9e JSSpecCompiler: Parse optional arguments groups 2024-02-24 15:03:08 -07:00
Dan Klishch
86d54a8684 JSSpecCompiler: Parse arbitrarily large rational numbers in xspec mode 2024-02-24 15:03:08 -07:00
Dan Klishch
b74df136fe JSSpecCompiler: Always treat trailing MemberAccess as punctuation
Due to the way expression parser is written, we need to resolve the
ambiguity between member access operators and dots used for punctuation
during lexing. The lexer uses a (totally bulletproof) heuristic to do
that: whenever '.' is followed by ' ' or '\n', it is considered a dot
and member access otherwise. While it works fine for prettified test
cases, non-prettified files often lack enter after a trailing dot
character. Since MemberAccess will always be invalid at that position,
explicitly treat trailing dot as a part of punctuation.
2024-01-21 14:57:10 -07:00
Dan Klishch
b4a9fde756 JSSpecCompiler: Recurse into the correct subtrees in RecursiveASTVisitor
RecursiveASTVisitor was recursing into the subtrees of an old root if it
was changed in on_entry callback. Fix that by querying root pointer just
after on_entry callback returns. While on it, also use
`AK::TemporaryChange` instead of setting `m_current_subtree_pointer`
manually.

As it turns out, `FunctionCallCanonicalizationPass` was relying on being
able to replace tree on entry, and the bug in RecursiveASTVisitor made
the pass to not fully canonicalize nested function calls.

The changes to GenericASTPass.cpp alone are enough to fix the problem
but it is canonical (for some definition of canonicity) to only change
trees in on_leave. Therefore, the commit also switches
FunctionCallCanonicalizationPass to on_leave callback.

A test for this fix and one from the previous commit is also included.
2024-01-21 14:57:10 -07:00
Sam Atkins
071f7fd818 LibCore+JSSpecCompiler: Add option for Process::spawn() to use spawnp()
Add a boolean to ProcessSpawnOptions, `search_for_executable_in_path`,
which when true, calls into posix_spawnp() instead of posix_spawn().
This defaults to false to maintain the existing behavior.

The `path` field is renamed to `executable` because having two fields
refer to "path" and mean different things seemed unnecessarily
confusing.
2024-01-19 12:16:21 -07:00
Ali Mohammad Pur
5e1499d104 Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
2023-12-17 18:25:10 +03:30
Dan Klishch
8afbeb1892 JSSpecCompiler: Print stderr in test runner if compiler invocation fails 2023-12-14 09:06:05 -07:00
Dan Klishch
8126e76e59 JSSpecCompiler: Compare CFG when running regression tests 2023-12-14 09:06:05 -07:00
Dan Klishch
00928764e9 JSSpecCompiler: Add our first test :^) 2023-12-07 10:13:21 -07:00
Dan Klishch
107a3b44fa JSSpecCompiler: Add regression test runner 2023-12-07 10:13:21 -07:00