菜谱项目

objectAccess.test 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. Object access
  2. -----
  3. <?php
  4. // property fetch variations
  5. $a->b;
  6. $a->b['c'];
  7. $a->b{'c'};
  8. // method call variations
  9. $a->b();
  10. $a->{'b'}();
  11. $a->$b();
  12. $a->$b['c']();
  13. // array dereferencing
  14. $a->b()['c'];
  15. $a->b(){'c'}; // invalid PHP: drop Support?
  16. -----
  17. !!php5
  18. array(
  19. 0: Expr_PropertyFetch(
  20. var: Expr_Variable(
  21. name: a
  22. comments: array(
  23. 0: // property fetch variations
  24. )
  25. )
  26. name: b
  27. comments: array(
  28. 0: // property fetch variations
  29. )
  30. )
  31. 1: Expr_ArrayDimFetch(
  32. var: Expr_PropertyFetch(
  33. var: Expr_Variable(
  34. name: a
  35. )
  36. name: b
  37. )
  38. dim: Scalar_String(
  39. value: c
  40. )
  41. )
  42. 2: Expr_ArrayDimFetch(
  43. var: Expr_PropertyFetch(
  44. var: Expr_Variable(
  45. name: a
  46. )
  47. name: b
  48. )
  49. dim: Scalar_String(
  50. value: c
  51. )
  52. )
  53. 3: Expr_MethodCall(
  54. var: Expr_Variable(
  55. name: a
  56. comments: array(
  57. 0: // method call variations
  58. )
  59. )
  60. name: b
  61. args: array(
  62. )
  63. comments: array(
  64. 0: // method call variations
  65. )
  66. )
  67. 4: Expr_MethodCall(
  68. var: Expr_Variable(
  69. name: a
  70. )
  71. name: Scalar_String(
  72. value: b
  73. )
  74. args: array(
  75. )
  76. )
  77. 5: Expr_MethodCall(
  78. var: Expr_Variable(
  79. name: a
  80. )
  81. name: Expr_Variable(
  82. name: b
  83. )
  84. args: array(
  85. )
  86. )
  87. 6: Expr_MethodCall(
  88. var: Expr_Variable(
  89. name: a
  90. )
  91. name: Expr_ArrayDimFetch(
  92. var: Expr_Variable(
  93. name: b
  94. )
  95. dim: Scalar_String(
  96. value: c
  97. )
  98. )
  99. args: array(
  100. )
  101. )
  102. 7: Expr_ArrayDimFetch(
  103. var: Expr_MethodCall(
  104. var: Expr_Variable(
  105. name: a
  106. comments: array(
  107. 0: // array dereferencing
  108. )
  109. )
  110. name: b
  111. args: array(
  112. )
  113. comments: array(
  114. 0: // array dereferencing
  115. )
  116. )
  117. dim: Scalar_String(
  118. value: c
  119. )
  120. comments: array(
  121. 0: // array dereferencing
  122. )
  123. )
  124. 8: Expr_ArrayDimFetch(
  125. var: Expr_MethodCall(
  126. var: Expr_Variable(
  127. name: a
  128. )
  129. name: b
  130. args: array(
  131. )
  132. )
  133. dim: Scalar_String(
  134. value: c
  135. )
  136. )
  137. 9: Stmt_Nop(
  138. comments: array(
  139. 0: // invalid PHP: drop Support?
  140. )
  141. )
  142. )