Remove Def* bytecodes from hhas tests
[hiphop-php.git] / hphp / test / quick / asm_class.hhas
blob3adbe0ffa8a120a595ea099ac0228b6c2a90a00f
1 .hh_file 1;
3 # Basic test of classes for hip hop assembler.
6 .main {
8   Int 1
9   RetC
12 .class Base {
13   .method [public] __construct {
14     String "default constructor\n"
15     Print
16     PopC
18     Null
19     RetC
20   }
22   .method [public static] print_it($x) {
23     CGetL $x
24     String "\n"
25     Concat
26     Print
27     PopC
29     True
30     RetC
31   }
33   .method [protected] prot_method() {
34     String "In protected method\n"
35     Print
36     RetC
37   }
39   .method [public] overriden() {
40     String "Base::overriden\n"
41     Print
42     RetC
43   }
46 .class [interface] IDunno {
47   .default_ctor;
48   .method [public abstract] abs_method {
49     String "Pure virtual method called"
50     Fatal RuntimeOmitFrame
51   }
54 .class [interface] IDunno2 { .default_ctor; }
56 .class Derived extends Base implements(IDunno IDunno2) {
57   .method [public] some_junk {
58     This
59     NullUninit
60     NullUninit
61     FCallObjMethodD <> 0 1 "" - "" "" NullThrows "prot_method"
62     PopC
64     Null
65     RetC
66   }
68   .method [public] overriden() {
69     String "Derived::overriden\n"
70     Print
71     RetC
72   }
74   .method [public] abs_method() {
75     String "in an abstract method\n"
76     Print
77     RetC
78   }
81 .class WithProps {
82   .property [public] funk;
84   .method [public] print_funk {
85     String "funk"
86     SetL $name
87     PopC
89     This
90     BaseC 0 Warn
91     QueryM 1 CGet PL:$name
92     String "\n"
93     Concat
94     Print
95     RetC
96   }
98   .property [private] defaulted = """s:3:"heh";""";
99   .property [private] badstring =
100     """s:30:"bad string\"""has triple quotes";""";
102   .method [public] print_defaulted {
103     This
104     BaseC 0 Warn
105     QueryM 1 CGet PT:"defaulted"
106     String "\n"
107     Concat
108     Print
109     PopC
111     This
112     BaseC 0 Warn
113     QueryM 1 CGet PT:"badstring"
114     String "bad string\"\"\"has triple quotes"
115     Eq
116     JmpZ broken
117     True
118     RetC
120     broken: String "string escaping is broken\n"
121             Print
122             RetC
123   }
126 .function prop_test {
127   NewObjD "WithProps"
128   Dup
129   NullUninit
130   NullUninit
131   FCallCtor <LockWhileUnwinding> 0 1 "" - "" ""
132   PopC
133   LockObj
134   SetL $obj
135   PopC
137   String "funk"
138   String "value of funk"
139   BaseL $obj Define
140   SetM 1 PC:1
141   PopC
143   CGetL $obj
144   NullUninit
145   NullUninit
146   FCallObjMethodD <> 0 1 "" - "" "" NullThrows "print_funk"
147   PopC
149   CGetL $obj
150   NullUninit
151   NullUninit
152   FCallObjMethodD <> 0 1 "" - "" "" NullThrows "print_defaulted"
153   PopC
155   True
156   RetC
159 .function ["__EntryPoint"("""y:0:{}""")] main {
160   NewObjD "Base"
161   Dup
162   NullUninit
163   NullUninit
164   FCallCtor <LockWhileUnwinding> 0 1 "" - "" ""
165   PopC
166   LockObj
167   SetL $base
168   PopC
170   NullUninit
171   NullUninit
172   NullUninit
173   String "printing this string"
174   String "print_it"
175   String "Base"
176   ClassGetC
177   FCallClsMethod <> 1 1 "" - "" "" LogAsDynamicCall
178   PopC
180   NewObjD "Derived"
181   Dup
182   NullUninit
183   NullUninit
184   FCallCtor <LockWhileUnwinding> 0 1 "" - "" ""
185   PopC
186   LockObj
187   SetL $derived
188   PopC
190   CGetL $derived
191   NullUninit
192   NullUninit
193   FCallObjMethodD <> 0 1 "" - "" "" NullThrows "some_junk"
194   PopC
196   CGetL $base
197   NullUninit
198   NullUninit
199   FCallObjMethodD <> 0 1 "" - "" "" NullThrows "overriden"
200   PopC
202   CGetL $derived
203   NullUninit
204   NullUninit
205   FCallObjMethodD <> 0 1 "" - "" "" NullThrows "overriden"
206   PopC
208   CGetL $derived
209   NullUninit
210   NullUninit
211   FCallObjMethodD <> 0 1 "" - "" "" NullThrows "abs_method"
212   PopC
214   NullUninit
215   NullUninit
216   NullUninit
217   FCallFuncD <> 0 1 "" - "" "prop_test"
218   PopC
220   Int 1
221   RetC