/test/language/unclassified/test_irf3.e

http://github.com/tybor/Liberty · Specman e · 120 lines · 82 code · 15 blank · 23 comment · 2 complexity · 3675e961c168c907533851203cede22a MD5 · raw file

  1. -- This file is part of SmartEiffel The GNU Eiffel Compiler Tools and Libraries.
  2. -- See the Copyright notice at the end of this file.
  3. --
  4. class TEST_IRF3
  5. -- Test inlining of RUN_FEATURE3.
  6. create {}
  7. make
  8. feature {ANY}
  9. att: INTEGER
  10. make
  11. do
  12. set_attribute1(1 + 1)
  13. set_attribute2
  14. set_attribute3
  15. set_attribute4
  16. set_attribute5
  17. inline1
  18. inline2
  19. inline3
  20. inline4
  21. end
  22. feature {} -- All those feature are inlined in -boost mode :
  23. set_attribute1 (a: like att)
  24. do
  25. att := a
  26. end
  27. set_attribute2
  28. do
  29. att := 4
  30. end
  31. set_attribute3
  32. local
  33. i: INTEGER
  34. do
  35. att := i
  36. end
  37. set_attribute4
  38. local
  39. i: INTEGER
  40. do
  41. att := i
  42. end
  43. set_attribute5
  44. local
  45. i: INTEGER; j: INTEGER
  46. do
  47. att := i + j
  48. end
  49. inline1
  50. do
  51. end
  52. inline2
  53. local
  54. i: INTEGER; j: INTEGER
  55. do
  56. i := 1
  57. j := i + 1
  58. end
  59. inline3
  60. do
  61. inline1
  62. inline2
  63. end
  64. feature {} -- Recursive call is not inlined :-)
  65. inline4
  66. local
  67. i: INTEGER
  68. do
  69. i := i + 1
  70. if i < 0 then
  71. inline4
  72. end
  73. end
  74. feature {}
  75. assert (b: BOOLEAN)
  76. do
  77. cpt := cpt + 1
  78. if not b then
  79. std_output.put_string("TEST_INTEGER1: ERROR Test # ")
  80. std_output.put_integer(cpt)
  81. std_output.put_string("%N")
  82. else
  83. -- std_output.put_string("Yes%N");
  84. end
  85. end
  86. cpt: INTEGER
  87. end -- class TEST_IRF3
  88. --
  89. -- ------------------------------------------------------------------------------------------------------------------------------
  90. -- Copyright notice below. Please read.
  91. --
  92. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  93. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  94. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  95. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  96. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  97. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  98. --
  99. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  100. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  101. --
  102. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  103. --
  104. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  105. -- ------------------------------------------------------------------------------------------------------------------------------