refactor(compiler-cli): avoid superfluous parenthesis around statements (#33514)
Previously, due to a bug a `Context` with `isStatement: false` could be returned in places where a `Context` with `isStatement: true` was requested. As a result, some statements would be unnecessarily wrapped in parenthesis. This commit fixes the bug in `Context#withStatementMode` to always return a `Context` with the correct `isStatement` value. Note that this does not have any impact on the generated code other than avoiding some superfluous parenthesis on certain statements. PR Close #33514
This commit is contained in:

committed by
Kara Erickson

parent
4c706086a7
commit
1c1240c21a
@ -18,7 +18,7 @@ export class Context {
|
||||
|
||||
get withExpressionMode(): Context { return this.isStatement ? new Context(false) : this; }
|
||||
|
||||
get withStatementMode(): Context { return this.isStatement ? new Context(true) : this; }
|
||||
get withStatementMode(): Context { return !this.isStatement ? new Context(true) : this; }
|
||||
}
|
||||
|
||||
const BINARY_OPERATORS = new Map<BinaryOperator, ts.BinaryOperator>([
|
||||
|
Reference in New Issue
Block a user