nwasmmem.pas 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. {
  2. Copyright (c) 1998-2023 by Florian Klaempfl and Nikolay Nikolov
  3. Generate WebAssembly code for memory related nodes
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************}
  16. unit nwasmmem;
  17. {$i fpcdefs.inc}
  18. interface
  19. uses
  20. node,nmem,ncgmem;
  21. type
  22. { twasmaddrnode }
  23. twasmaddrnode = class(tcgaddrnode)
  24. function pass_typecheck:tnode;override;
  25. end;
  26. implementation
  27. uses
  28. globals,
  29. verbose,
  30. symcpu;
  31. { twasmaddrnode }
  32. function twasmaddrnode.pass_typecheck: tnode;
  33. begin
  34. Result:=inherited;
  35. if codegenerror then
  36. exit;
  37. if assigned(left) and is_wasm_externref(left.resultdef) then
  38. begin
  39. CGMessagePos(left.fileinfo,type_e_cannot_take_address_of_wasm_externref);
  40. result:=nil;
  41. exit;
  42. end;
  43. end;
  44. begin
  45. caddrnode:=twasmaddrnode;
  46. end.