| 1 | (******************************************************************************* |
|---|
| 2 | Copyright 2009 Sun Microsystems, Inc., |
|---|
| 3 | 4150 Network Circle, Santa Clara, California 95054, U.S.A. |
|---|
| 4 | All rights reserved. |
|---|
| 5 | |
|---|
| 6 | U.S. Government Rights - Commercial software. |
|---|
| 7 | Government users are subject to the Sun Microsystems, Inc. standard |
|---|
| 8 | license agreement and applicable provisions of the FAR and its supplements. |
|---|
| 9 | |
|---|
| 10 | Use is subject to license terms. |
|---|
| 11 | |
|---|
| 12 | This distribution may include materials developed by third parties. |
|---|
| 13 | |
|---|
| 14 | Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered |
|---|
| 15 | trademarks of Sun Microsystems, Inc. in the U.S. and other countries. |
|---|
| 16 | ******************************************************************************) |
|---|
| 17 | |
|---|
| 18 | component DXXMethodInvocationVarargs |
|---|
| 19 | export Executable |
|---|
| 20 | |
|---|
| 21 | (* We'd like var args to work properly. The problem is |
|---|
| 22 | properly selecting the correct method when many |
|---|
| 23 | different tuple types are possible. *) |
|---|
| 24 | |
|---|
| 25 | trait VarArgT |
|---|
| 26 | takeVararg(i1:ZZ32, s2:String, s_s:String...):ZZ32 |
|---|
| 27 | |
|---|
| 28 | takeMoreVararg(s_s:String...):ZZ32 |
|---|
| 29 | end |
|---|
| 30 | |
|---|
| 31 | foo(a:ZZ32, s:String, vat:VarArgT) : () = do |
|---|
| 32 | var result : ZZ32 |
|---|
| 33 | |
|---|
| 34 | result := vat.takeVararg(a,s,s,s,s,s) |
|---|
| 35 | result := vat.takeVararg(a,s) |
|---|
| 36 | |
|---|
| 37 | result := vat.takeMoreVararg() |
|---|
| 38 | result := vat.takeMoreVararg(s) |
|---|
| 39 | result := vat.takeMoreVararg(s,a,s) |
|---|
| 40 | end |
|---|
| 41 | |
|---|
| 42 | run():() = () |
|---|
| 43 | |
|---|
| 44 | end |
|---|