From a0db788ed6183e8b2719d820c88168aac4d92e76 Mon Sep 17 00:00:00 2001 From: Jason Williams <936006+jasonwilliams@users.noreply.github.com> Date: Mon, 13 Apr 2020 14:36:04 +0100 Subject: [PATCH] adding test for #273 (#313) --- boa/src/syntax/parser/tests.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/boa/src/syntax/parser/tests.rs b/boa/src/syntax/parser/tests.rs index ec25a0499b1..2c2d630a07e 100644 --- a/boa/src/syntax/parser/tests.rs +++ b/boa/src/syntax/parser/tests.rs @@ -709,3 +709,21 @@ fn check_function_declarations() { )], ); } + +#[test] +/// Should be parsed as `new Class().method()` instead of `new (Class().method())` +fn check_construct_call_precedence() { + check_parser( + "new Date().getTime()", + &[Node::Call( + Box::new(Node::GetConstField( + Box::new(Node::New(Box::new(Node::Call( + Box::new(Node::Local(String::from("Date"))), + vec![], + )))), + String::from("getTime"), + )), + vec![], + )], + ) +}