Commit graph

8067 commits

Author SHA1 Message Date
AnotherTest
cdb627a516 LibJS: Allow lexer to run without logging errors 2020-04-05 16:11:13 +02:00
AnotherTest
c2f8a5fffa LibLine: Add live styling support
This patchset adds an stylization interface to LibLine, and breaks
multiline editing.
With the most adorable Style constructor I've ever seen :^)
2020-04-05 16:11:13 +02:00
Oriko
2c5faa8ff3 FileManager: Add properties action to directory context menu 2020-04-05 16:02:07 +02:00
Linus Groh
4509350391 LibJS: Remove assert function from exponentiation-basic.js 2020-04-05 16:01:46 +02:00
Linus Groh
30ba2c7cec LibJS: Simplify Math-constants.js test
By borrowing an "expect close" function from LibM/TestMath.cpp, we can
make this a lot simpler. Also the parser now understands decimals!
2020-04-05 16:01:46 +02:00
Linus Groh
0d7a1c3157 LibJS: Update to-number-basic.js test
Uncomment lines that are now parsing correctly :^)
2020-04-05 16:01:46 +02:00
Linus Groh
2f775a925b LibJS: Fix Math.SQRT1_2
The value of Math.SQRT1_2 was zero as we were dividing two integers.
2020-04-05 16:01:46 +02:00
Stephan Unverwerth
500f6d9e3a LibJS: Add numeric literal parsing for different bases and exponents 2020-04-05 16:01:22 +02:00
Stephan Unverwerth
b82a2239c6
LibC: Fix strtod() parsing of negative exponents (#1645)
Before this fix negative exponents were interpreted as positive.
2020-04-05 15:32:57 +02:00
Linus Groh
0403845d3e LibJS: Implement exponentiation (** operator) 2020-04-05 15:32:06 +02:00
Linus Groh
eafd3dbaf8 LibJS: Rename BinaryOp::{Plus,Minus,Asterisk,Slash} 2020-04-05 15:31:12 +02:00
Tibor Nagy
a4f6f8e0e7 QuickShow: Use checkerboard background to show transparency 2020-04-05 15:30:53 +02:00
Tibor Nagy
e14d27867c LibGfx: Implement checkerboard drawing for Gfx::Painter 2020-04-05 15:30:53 +02:00
Brian Gianforcaro
de32fd0347 Toolchain: Fix trailing white space warnings when gcc.patch is applied
Noticed the warnings about trailing white space in the patch fly by as
I was running Toolchain/BuildIt.sh on a new machine.
2020-04-05 15:30:03 +02:00
Brendan Coles
ddb8597c0c IRCClient: Allow CTCP replies to be user configurable in IRCClient.ini 2020-04-05 15:29:48 +02:00
Brian Gianforcaro
bc40908d32 LibJS: Use the native assert() implementation now avaiable in 'js -t'
Switch the LibJS test suite to use the native assert implementation
surfaced inside the js repl when it's launched in test mode.
2020-04-05 15:28:45 +02:00
Brian Gianforcaro
4233c8662b js: Add a new --test-mode option, which exposes an assert() function.
Introduce a central assert implementation so that the LibJS test suite
can take advantage of one implementation instead of copy/pasting the
same function into every test case file.
2020-04-05 15:28:45 +02:00
Liav A
a7d708e47d Kernel: Don't enumerate blocks of ext2 symlinks by default
Also, we assert if we encounter a block that is bigger than blocks
count in the superblock.

Fixes #1608.
2020-04-05 15:27:31 +02:00
Brendan Coles
a1b57216b8 IRCClient: Add handling for server responses and BANLIST command 2020-04-05 12:49:33 +02:00
Brian Gianforcaro
1e67efc5c1 Lagom: Add clang address/memory/undefined-behavior analyzer support
Adding the ability to turn on Clang analyzer support in the Lagom build.
Right now the following are working warning free on the LibJS test suite:

 -DENABLE_MEMORY_SANITIZER:BOOL=ON

 -DENABLE_ADDRESS_SANITIZER:BOOL=ON

The following analyzer produces errors when running the LibJS test suite:

 -DENABLE_UNDEFINED_SANITIZER:BOOL=ON
2020-04-05 12:49:06 +02:00
Brian Gianforcaro
dd112421b4 LibJS: Plumb line and column information through Lexer / Parser
While debugging test failures, it's pretty frustrating to have to go do
printf debugging to figure out what test is failing right now. While
watching your JS Raytracer stream it seemed like this was pretty
furstrating as well. So I wanted to start working on improving the
diagnostics here.

In the future I hope we can eventually be able to plumb the info down
to the Error classes so any thrown exceptions will contain enough
metadata to know where they came from.
2020-04-05 12:43:39 +02:00
Andreas Kling
4f200def9c AK: Stop allowing implicit downcast with OwnPtr and NonnullOwnPtr
Same issue here as we had with RefPtr and NonnullRefPtr.

Since we can't make copies of an owning pointer, we don't get quite the
same static_ptr_cast<T> here. Instead I've only added a new templated
version of OwnPtr::release_nonnull() in this patch, to solve the only
issue that popped up.

I'm not sure what the best solution here is, but this works for now.
2020-04-05 11:32:30 +02:00
Andreas Kling
1d468ed6d3 AK: Stop allowing implicit downcast with RefPtr and NonnullRefPtr
We were allowing this dangerous kind of thing:

RefPtr<Base> base;
RefPtr<Derived> derived = base;

This patch changes the {Nonnull,}RefPtr constructors so this is no
longer possible.

To downcast one of these pointers, there is now static_ptr_cast<T>:

RefPtr<Derived> derived = static_ptr_cast<Derived>(base);

Fixing this exposed a ton of cowboy-downcasts in various places,
which we're now forced to fix. :^)
2020-04-05 11:19:00 +02:00
Andreas Kling
058c614110 LibJS: Fix missing paren in modulo-basic.js test 2020-04-05 11:19:00 +02:00
Brian Gianforcaro
240a5b5fd7 LibJS: Add support for Math.ceil() and Math.trunc()
Introduce support for the both of these Math methods.
Math.trunc is implemented in terms of Math.ceil or Math.floor
based on the input value. Added tests as well.
2020-04-05 10:56:23 +02:00
Brendan Coles
4ea71c9571 IRCClient: Add support for raw protocol commands with /RAW 2020-04-05 10:39:36 +02:00
Brian Gianforcaro
b8cef3a2d3 LibJS: Add support for floating point modulous
This change implements floating point mod based on the algorithm
used in LibM's fmod() implementation. To avoid taking a dependency
on LibM from LibJS I reimplemented the formula in LibJS.

I've incuded some of the example MDM test cases as well.
This surfaced and issue handling NaN which I've fixed as well.
2020-04-05 10:38:13 +02:00
Brian Gianforcaro
41bfff1abe LibJS: Correctness fixes for bitwise_or, address FIXME's in test. 2020-04-05 10:37:02 +02:00
AnotherTest
3e8cf79efa Servers: Add a new DHCP client
This adds a DHCPClient...Server that leases IPv4s.
2020-04-05 09:50:48 +02:00
AnotherTest
77191d82dc Kernel: Add the SO_BINDTODEVICE socket option
This patch adds a way for a socket to ask to be routed through a
specific interface.
Currently, this option only applies to sending, however, it should also
apply to receiving...somehow :^)
2020-04-05 09:50:48 +02:00
AnotherTest
7d0bf9b5a9 Kernel+AK: Separate out MACAddress and move it into AK 2020-04-05 09:50:48 +02:00
Brendan Coles
55b25b3c9b IRCClient: Add icons for channel list, channel invite, channel topic 2020-04-05 09:37:19 +02:00
Tibor Nagy
192513ec33 QuickShow: Fix crash on startup
QSWidget::relayout get triggered before setting a bitmap to display
while setting the widget as the main widget of the window.

I've added a null check to the paint event too to make sure the
widget works with no bitmap set.
2020-04-05 09:36:46 +02:00
Brian Gianforcaro
4e54d0ff21 LibJS: Add support for arbitrary arguments to Math.max
Address the FIXME in MathObject::max to handle an arbitrary
number of arguments. Also adding a test case to verify the
behavior of Math.max() while I'm here.
2020-04-05 09:28:58 +02:00
Linus Groh
79539378c6 js: Add lines to history 2020-04-05 01:54:38 +02:00
Andreas Kling
d84de532f1 LibJS: Add Math.max() 2020-04-05 00:57:00 +02:00
Andreas Kling
ca90f88d4e LibWeb: Add window.setTimeout()
This also leaks the timer just like setInterval() (FIXME).
2020-04-05 00:56:16 +02:00
Andreas Kling
16bd99aa52 LibJS: Add Math.round() 2020-04-05 00:29:01 +02:00
Andreas Kling
afff228308 LibJS: Add Math.floor() 2020-04-05 00:26:56 +02:00
Andreas Kling
3c99c27db4 LibJS: Clean up the anonymous wrapper block in "for" using ScopeGuard
This ensures that we don't forget to pop the wrapper off of the scope
stack when returning early due to an exception or some such. :^)
2020-04-05 00:24:32 +02:00
Andreas Kling
9ebd066ac8 LibJS: Add support for "continue" inside "for" statements :^) 2020-04-05 00:22:42 +02:00
Andreas Kling
e3b92caa6d LibJS: Make "break" actually work inside "switch" 2020-04-05 00:09:48 +02:00
Andreas Kling
9d099835f9 LibWeb: Add CanvasRenderingContext2D scale() and translate() stubs
These don't do anything for now.
2020-04-04 23:54:58 +02:00
Andreas Kling
2db8716a6f LibJS: Don't return the "last computed value" from Interpreter::run()
Only return whatever a "return" statment told us to return.
The last computed value is now available in Interpreter::last_value()
instead, where the REPL can pick it up.
2020-04-04 23:45:13 +02:00
Andreas Kling
97cd1173fa LibJS: Add String.prototype.indexOf() 2020-04-04 23:44:29 +02:00
Andreas Kling
9e05672f87 LibJS: Math.sqrt.length should be 1 2020-04-04 23:28:38 +02:00
Andreas Kling
a860a3f793 LibJS: Hack the lexer to allow numbers with decimals
This is very hackish and should definitely be improved. :^)
2020-04-04 23:13:48 +02:00
Andreas Kling
3a026a1ede LibJS: Add NumberObject and make to_object() on number values create it 2020-04-04 23:13:13 +02:00
Andreas Kling
d4dfe7e525 LibJS: Add Math.sqrt() 2020-04-04 22:44:48 +02:00
Andreas Kling
d155491122 LibJS: Add basic Array constructor
We only support Array() with 0 or 1 parameters so far.
2020-04-04 22:28:21 +02:00