dart-lang / code_builder

A fluent API for generating valid Dart source code
https://pub.dev/packages/code_builder
BSD 3-Clause "New" or "Revised" License
427 stars 66 forks source link

Fix some missing implicit const contexts #372

Closed natebosch closed 2 years ago

natebosch commented 2 years ago

There are some expressions where an isConst field implies that sub expressions can omit the const keyword. This is manually handled in the appropriate visit methods for the expressions where a const context is sensible. In InvokeExpression a type field expressed the same intent.

Using declareConst and assign did not carry the const context, so an expression would have an omittable const keyword.