1 // levels.as - MTASC testcase for loading into _level targets
3 // Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 // zou lunkai zoulunkai@gmail.com
23 // Test super in a mutilevel inheritance context(Base1.Derived1.Derived11).
29 class Derived11
extends Derived1
31 var derived11CtorCalled
;
33 var derived11DirectCalled
;
34 var derived11ViaApplyCalled
;
40 this.derived11CtorCalled
= true;
47 this.derived11DirectCalled
= true;
53 this.derived11ViaApplyCalled
= true;
56 static function main
()
58 // Gnash got an unexpected 'ActionLimit hit' here.
59 var derivedObj
= new Derived11
();
61 // check that all constructors in the inheritance chain are called.
62 check_equals
(derivedObj
.baseCtorCalled
, true);
63 check_equals
(derivedObj
.derived1CtorCalled
, true);
64 check_equals
(derivedObj
.derived11CtorCalled
, true);
66 // check that all "super.method()" in the inheritance chain are called.
68 check_equals
(derivedObj
.baseDirectCalled
, true);
69 check_equals
(derivedObj
.derived1DirectCalled
, true);
70 check_equals
(derivedObj
.derived11DirectCalled
, true);
72 // check that all "super.method()" in the inheritance chain are called
73 // when "apply()" is used to call the derived method.
74 var method
= derivedObj
.viaApply
;
75 method
.apply
(derivedObj
);
76 check_equals
(derivedObj
.baseViaApplyCalled
, true);
77 check_equals
(derivedObj
.derived1ViaApplyCalled
, true);
78 check_equals
(derivedObj
.derived11ViaApplyCalled
, true);
80 // check this pointers.
81 check_equals
(derivedObj
.thisPtr
, derivedObj
);
82 check_equals
(derivedObj
.derivedThisPtr
, derivedObj
);
83 check_equals
(derivedObj
.baseThisPtr
, derivedObj
);