Browse Source

[PATCH 16/83] update the use of name reference in generated wasm

From 46e8e3f0e1f62b26d2091f6e44b5112209c9d266 Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <[email protected]>
Date: Wed, 4 Sep 2019 14:55:41 -0400

git-svn-id: branches/wasm@45893 -
nickysn 5 years ago
parent
commit
d496755ffb
1 changed files with 9 additions and 3 deletions
  1. 9 3
      compiler/wasm/agwat.pas

+ 9 - 3
compiler/wasm/agwat.pas

@@ -113,6 +113,13 @@ implementation
          fixline:=Copy(s,j,i-j+1);
        end;
 
+     function GetWasmName(const st: TSymStr): ansistring;
+     begin
+       Result := '$'+st;
+       Replace(Result, '(','');
+       Replace(Result, ')','');
+     end;
+
      function getreferencestring(var ref : treference) : ansistring;
        begin
          if (ref.arrayreftype<>art_none) or
@@ -126,7 +133,7 @@ implementation
              // been placed on the stack by the previous one.
              if (ref.offset<>0) then
                internalerror(2010122811);
-             result:=ref.symbol.name;
+             result:=GetWasmName(ref.symbol.name);
            end
          else
            begin
@@ -241,8 +248,7 @@ implementation
       end;
       writer.AsmWrite('(func ');
 
-      writer.AsmWrite('$');
-      writer.AsmWrite(pd.procsym.RealName);
+      writer.AsmWrite( GetWasmName( pd.procsym.RealName ));
       //writer.AsmWriteln(MethodDefinition(pd));
       {if jvmtypeneedssignature(pd) then
         begin