| | @@ -3516,7 +3516,7 @@ |
| 3516 | 3516 | end; |
| 3517 | 3517 | |
| 3518 | 3518 | proc codeBody(p: PObj; sig: PType; at: Diag.Pos): ERROR; |
| 3519 | | -var q: PObj; ni, nf: INT; |
| 3519 | +var q: PObj; ni, nf: INT; err: ERROR; |
| 3520 | 3520 | begin |
| 3521 | 3521 | ni := 0; nf := 0; |
| 3522 | 3522 | q := sig^.fields; |
| | @@ -3546,7 +3546,13 @@ |
| 3546 | 3546 | return Scan.markAt(at, "a code procedure returns a single value"); |
| 3547 | 3547 | end; |
| 3548 | 3548 | end; |
| 3549 | | - try Gen.codeProc(p^.chunk, asmConst, asmName); |
| 3549 | + (* in a scope of its own, so that a name it uses and isn't declared, |
| 3550 | + declared then as poison, is gone at its end, as a procedure's |
| 3551 | + locals are, and doesn't clash with a declaration after it *) |
| 3552 | + try Sym.openScope(Sym.newScope()); |
| 3553 | + err := Gen.codeProc(p^.chunk, asmConst, asmName); |
| 3554 | + Sym.closeScope; |
| 3555 | + if err # nil then return err; end; |
| 3550 | 3556 | (* a square root of one real, of its own kind, is made in place *) |
| 3551 | 3557 | q := sig^.fields; |
| 3552 | 3558 | if (q # nil) and (q^.next = nil) and not q^.isVar and (q^.typ^.form = Sym.fReal) |