nil_method.c
上传用户:shenzhenrh
上传日期:2013-05-12
资源大小:2904k
文件大小:2k
源码类别:

信息检索与抽取

开发平台:

Unix_Linux

  1. /* GNU Objective C Runtime nil receiver function
  2.    Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
  3.    Contributed by Kresten Krab Thorup
  4. This file is part of GNU CC.
  5. GNU CC is free software; you can redistribute it and/or modify it under the
  6. terms of the GNU General Public License as published by the Free Software
  7. Foundation; either version 2, or (at your option) any later version.
  8. GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY
  9. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  10. FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  11. details.
  12. You should have received a copy of the GNU General Public License along with
  13. GNU CC; see the file COPYING.  If not, write to the Free Software
  14. Foundation, 59 Temple Place - Suite 330,
  15. Boston, MA 02111-1307, USA.  */
  16. /* As a special exception, if you link this library with files compiled with
  17.    GCC to produce an executable, this does not cause the resulting executable
  18.    to be covered by the GNU General Public License. This exception does not
  19.    however invalidate any other reasons why the executable file might be
  20.    covered by the GNU General Public License.  */
  21. /* This is the nil method, the function that is called when the receiver
  22.    of a method is nil */
  23. #include "runtime.h"
  24. #if debug
  25. id
  26. nil_method (id receiver, SEL op, ...)
  27. {
  28.   raiseEvent (InvalidArgument,  "The message `%s' was sent to nil.n",
  29.               sel_get_name (op));
  30.   return nil;
  31. }
  32. #else
  33. id
  34. nil_method(id receiver, SEL op, ...)
  35. {
  36.   return receiver;
  37. }
  38. #endif