Sfoglia il codice sorgente

Fix defer on branching with new scoping rules

gingerBill 6 anni fa
parent
commit
f647187e53
2 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 1 1
      core/fmt/fmt.odin
  2. 1 1
      src/ir.cpp

+ 1 - 1
core/fmt/fmt.odin

@@ -523,7 +523,7 @@ fmt_write_padding :: proc(fi: ^Fmt_Info, width: int) {
 	pad_byte: byte = '0';
 	if fi.space do pad_byte = ' ';
 
-	for _ in 0..width-1 {
+	for i := 0; i < width; i += 1 {
 		write_byte(fi.buf, pad_byte);
 	}
 }

+ 1 - 1
src/ir.cpp

@@ -2967,7 +2967,7 @@ void ir_emit_defer_stmts(irProcedure *proc, irDeferExitKind kind, irBlock *block
 			ir_build_defer_stmt(proc, d);
 		} else if (kind == irDeferExit_Branch) {
 			GB_ASSERT(block != nullptr);
-			isize lower_limit = block->scope_index+1;
+			isize lower_limit = block->scope_index;
 			if (lower_limit < d.scope_index) {
 				ir_build_defer_stmt(proc, d);
 			}