Age | Commit message (Collapse) | Author |
|
Both types of functions are now Function and implement calling via:
virtual Value call(Interpreter&, Vector<Value> arguments);
This removes the need for CallExpression::execute() to care about which
kind of function it's calling. :^)
|
|
A previous change trying to fix an assertion error completely broke
the automatic moving of cards, this commit will fix this problem
|
|
|
|
|
|
This is mostly for tidiness at the moment.
|
|
To make this work, also start passing Interpreter& to native functions.
|
|
|
|
|
|
This can be used to implement arbitrary functionality, callable from
JavaScript.
To make this work, I had to change the way CallExpression passes
arguments to the callee. Instead of a HashMap<String, Value>, we now
pass an ordered list of Argument { String name; Value value; }.
This patch includes a native "print(argument)" function. :^)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Same kind of issue as #1271.
|
|
This also tightens the means of redeclaration of a variable by proxy,
since we now have a way of knowing how a variable was initially
declared, we can check if it was declared using `let` or `const` and
not tolerate redeclaration like we did previously.
|
|
Note that currently only the non-prefixed variant is supported (i.e i++
not ++i), this variant returns the value of the argument before the
update.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
At last we can parse "hello friends".length :^)
|
|
This still includes the double-quote characters (") but at least the
AST comes out right.
|
|
|
|
|
|
Also, the switch-case flow is simplified for IO access within a Generic
address strucuture's handling.
|
|
|
|
|
|
See https://github.com/SerenityOS/serenity/pull/1410 for the motivation.
|
|
|
|
Remove the need to construct a full Value during parsing. This means
we don't have to worry about plumbing the heap into the parser.
The Literal ASTNode now has a bunch of subclasses that synthesize a
Value on demand.
|
|
Now that we have the beginnings of a parser, let's take the script to
run as a command-line argument and move all the test scripts into
/home/anon/js :^)
To run a script, simply use "js":
$ js my-script.js
To get an AST dump before execution, you can use "js -A"
|
|
|
|
This adds a basic Javascript lexer and parser. It can parse the
currently existing demo programs. More work needs to be done to
turn it into a complete parser than can parse arbitrary JS Code.
The lexer outputs tokens with preceeding whitespace and comments
in the trivia member. This should allow us to generate the exact
source code by concatenating the generated tokens.
The parser is written in a way that it always returns a complete
syntax tree. Error conditions are represented as nodes in the
tree. This simplifies the code and allows it to be used as an
early stage parser, e.g for parsing JS documents in an IDE while
editing the source code.:
|
|
Previously objects were the only heap
allocated value. Now there are also strings.
This replaces a usage of is_object with is_cell.
Without this change strings could be garbage
collected while still being used in an active scope.
|
|
A new IP address or a new network mask can be specified in the command
line arguments of ifconfig to replace the old values of a given network
adapter. Additionally, more information is being printed for each adapter.
|
|
Because the ID of a hidden window is 0, the window server will
fail to update them when the system theme is changed. This
manifests when an application has multiple windows, some of
which are hidden, and the system theme is changed (see
https://github.com/SerenityOS/serenity/issues/1378).
This PR changes the window code to ignore update messages if
the window has the ID 0--is hidden.
Ideally the window ID would not change, and visibility would be
managed separately.
|
|
|
|
Return a nullptr to signal an error instead.
|
|
|
|
|
|
|