Commit 3857349
authored
refactor(verilog): use if let Some in for-loops instead of ? (#1155)
The `?` operator inside a `for` loop short-circuits the entire enclosing
function on the first `None`, not just the current iteration. In practice
`node.child(i)` returns `Some` for every `i < child_count()`, so this was
harmless, but `if let Some(child) = node.child(i)` is more defensively
correct and matches the pattern already used in `handle_package_import`
and `handle_include_directive`.
Closes #11181 parent 07d2c78 commit 3857349
1 file changed
Lines changed: 10 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
152 | | - | |
153 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
| |||
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
168 | 171 | | |
169 | | - | |
170 | 172 | | |
171 | 173 | | |
172 | 174 | | |
| |||
0 commit comments