Oriko
7b13fb557b
LibGUI: Fix overflow crash in highlighter
2020-03-11 13:24:52 +01:00
Oriko
d58cf1a05d
LibGUI: Syntax highlight string escape sequences
2020-03-11 10:16:55 +01:00
Oriko
03b1748d3f
LibGUI: Clear old syntax highlighting
2020-03-11 10:05:01 +01:00
Andreas Kling
ddb5c995c6
LibJS: Let's say that Identifier is an Expression for now
...
This allows us to tighten typing in various other classes.
2020-03-10 12:29:28 +01:00
Andreas Kling
7de35118a9
LibJS: Move Value ops into Value.cpp and tweak BinaryOp names
2020-03-10 12:29:00 +01:00
Andreas Kling
fe6bd9650f
LibJS: Use Value::to_boolean() wherever we haven't checked is_boolean()
...
Unless we've verified that a Value is a boolean, we should not be
calling as_bool() on it.
2020-03-10 12:28:10 +01:00
Alex Muscar
81c6f72134
EventLoop: Don't destroy ID allocator ( #1403 )
...
The ID allocator is destroyed before a timer in HackStudio is
is unregistered leading to an access violation.
Fixes #1382 .
2020-03-10 11:31:37 +01:00
Andreas Kling
a0e18f4450
LibJS: Oops, non-zero values should boolify to true, not false
2020-03-10 10:08:42 +01:00
Andreas Kling
dc0b091c31
LibJS: Implement basic boolean coercion
...
We can't expect the conditionals in "if" and "while" statements to
always return a bool, so we need to know how to boolify a JS::Value.
2020-03-10 08:47:36 +01:00
Andreas Kling
386867da9f
LibJS: Add a convenience helper for visiting a JS::Value
...
We only really care to visit values if they refer to a Cell, but it's
nice to be able to say visit(some_value).
2020-03-09 22:19:06 +01:00
Andreas Kling
05c80cac20
LibJS: Make the GC marking phase cycle-proof
...
Don't visit cells that are already marked. This prevents the marking
phase from looping forever when two cells refer to each other.
Also do the marking directly from the CellVisitor, removing another
unnecessary phase of the collector. :^)
2020-03-09 22:18:03 +01:00
Andreas Kling
0d6be2cac2
LibJS: Make FunctionDeclaration and CallExpression scope-aware
2020-03-09 21:53:39 +01:00
Andreas Kling
363c40e3f3
LibJS: Make sure we mark everything reachable from the scope stack
...
This ensures that local variables survive GC.
2020-03-09 21:49:20 +01:00
Andreas Kling
26165cd92a
LibJS: Add a very simple ObjectExpression for "var x = {}"
...
This allows us to allocate an empty new Object on the GC heap.
2020-03-09 21:49:20 +01:00
Andreas Kling
15d8b9c671
LibJS: Add magical "$gc" function that can be called to trigger GC
...
This will be immensely useful for testing.
2020-03-09 21:49:20 +01:00
Andreas Kling
1382dbc5e1
LibJS: Add basic support for (scoped) variables
...
It's now possible to assign expressions to variables. The variables are
put into the current scope of the interpreter.
Variable lookup follows the scope chain, ending in the global object.
2020-03-09 21:49:20 +01:00
Andreas Kling
c6e54d2a49
LibJS: Simplify Heap::mark_live_cells()
...
Instead of iterating over every single cell, simply iterate over the
live cells and mark them from there.
Thanks to Blam for suggesting this! :^)
2020-03-09 19:36:15 +01:00
0xtechnobabble
5e817ee678
LibJS: Move logical not operator to new unary expression class
2020-03-09 19:33:07 +01:00
0xtechnobabble
65343388b8
LibJS: Add new bitwise and relational operators
...
Do note that when it comes to evaluating binary expressions, we are
asserting in multiple contexts that the values we're operating on are
numbers, we should probably handle other value types to be more tolerant
in the future, since for example, adding a number and a string, in
which case the number is converted to a string implicitly which is then
concatenated, although ugly, is valid javascript.
2020-03-09 19:33:07 +01:00
howar6hill
11aac6fdce
LibJS: Remove superfluous explicit in AST.h ( #1395 )
2020-03-09 14:37:08 +01:00
Liav A
032ce1948e
LibBareMetal: Return FlatPtr from PhysicalAddress::offset_in_page()
2020-03-09 10:53:13 +01:00
howar6hill
1c83c5ed08
LibJS: Implement While statements
2020-03-09 10:13:27 +01:00
Stephan Unverwerth
1207187e97
LibJS: GC: Remove clear_all_mark_bits()
...
Clearing all marked flags has been integrated into the sweep function,
saving an additional full iteration over the heap.
2020-03-09 07:32:09 +01:00
Andreas Kling
63e4b744ed
LibJS: Add a basic mark&sweep garbage collector :^)
...
Objects can now be allocated via the interpreter's heap. Objects that
are allocated in this way will need to be provably reachable from at
least one of the known object graph roots.
The roots are currently determined by Heap::collect_roots().
Anything that wants be collectable garbage should inherit from Cell,
the fundamental atom of the GC heap.
This is pretty neat! :^)
2020-03-08 19:23:58 +01:00
howar6hill
e72fb8f594
LibC: Fix a bug involving miscalculating week counts of last year
2020-03-08 13:56:01 +01:00
howar6hill
df40847c52
LibC: Reimplement asctime() in terms of strftime()
2020-03-08 13:56:01 +01:00
Andreas Kling
37fc6c117c
Userspace: Add missing #includes now that AK/StdLibExtras.h is smaller
2020-03-08 13:06:51 +01:00
Andreas Kling
b1058b33fb
AK: Add global FlatPtr typedef. It's u32 or u64, based on sizeof(void*)
...
Use this instead of uintptr_t throughout the codebase. This makes it
possible to pass a FlatPtr to something that has u32 and u64 overloads.
2020-03-08 13:06:51 +01:00
howar6hill
10e0d4a196
LibCore: Add format option for DateTime::to_string() ( #1358 )
2020-03-08 11:35:26 +01:00
0xtechnobabble
b6307beb6e
LibJS: Implement if statements
...
If statements execute a certain action or an alternative one depending
on whether the tested condition is true or false, this commit helps
establish basic control flow capabilities in the AST.
2020-03-08 11:15:07 +01:00
0xtechnobabble
a96bf2c22e
LibJS: Implement logical expressions
...
Logical expressions are expressions which can return either true or
false according to a provided condition.
2020-03-08 11:15:07 +01:00
0xtechnobabble
4e62dcd6e6
LibJS: Add typed comparison operator
...
The `===` operator allows us to compare two values while taking their
type into consideration.
2020-03-08 11:15:07 +01:00
0xtechnobabble
3fb0ff102c
LibJS: Allow the dumping of literals that aren't numbers
2020-03-08 11:15:07 +01:00
Tibor Nagy
0d17e3bfa6
LibGUI: Fix null-termination of TextDocumentLine
2020-03-08 10:31:48 +01:00
Andreas Kling
0c7058aaa0
LibJS: Include the operator in BinaryExpression dumps
2020-03-07 23:17:07 +01:00
Andreas Kling
1611071ac7
LibJS: Flesh out JS::Value a little bit more
2020-03-07 23:17:07 +01:00
Andreas Kling
d52130836e
LibJS: Simplify LogStream::operator<<(JS::Value) and move to .cpp file
2020-03-07 23:17:07 +01:00
Elisée Maurer
cbe0053a97
LibJS: Fix string representation for value of type undefined
2020-03-07 23:15:36 +01:00
Andreas Kling
f5476be702
LibJS: Start building a JavaScript engine for SerenityOS :^)
...
I always tell people to start building things by working on the thing
that seems the most interesting right now. The most interesting thing
here was an AST + simple interpreter, so that's where we start!
There is no lexer or parser yet, we build an AST directly and then
execute it in the interpreter, producing a return value.
This seems like the start of something interesting. :^)
2020-03-07 19:42:11 +01:00
Andreas Kling
7a9cb2dfca
LibWeb: Cache the <body background> style image value
...
This way we don't refetch the background image every time style is
recomputed (e.g when hovering different elements.)
2020-03-07 11:17:18 +01:00
Andreas Kling
830a57c6b2
LibWeb: Rename directory LibHTML => LibWeb
...
Let's rename this to LibWeb since it aims to provide more parts of the
web platform than just HTML. :^)
2020-03-07 10:32:51 +01:00
Andreas Kling
7a6c4a72d5
LibWeb: Move everything into the Web namespace
2020-03-07 10:27:02 +01:00
Shannon Booth
6a3b12664a
LibGUI: Move Icon and FontDatabase into the GUI namespace
...
We also clean up some old references to the old G prefixed GUI classes
This also fixes a potential bug with using: C_OBJECT_ABSTRACT(GAbstractButton)
instead of C_OBJECT_ABSTRACT(AbstractButton)
2020-03-07 01:33:53 +01:00
Shannon Booth
57f1c919df
LibCore: Remove all remaining C prefix references
...
LibCore's GZip is also moved into the Core namespace with this change.
2020-03-07 01:33:53 +01:00
rhin123
72ef3e529a
TerminalWidget: Implement ALT selection
...
When holding ALT & selecting text, the terminal now forms a rectangle
selection similar to other terminal behaviors.
2020-03-06 20:20:02 +01:00
howar6hill
4ba206b7e5
LibC: Fix a indentation problem in time.cpp
2020-03-06 20:15:07 +01:00
Andreas Kling
52954ccce6
LibC: Fix crash in free() now that mprotect() works correctly
...
After we mprotect(PROT_NONE) an allocation block, we can't expect to
read the m_size from that block right after. :^)
2020-03-06 10:52:36 +01:00
Andreas Kling
8bb361889c
AK: Remove Optional::operator bool()
...
This was causing some obvious-in-hindsight but hard to spot bugs where
we'd implicitly convert the bool to an integer type and carry on with
the number 1 instead of the actual value().
2020-03-06 10:32:58 +01:00
howar6hill
ae233c1e82
LibC: Implement time formatting functions, partially support timezone
...
Also fix a bug in mktime() caused by forgetting to check if the present year
is a leap year.
2020-03-06 10:32:48 +01:00
Andreas Kling
211e938234
LibGUI: Fix missing equality checks in Window::did_remove_widget()
...
We should only detach from the cursor tracking widgets on unparenting
if they were the same widget that's being unparented!
Thanks to @agoose77 for spotting this!
Fixes #1354 .
2020-03-05 19:49:18 +01:00