summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-07-02 14:46:58 +0430
committerAndreas Kling <kling@serenityos.org>2021-07-02 14:59:03 +0200
commit0292ad33eb209e5bb23f4d4a552489dbc8ada203 (patch)
tree7480aba6a49ba892f4a77466cd6d3fd751b4a626 /Userland/Libraries
parent46ef333e9cd86d8976bdd544bafd9f120355980d (diff)
downloadserenity-0292ad33eb209e5bb23f4d4a552489dbc8ada203.zip
LibJS: Make a slash after a curly close mean not-division
There's no grammar rule that allows this.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibJS/Lexer.cpp1
-rw-r--r--Userland/Libraries/LibJS/Tests/syntax/slash-after-block.js6
2 files changed, 6 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Lexer.cpp b/Userland/Libraries/LibJS/Lexer.cpp
index 5d39c5431e..0263231065 100644
--- a/Userland/Libraries/LibJS/Lexer.cpp
+++ b/Userland/Libraries/LibJS/Lexer.cpp
@@ -360,7 +360,6 @@ bool Lexer::slash_means_division() const
return type == TokenType::BigIntLiteral
|| type == TokenType::BoolLiteral
|| type == TokenType::BracketClose
- || type == TokenType::CurlyClose
|| type == TokenType::Identifier
|| type == TokenType::NullLiteral
|| type == TokenType::NumericLiteral
diff --git a/Userland/Libraries/LibJS/Tests/syntax/slash-after-block.js b/Userland/Libraries/LibJS/Tests/syntax/slash-after-block.js
new file mode 100644
index 0000000000..67839147f9
--- /dev/null
+++ b/Userland/Libraries/LibJS/Tests/syntax/slash-after-block.js
@@ -0,0 +1,6 @@
+test("slash token resolution in lexer", () => {
+ expect(`{ blah.blah; }\n/foo/`).toEval();
+ expect("``/foo/").not.toEval();
+ expect("1/foo/").not.toEval();
+ expect("1/foo").toEval();
+});