Generalise empty object literal property access fix to all object literals

This commit is contained in:
Henry Mercer
2017-08-28 23:14:19 +01:00
parent c79000801f
commit 2c028ae3e5
54 changed files with 391 additions and 391 deletions

View File

@@ -3816,13 +3816,13 @@ namespace ts {
// NewExpression:
// new C.x -> not the same as (new C).x
//
// EmptyObjectLiteral:
// {}.toString() -> is incorrect syntax, should be ({}).x
// ObjectLiteral:
// {a:1}.toString() -> is incorrect syntax, should be ({a:3}).toString()
//
const emittedExpression = skipPartiallyEmittedExpressions(expression);
if (isLeftHandSideExpression(emittedExpression)
&& (!isNewExpression(emittedExpression) || (<NewExpression>emittedExpression).arguments)
&& !isEmptyObjectLiteral(emittedExpression)) {
&& !isObjectLiteralExpression(emittedExpression)) {
return <LeftHandSideExpression>expression;
}