objcutil.pas 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. {
  2. Copyright (c) 2009 by Jonas Maebe
  3. This unit implements some Objective-C helper routines at the node tree
  4. level.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. {$i fpcdefs.inc}
  19. unit objcutil;
  20. interface
  21. uses
  22. node,
  23. symdef;
  24. function objcsuperclassnode(def: tobjectdef): tnode;
  25. implementation
  26. uses
  27. pass_1,
  28. verbose,
  29. symtable,symconst,
  30. nbas,nmem,ncal,nld;
  31. function objcsuperclassnode(def: tobjectdef): tnode;
  32. var
  33. block: tblocknode;
  34. statements: tstatementnode;
  35. para: tcallparanode;
  36. begin
  37. { only valid for Objective-C classes }
  38. if not is_objcclass(def) then
  39. internalerror(2009032903);
  40. block:=internalstatements(statements);
  41. para:=ccallparanode.create(cloadvmtaddrnode.create(ctypenode.create(def)),nil);
  42. addstatement(statements,ccallnode.createinternfromunit('OBJC1','CLASS_GETSUPERCLASS',para));
  43. typecheckpass(block);
  44. result:=block;
  45. end;
  46. end.