Browse Source

* started implementing twasmreader.HandleBlockInstruction

Nikolay Nikolov 1 year ago
parent
commit
fd1fb255a6
1 changed files with 24 additions and 1 deletions
  1. 24 1
      compiler/wasm32/rawasmtext.pas

+ 24 - 1
compiler/wasm32/rawasmtext.pas

@@ -64,7 +64,7 @@ Unit rawasmtext;
         procedure HandleInstruction;
         procedure HandleInstruction;
         procedure HandleFoldedInstruction;
         procedure HandleFoldedInstruction;
         function HandlePlainInstruction: TWasmInstruction;
         function HandlePlainInstruction: TWasmInstruction;
-        procedure HandleBlockInstruction;virtual;abstract;
+        procedure HandleBlockInstruction;
       public
       public
         function Assemble: tlinkedlist;override;
         function Assemble: tlinkedlist;override;
       end;
       end;
@@ -908,6 +908,29 @@ Unit rawasmtext;
       end;
       end;
 
 
 
 
+    procedure twasmreader.HandleBlockInstruction;
+      var
+        instr: TWasmInstruction;
+      begin
+        if actasmtoken<>AS_OPCODE then
+          internalerror(2024071601);
+        case actopcode of
+          a_if,
+          a_block,
+          a_loop:
+            begin
+              instr:=TWasmInstruction.create(TWasmOperand);
+              instr.opcode:=actopcode;
+              Consume(AS_OPCODE);
+              {TODO: implement the rest}
+              internalerror(2024071699);
+            end;
+          else
+            internalerror(2024071602);
+        end;
+      end;
+
+
     function twasmreader.Assemble: tlinkedlist;
     function twasmreader.Assemble: tlinkedlist;
       begin
       begin
         Message1(asmr_d_start_reading,'WebAssembly');
         Message1(asmr_d_start_reading,'WebAssembly');