Simplify with support of `if let mut`
c6a6897fe3a5ba5252911db6f5a6217e0a34eb10a9fd9cafa497fd2caa4f30f5
1 parent
5cee4d49
lib/std/lang/resolver.rad
+4 -6
| 2023 | 2023 | let sym = try bindIdent(self, name, owner, data, attrs, self.scope); |
|
| 2024 | 2024 | setNodeType(self, owner, type); |
|
| 2025 | 2025 | setNodeType(self, ident, type); |
|
| 2026 | 2026 | ||
| 2027 | 2027 | // Track number of local bindings for lowering stage. |
|
| 2028 | - | if let fnType = self.currentFn { |
|
| 2029 | - | let mut ty = fnType; |
|
| 2030 | - | ty.localCount = fnType.localCount + 1; |
|
| 2028 | + | if let mut fnType = self.currentFn { |
|
| 2029 | + | fnType.localCount += 1; |
|
| 2031 | 2030 | } |
|
| 2032 | 2031 | return sym; |
|
| 2033 | 2032 | } |
|
| 2034 | 2033 | ||
| 2035 | 2034 | /// Bind a constant identifier in the current scope. |
| 4017 | 4016 | if let pat = forStmt.index { |
|
| 4018 | 4017 | try bindForLoopPattern(self, pat, Type::U32, false); |
|
| 4019 | 4018 | } |
|
| 4020 | 4019 | // The lowerer always creates at least one internal variable for iteration, |
|
| 4021 | 4020 | // even when the binding is a placeholder or no explicit index is given. |
|
| 4022 | - | if let fnType = self.currentFn { |
|
| 4023 | - | let mut ty = fnType; // TODO: Language support. |
|
| 4024 | - | ty.localCount = fnType.localCount + 1; |
|
| 4021 | + | if let mut fnType = self.currentFn { |
|
| 4022 | + | fnType.localCount += 1; |
|
| 4025 | 4023 | } |
|
| 4026 | 4024 | try visitLoop(self, forStmt.body); |
|
| 4027 | 4025 | exitScope(self); |
|
| 4028 | 4026 | ||
| 4029 | 4027 | try visitOptional(self, forStmt.elseBranch, Type::Void); |