Skip to content

Commit

Permalink
Update the coding_style doc
Browse files Browse the repository at this point in the history
After lengthy consideration, I believe that this is the best policy for
the team overall. It also corresponds to what I thought we had already
agreed to in the past.

Change-Id: I952297bf966ace0bdb105a5e4539420c3c6b8983
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345748
Commit-Queue: Brian Wilkerson <[email protected]>
Reviewed-by: Phil Quitslund <[email protected]>
Reviewed-by: Samuel Rawlins <[email protected]>
  • Loading branch information
bwilkerson authored and Commit Queue committed Jan 12, 2024
1 parent 1572bb5 commit 4532e20
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/analyzer/doc/implementation/coding_style.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ named `FooExtension`. While this can lead to long names (like
`AnalysisOptionsImplExtension`), the extension name is rarely used (only in
explicit extension overrides), and we value consistency.

### Modifier usage

#### Local variables

We use `var` to declare local variables with two exceptions:

- We use a type annotation if the type of the variable would be incorrectly
inferred without it, such as when a variable that needs to be nullable would
be inferred to be non-nullable because it's initialized to a non-null value.

- We use `final` if the local variable shadows a field and is being used to
allow the type of the field to be promoted.

## Styles we're discussing

This section documents the styles we are currently discussing. The purpose
Expand Down

0 comments on commit 4532e20

Please sign in to comment.