1 ; -*- Mode: Jasmin; indent-tabs-mode: t; tab-width: 4 -*-
2 ; ---------------------------------------------------------------------------
4 ; Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 ; ---------------------------------------------------------------------------
6 ; SquirrelJME is under the Mozilla Public License Version 2.0.
7 ; See license.mkd for licensing and copyright information.
8 ; ---------------------------------------------------------------------------
10 .
class public lang
/interfaces
/TestInvokeInterfaceAB
11 .
super net
/multiphasicapps
/tac
/TestInteger
13 .
method public <init
>()V
15 invokenonvirtual net
/multiphasicapps
/tac
/TestInteger
/<init
>()V
19 .
method public test
()I
21 ; Allocate and initialize an implementation
22 new lang
/interfaces
/ImplementsAB
24 invokespecial lang
/interfaces
/ImplementsAB
/<init
>()V
26 ; Duplicate for the second call
29 ; Call the first, the result is on the stack
30 invokeinterface lang
/interfaces
/InterfaceA
/methodA
()I
1
32 ; Swap the two so the object is at the top then call again
34 invokeinterface lang
/interfaces
/InterfaceB
/methodB
()I
1
36 ; Add both values together which becomes the result