diff --git a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Lexer.cpp b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Lexer.cpp index 5e9fd95406..e0678f30b8 100644 --- a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Lexer.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Parser/Lexer.cpp @@ -151,6 +151,10 @@ ParseErrorOr tokenize_tree(XML::Node const* node, bool allow }, move(ignore_comments))); } + + if (tokens.size() && tokens.last().type == TokenType::MemberAccess) + tokens.last().type = TokenType::Dot; + return result; } diff --git a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Tests/spec-no-new-line-after-dot.xml b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Tests/spec-no-new-line-after-dot.xml new file mode 100644 index 0000000000..18a443406c --- /dev/null +++ b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Tests/spec-no-new-line-after-dot.xml @@ -0,0 +1,19 @@ +]> + + + +

1 The Celestial Object

+ +

1.1 Abstract Operations

+ +

1.1.1 Foo ( a )

+ +
    +
  1. Return a.[[b]].
  2. +
+
+
+
+
+
+
diff --git a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Tests/spec-no-new-line-after-dot.xml.expectation b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Tests/spec-no-new-line-after-dot.xml.expectation new file mode 100644 index 0000000000..b84a41a8be --- /dev/null +++ b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/Tests/spec-no-new-line-after-dot.xml.expectation @@ -0,0 +1,8 @@ +===== AST after reference-resolving ===== +Foo(a): +TreeList + ReturnNode + BinaryOperation MemberAccess + Var a + Slot b + diff --git a/Tests/JSSpecCompiler/test-runner.cpp b/Tests/JSSpecCompiler/test-runner.cpp index 272aa4c95c..27df47276c 100644 --- a/Tests/JSSpecCompiler/test-runner.cpp +++ b/Tests/JSSpecCompiler/test-runner.cpp @@ -49,6 +49,7 @@ const Array regression_tests = { }, TestDescription { .sources = { + "spec-no-new-line-after-dot.xml"sv, "spec-single-function-simple.xml"sv, }, .flags = { dump_after_frontend },