1/* Copyright JS Foundation and other contributors, http://js.foundation 2 * 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 order = 0; 17 18 var Mixin1 = (superclass) => class extends superclass { 19 foo () { 20 assert (order++ == 1) 21 if (super.foo) { 22 super.foo (); 23 } 24 } 25 }; 26 27 var Mixin2 = (superclass) => class extends superclass { 28 foo () { 29 assert (order++ == 2) 30 if (super.foo) { 31 assert (super.foo () === 5); 32 } 33 } 34 }; 35 36 class S { 37 foo () { 38 assert (order++ == 3) 39 return 5; 40 } 41 } 42 43 class C extends Mixin1 (Mixin2 (S)) { 44 foo () { 45 assert (order++ == 0) 46 super.foo (); 47 } 48 } 49 50 new C ().foo () 51