Add case for valid import in a new covered expression

This commit is contained in:
Leo Balter 2018-10-24 18:22:17 -04:00 committed by Rick Waldron
parent cd9ca65787
commit ca87891961
1 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,39 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
ImportCall is a CallExpression and Expression, so it can be wrapped
for new expressions, while the same production is not possible without
the parentheses wrapping.
esid: prod-ImportCall
info: |
CallExpression:
ImportCall
ImportCall :
import( AssignmentExpression[+In, ?Yield] )
NewExpression :
MemberExpression
new NewExpression
MemberExpression :
PrimaryExpression
PrimaryExpression :
CoverParenthesizedExpressionAndArrowParameterList
features: [dynamic-import]
---*/
assert.throws(TypeError, () => {
new (import(''))
});
assert.throws(TypeError, () => {
new (function() {}, import(''))
});
assert.sameValue(
typeof new (import(''), function() {}),
'object',
);