Browse Source

+ insert plain instructions and parse nested instructions in twasmreader.HandleFoldedInstruction

Nikolay Nikolov 1 year ago
parent
commit
8ec86ad053
1 changed files with 11 additions and 2 deletions
  1. 11 2
      compiler/wasm32/rawasmtext.pas

+ 11 - 2
compiler/wasm32/rawasmtext.pas

@@ -574,6 +574,7 @@ Unit rawasmtext;
         instr: TWasmInstruction;
         instr: TWasmInstruction;
         tmpS: string;
         tmpS: string;
       begin
       begin
+        instr:=nil;
         //Consume(AS_LPAREN);
         //Consume(AS_LPAREN);
         case actasmtoken of
         case actasmtoken of
           AS_OPCODE:
           AS_OPCODE:
@@ -690,8 +691,16 @@ Unit rawasmtext;
                   end;
                   end;
                 else
                 else
                   begin
                   begin
-                    HandlePlainInstruction;
-                    {todo: parse next folded instructions, insert plain instruction after these}
+                    instr:=HandlePlainInstruction;
+                    while actasmtoken<>AS_RPAREN do
+                      begin
+                        Consume(AS_LPAREN);
+                        HandleFoldedInstruction;
+                      end;
+                    instr.ConcatInstruction(curlist);
+                    instr.Free;
+                    instr:=nil;
+                    Consume(AS_RPAREN);
                   end;
                   end;
               end;
               end;
             end;
             end;