mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibJS: Allow division after this
token
This fixes the root cause of #21747, so it makes the clock work on https://toaruos.org
This commit is contained in:
parent
969d9e1fd3
commit
a3f34263fd
Notes:
sideshowbarker
2024-07-17 03:05:16 +09:00
Author: https://github.com/skyrising Commit: https://github.com/SerenityOS/serenity/commit/a3f34263fd Pull-request: https://github.com/SerenityOS/serenity/pull/21798
2 changed files with 5 additions and 1 deletions
|
@ -1643,7 +1643,7 @@ Parser::PrimaryExpressionParseResult Parser::parse_primary_expression()
|
|||
return { move(expression) };
|
||||
}
|
||||
case TokenType::This:
|
||||
consume();
|
||||
consume_and_allow_division();
|
||||
return { create_ast_node<ThisExpression>({ m_source_code, rule_start.position(), position() }) };
|
||||
case TokenType::Class:
|
||||
return { parse_class_expression(false) };
|
||||
|
|
|
@ -45,4 +45,8 @@ test("slash token resolution in lexer", () => {
|
|||
expect("yield / b/").not.toEval();
|
||||
expect("function* foo() { yield / b }").not.toEval();
|
||||
expect("function* foo() { yield / b/ }").toEval();
|
||||
|
||||
expect("this / 1").toEval();
|
||||
expect("this / 1 /").not.toEval();
|
||||
expect("this / 1 / 1").toEval();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue