mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:27:35 +00:00
LibJS: Apply the correct precedence for unary + and - operators
When determining the precedence of the + and - operators, the parser always returned the precedence using these operators in a binary expression (lower than division!). The context of whether the operator is used in a unary or binary expression must be taken into account.
This commit is contained in:
parent
18c54d8d40
commit
073eb46824
2 changed files with 17 additions and 1 deletions
|
@ -12,3 +12,7 @@ test("basic functionality", () => {
|
|||
expect((typeof "x" === "string") === true).toBeTrue();
|
||||
expect(!(typeof "x" === "string") === false).toBeTrue();
|
||||
});
|
||||
|
||||
test("unary +/- operators bind higher than binary", () => {
|
||||
expect(10 ** -3 / 2).toEqual(0.0005);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue