Andreas Kling
746b310061
LibJS: Use IntrusiveList for keeping track of HandleImpls
...
This allows us to remove a HashTable from heap and cuts down on
some of the malloc traffic when creating handles.
2021-07-21 19:45:21 +02:00
davidot
295192bf15
LibJS: Add tests for strict mode and strict mode propagation
2021-07-20 23:45:28 +02:00
davidot
f8a869f2fc
LibJS: Fix that non-existent references are unresolvable in strict mode
2021-07-20 23:45:28 +02:00
davidot
a49b47bfe6
LibJS: Fix tests that expected wrong this values
2021-07-20 23:45:28 +02:00
Timothy Flynn
c6e9c6d6ab
LibJS: Follow the spec more closely when determining the this value
...
Co-authored-by: davidot <david.tuin@gmail.com>
2021-07-20 23:45:28 +02:00
davidot
a394aa5830
LibJS: Fix that vm.in_strict_mode was propagated to eval and functions
...
For eval it depends on the CallerMode and for a created function it
depends on the function itself.
2021-07-20 23:45:28 +02:00
davidot
a6263150be
LibJS: Disallow unqualified deletes in strict mode
2021-07-20 23:45:28 +02:00
davidot
697882a7ad
LibJS: Disallow multiple __proto__ keys in object expression
2021-07-20 23:45:28 +02:00
davidot
93b57e6d8c
LibJS: Disallow static methods named prototype in classes
2021-07-20 23:45:28 +02:00
davidot
40b8689f9b
LibJS: Disallow duplicated variable declarations
2021-07-20 23:45:28 +02:00
davidot
5cc518f07a
LibJS: Handle strict mode for functions more correctly
...
If a function is strict (has 'use strict' directive) it cannot have
bindings, cannot have duplicated parameter names and cannot have some
reserved keywords and identifiers as parameter names.
The logic partly applies depending on whether we are already in strict
mode or the function contains 'use strict';
2021-07-20 23:45:28 +02:00
davidot
4485df1405
LibJS: Be more strict about reserved and special identifiers
2021-07-20 23:45:28 +02:00
davidot
2a61b90fef
LibJS: Be less strict about 'use strict'
...
It is allowed to have (bogus) directives e.g.
'does nothing'; 'same'; 'use strict';
Should still trigger strict mode.
2021-07-20 23:45:28 +02:00
Linus Groh
feea534dae
LibJS/Tests: Fix typo in Temporal.Instant.compare test description
2021-07-20 17:57:50 +01:00
Linus Groh
99662975ed
LibJS: Partially revert e3fa32b
...
This was causing some syntactically wrong inputs to crash and
subsequently broke CI (test262 parser tests).
2021-07-20 17:53:48 +01:00
Alexander
e3fa32b2ad
LibJS: Optimize source_location_hint and add flag in print_errors
...
This optimizes the algorithm used in source_location_hint and adds a
flag to not print hints in print_errors.
2021-07-20 16:20:59 +02:00
Hendiadyoin1
ed46d52252
Everywhere: Use AK/Math.h if applicable
...
AK's version should see better inlining behaviors, than the LibM one.
We avoid mixed usage for now though.
Also clean up some stale math includes and improper floatingpoint usage.
2021-07-19 16:34:21 +04:30
Idan Horowitz
94322ea985
LibJS: Implement Temporal.PlainDate.prototype.calendar
2021-07-19 09:11:20 +01:00
Idan Horowitz
94e1324a67
LibJS: Implement Temporal.PlainDate.prototype[@@toStringTag]
2021-07-19 09:11:20 +01:00
Idan Horowitz
cc00ccec41
LibJS: Start implementing Temporal.PlainDate
...
This commit adds the PlainDate object itself, its constructor and
prototype (currently empty), and several required abstract operations.
2021-07-19 09:11:20 +01:00
Linus Groh
5516ad7158
LibJS: Rename Temporal.now => Temporal.Now
...
See:
- d0acb66
- 0097fdd
2021-07-19 00:59:26 +01:00
Linus Groh
d159938acc
LibJS: Reflect recent editorial changes in the Temporal proposal
...
See:
- 2148441
- 08c04cc
- b77da58
2021-07-19 00:59:26 +01:00
Linus Groh
5c77885873
LibJS: Implement Temporal.Duration.from()
...
...with ParseTemporalDurationString currently TODO()'d.
2021-07-19 00:34:28 +01:00
Linus Groh
7355c23e17
LibJS: Fix TemporalDurationLike property order
...
The table is sorted alphabetically and supposed to be iterated in that
oder. Also move this to a templated lambda for later re-use with
different target structs and value types.
2021-07-19 00:34:28 +01:00
Linus Groh
152251f5a7
LibJS: Move Temporal AO structs/enum classes above function declarations
...
This is a bit closer to our usual style, and tidier.
2021-07-19 00:34:28 +01:00
Ali Mohammad Pur
c85ab623c0
LibJS: Use a Utf8View on the subject if the regex has the unicode flag
...
This makes LibRegex behave (more) correctly with regards to matching
unicode code points.
2021-07-18 21:10:55 +04:30
Peter Bindels
d4113f6028
LibJS: Correct test to work with our strtod on x86_64 & Clang
...
Modify constant to be half a ULP lower so our strtod also parses it
correctly. Needs to have issue associated for actually fully fixing
strtod to be correct, rather than correct-enough.
2021-07-18 12:45:10 +01:00
Linus Groh
08a303172d
LibJS: Extend class 'extends' RHS expression parsing
...
Instead of only parsing a primary expression, we should also allow
member expressions, call expressions, and tagged template literals (and
optional chains, which we don't have yet).
In the spec, all of this is covered by `LeftHandSideExpression`
(https://tc39.es/ecma262/#prod-LeftHandSideExpression ).
2021-07-18 00:17:57 +01:00
Timothy Flynn
a2e734d202
LibJS: Report string length as the code point length, not byte length
...
For example, U+180E is 3 bytes, but should have a string length of 1.
2021-07-17 16:59:59 +01:00
Timothy Flynn
87848cdf7d
AK: Track byte length, rather than code point length, in Utf8View::trim
...
Utf8View::trim uses Utf8View::substring_view to return its result, which
requires the input to be a byte offset/length rather than code point
length.
2021-07-17 16:59:59 +01:00
Linus Groh
86c6e68431
LibJS: Implement Temporal.Duration.prototype.abs()
2021-07-16 21:59:13 +01:00
Linus Groh
7df47bf3fb
LibJS: Implement Temporal.Duration.prototype.negated()
2021-07-16 21:59:13 +01:00
Linus Groh
9aa1e4b885
LibJS: Implement Temporal.Duration.prototype.with()
2021-07-16 21:59:13 +01:00
Linus Groh
510f668ae3
LibJS: Add TokenType::{Debugger,With} to Token::is_identifier_name()
...
Also remove TokenType::Interface, that should be handled elsewhere (as
a 'future reserved word' in strict mode).
2021-07-16 21:59:13 +01:00
Timothy Flynn
860417fb4f
LibJS: Ensure RegExpStringIterator keeps the RegExp matcher object alive
...
Fixes a crash found with 'test-js -g' due to this object going out of
scope.
2021-07-16 20:44:48 +02:00
Idan Horowitz
8d01d43f5e
LibJS: Replace the boolean argument of Object::set with an enum class
...
This is more serenity-esque and also makes pointing out missing
exception checks during reviews much easier.
2021-07-16 17:50:01 +01:00
Idan Horowitz
4b39e718b3
LibJS: Remove unused Object::PutOwnPropertyMode enum class
...
All usages of this enum class were removed in the Object rewrite, but
this enum was left behind.
2021-07-16 17:50:01 +01:00
Timothy Flynn
4812b95795
LibJS: Implement RegExp AdvanceStringIndex abstraction
...
This isn't particularly useful yet because the underlying LibRegex
engine doesn't support unicode matching yet. But the debt of FIXMEs
related to AdvanceStringIndex have added up, so let's get this out of
the way.
2021-07-16 13:53:11 +01:00
Timothy Flynn
5135f4000c
LibJS: Implement RegExp.prototype [ @@matchAll ]
...
This also allows String.prototype.matchAll to work, as all calls to that
method result in an invocation to @@matchAll.
2021-07-16 13:53:11 +01:00
Timothy Flynn
cfddcad7cf
LibJS: Implement the RegExpStringIterator object
...
This implementation closely follows the StringIterator object in that
the abstract closure meant to be created in CreateRegExpStringIterator
is instead unrolled into RegExpStringIterator.prototype.next.
2021-07-16 13:53:11 +01:00
Timothy Flynn
6cf64d0f09
LibJS: Make the RegExpExec abstraction publically available
...
For RegExpStringIterator, this will be needed outside of the RegExp
prototype.
2021-07-16 13:53:11 +01:00
Linus Groh
9d7e391f94
LibJS/Tests: Add test for Temporal.Instant.prototype.valueOf()
2021-07-16 01:07:01 +01:00
Linus Groh
8daf35e1b1
LibJS: Implement Temporal.Duration.prototype.valueOf()
2021-07-16 01:07:01 +01:00
Linus Groh
a06b034a9a
LibJS: Implement Temporal.Duration.prototype.blank
2021-07-16 01:07:01 +01:00
Linus Groh
3713164fa3
LibJS: Implement Temporal.Duration.prototype.sign
2021-07-16 01:07:01 +01:00
Linus Groh
be5254dcac
LibJS: Implement Temporal.Duration.prototype.nanoseconds
2021-07-16 01:07:01 +01:00
Linus Groh
04e2d215a1
LibJS: Implement Temporal.Duration.prototype.microseconds
2021-07-16 01:07:01 +01:00
Linus Groh
db22f86055
LibJS: Implement Temporal.Duration.prototype.milliseconds
2021-07-16 01:07:01 +01:00
Linus Groh
b81331a110
LibJS: Implement Temporal.Duration.prototype.seconds
2021-07-16 01:07:01 +01:00
Linus Groh
dbdbfbeebc
LibJS: Implement Temporal.Duration.prototype.minutes
2021-07-16 01:07:01 +01:00