diff --git a/compiler/aggas.pas b/compiler/aggas.pas
index 3e75168720..2b1e5eb4d4 100644
--- a/compiler/aggas.pas
+++ b/compiler/aggas.pas
@@ -118,6 +118,9 @@ implementation
 {$ifdef m68k}
       cpuinfo,aasmcpu,
 {$endif m68k}
+{$ifdef wasm}
+      aasmcpu,
+{$endif wasm}
       cpubase,objcasm;
 
     const
@@ -1552,7 +1555,14 @@ implementation
 {$ifdef WASM}
            ait_local:
              begin
-               writer.AsmWriteLn(asminfo^.comment+'TODO: ait_local');
+               writer.AsmWrite(#9'.local'#9);
+               writer.AsmWrite(gas_wasm_basic_type_str[tai_local(hp).bastyp]);
+               if tai_local(hp).name<>'' then
+                 begin
+                   writer.AsmWrite(#9+asminfo^.comment);
+                   writer.AsmWrite(tai_local(hp).name);
+                 end;
+               writer.AsmLn;
              end;
            ait_importexport:
              begin
diff --git a/compiler/wasm32/itcpugas.pas b/compiler/wasm32/itcpugas.pas
index de4ee40b38..45d1e4fbbe 100644
--- a/compiler/wasm32/itcpugas.pas
+++ b/compiler/wasm32/itcpugas.pas
@@ -84,6 +84,8 @@ interface
       'grow_memory', 'current_memory'
     );
 
+    gas_wasm_basic_type_str : array [TWasmBasicType] of string = ('i32','i64','f32','f64');
+
     function gas_regname(r:Tregister):string;