new-covered-expression-is-valid.js (902B)
1 // Copyright (C) 2018 Leo Balter. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 description: > 5 ImportCall is a CallExpression and Expression, so it can be wrapped 6 for new expressions, while the same production is not possible without 7 the parentheses wrapping. 8 esid: prod-ImportCall 9 info: | 10 CallExpression: 11 ImportCall 12 13 ImportCall : 14 import( AssignmentExpression[+In, ?Yield] ) 15 16 NewExpression : 17 MemberExpression 18 new NewExpression 19 20 MemberExpression : 21 PrimaryExpression 22 23 PrimaryExpression : 24 CoverParenthesizedExpressionAndArrowParameterList 25 features: [dynamic-import] 26 ---*/ 27 28 assert.throws(TypeError, () => { 29 new (import('')) 30 }); 31 32 assert.throws(TypeError, () => { 33 new (function() {}, import('')) 34 }); 35 36 assert.sameValue( 37 typeof new (import(''), function() {}), 38 'object', 39 ); 40 41 reportCompare(0, 0);