angular-docs-cn/packages/compiler-cli
Alex Rickabaugh 718d7fe5fe fix(ivy): properly parenthesize ternary expressions when emitted (#34221)
Previously, ternary expressions were emitted as:

condExpr ? trueCase : falseCase

However, this causes problems when ternary operations are nested. In
particular, a template expression of the form:

a?.b ? c : d

would have compiled to:

a == null ? null : a.b ? c : d

The ternary operator is right-associative, so that expression is interpreted
as:

a == null ? null : (a.b ? c : d)

when in reality left-associativity is desired in this particular instance:

(a == null ? null : a.b) ? c : d

This commit adds a check in the expression translator to detect such
left-associative usages of ternaries and to enforce such associativity with
parentheses when necessary.

A test is also added for the template type-checking expression translator,
to ensure it correctly produces right-associative expressions for ternaries
in the user's template.

Fixes #34087

PR Close #34221
2019-12-06 13:01:48 -08:00
..
integrationtest refactor(compiler-cli): remove bogus packages/compiler-cli/integrationtest/benchmarks/ (#34142) 2019-12-02 11:22:45 -08:00
ngcc fix(ngcc): ensure that bundle `rootDir` is the package path (#34212) 2019-12-05 10:13:02 -08:00
src fix(ivy): properly parenthesize ternary expressions when emitted (#34221) 2019-12-06 13:01:48 -08:00
test fix(ivy): properly parenthesize ternary expressions when emitted (#34221) 2019-12-06 13:01:48 -08:00
BUILD.bazel fix(bazel): update to tsickle 0.37.1 to fix peerDep warnings (#33788) 2019-11-22 13:13:01 -05:00
index.ts refactor(compiler-cli): Move diagnostics files to language service (#33809) 2019-11-14 09:29:07 -08:00
package.json build: set up all packages to publish via wombot proxy (#33747) 2019-11-13 11:34:33 -08:00
tsconfig-build.json build: reference zone.js from source directly instead of npm. (#33046) 2019-11-06 00:48:34 +00:00
tsconfig.json perf(ivy): ngcc - only find dependencies when targeting a single entry-point (#30525) 2019-07-09 09:40:46 -07:00