소스 검색

+ added 'else' tracking for the if..end_if blocks

Nikolay Nikolov 3 년 전
부모
커밋
7f1050464a
1개의 변경된 파일11개의 추가작업 그리고 0개의 파일을 삭제
  1. 11 0
      compiler/wasm32/cpupi.pas

+ 11 - 0
compiler/wasm32/cpupi.pas

@@ -323,6 +323,7 @@ implementation
 
       twasmblockitem = class(TLinkedListItem)
         blockstart: taicpu;
+        elseinstr: taicpu;
         constructor Create(ablockstart: taicpu);
       end;
 
@@ -464,6 +465,16 @@ implementation
                           inc(cur_nesting_depth);
                         end;
 
+                      a_else:
+                        begin
+                          cblock:=twasmblockitem(blockstack.Last);
+                          if (cblock=nil) or
+                             (cblock.blockstart.opcode<>a_if) or
+                             assigned(cblock.elseinstr) then
+                            internalerror(2021102302);
+                          cblock.elseinstr:=lastinstr;
+                        end;
+
                       a_end_block,
                       a_end_loop,
                       a_end_if,