bind: correctly generate methods with implicit this and parameters
Change-Id: I885a21876d9f639bc0996c9279fd0afefa93cef6 Reviewed-on: https://go-review.googlesource.com/29877 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
This commit is contained in:
parent
2dcaa053a0
commit
9d5f7955ff
|
@ -298,13 +298,13 @@ func (g *JavaGen) genConstructor(f *types.Func, n string) {
|
|||
func (g *JavaGen) genFuncArgs(f *types.Func, jm *java.Func) {
|
||||
sig := f.Type().(*types.Signature)
|
||||
params := sig.Params()
|
||||
i := 0
|
||||
first := 0
|
||||
if jm != nil {
|
||||
// Skip the implicit this argument to the Go method
|
||||
i = params.Len() - len(jm.Params)
|
||||
first = params.Len() - len(jm.Params)
|
||||
}
|
||||
for ; i < params.Len(); i++ {
|
||||
if i > 0 {
|
||||
for i := first; i < params.Len(); i++ {
|
||||
if i > first {
|
||||
g.Printf(", ")
|
||||
}
|
||||
v := params.At(i)
|
||||
|
|
|
@ -149,3 +149,11 @@ func NewJavaInteger() lang.Integer {
|
|||
type NoargConstructor struct {
|
||||
util.BitSet // An otherwise unused class with a no-arg constructor
|
||||
}
|
||||
|
||||
type GoRand struct {
|
||||
util.Random
|
||||
}
|
||||
|
||||
func (_ *GoRand) Next(this util.Random, i int32) int32 {
|
||||
return this.Super().Next(i)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue