Skip to content

Commit 2d2291b

Browse files
committed
cla-nit
1 parent cb18492 commit 2d2291b

File tree

4 files changed

+48
-20
lines changed

4 files changed

+48
-20
lines changed

.github/ISSUE_TEMPLATE/cla.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: CLA
3+
about: request to grant rights to project of your contributions.
4+
title: '[cla] request'
5+
labels: cla
6+
assignees: ''
7+
8+
---
9+
10+
This issue requests to add the following line to the AUTHORS file,
11+
granting copyright of the individual or organisation to the AUTHORS
12+
of this project.
13+
14+
[Org or '-'] Name <mail>
15+

.github/ISSUE_TEMPLATE/request-for-authorship--cal-.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

memory/model.go

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func (mod *Model) p_add(gp *GenParams, p, r Loc, sum *int) Loc {
199199
switch gp.ts.Kind(gp.typ) {
200200
// these are added as pointers here indirect associattions (params,
201201
// returns, ...) are done in github.com/go-air/objects.Builder
202-
case typeset.Basic, typeset.Func, typeset.Pointer, typeset.Interface:
202+
case typeset.Basic, typeset.Pointer, typeset.Interface:
203203
mod.locs = append(mod.locs, l)
204204
*sum++
205205
case typeset.Slice, typeset.Chan, typeset.Map:
@@ -239,6 +239,26 @@ func (mod *Model) p_add(gp *GenParams, p, r Loc, sum *int) Loc {
239239
gp.typ = gp.ts.Underlying(gp.typ)
240240
mod.p_add(gp, p, r, sum)
241241
added = false
242+
case typeset.Func:
243+
mod.locs = append(mod.locs, l)
244+
*sum++
245+
fty := gp.typ
246+
rcvty := gp.ts.Recv(fty)
247+
if rcvty != typeset.NoType {
248+
gp.typ = rcvty
249+
mod.p_add(gp, n, r, sum)
250+
}
251+
252+
np := gp.ts.NumParams(fty)
253+
for i := 0; i < np; i++ {
254+
_, gp.typ = gp.ts.Param(fty, i)
255+
mod.p_add(gp, n, r, sum)
256+
}
257+
nr := gp.ts.NumResults(fty)
258+
for i := 0; i < nr; i++ {
259+
_, gp.typ = gp.ts.Result(fty, i)
260+
mod.p_add(gp, n, r, sum)
261+
}
242262

243263
default:
244264
panic(fmt.Sprintf("%d: unexpected/unimplemented", gp.typ))

objects/builder.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ func (b *Builder) Pointer(gtype *types.Pointer) *Pointer {
187187
func (b *Builder) Func(sig *types.Signature, declName string, opaque memory.Attrs) *Func {
188188
fn := &Func{declName: declName}
189189
fn.typ = b.ts.FromGoType(sig)
190-
fn.loc = b.Type(fn.typ).Gen()
190+
_, fn.loc = b.Type(fn.typ).WithPointer()
191+
192+
b.mmod.AddAddressOf(fn.loc, fn.loc)
191193

192194
fn.params = make([]memory.Loc, sig.Params().Len())
193195
fn.variadic = sig.Variadic()
@@ -196,29 +198,30 @@ func (b *Builder) Func(sig *types.Signature, declName string, opaque memory.Attr
196198
b.Class(memory.Local) // for all params and returns
197199

198200
recv := sig.Recv()
201+
var obj memory.Loc
199202

200203
if recv != nil {
201204
b.mgp.Type(b.ts.FromGoType(recv.Type()))
202-
fn.recv = b.mmod.Gen(b.mgp)
203-
b.walkObj(fn.recv)
205+
obj, fn.recv = b.mmod.WithPointer(b.mgp)
206+
b.walkObj(obj)
204207
}
205208
params := sig.Params()
206209
N := params.Len()
207210
for i := 0; i < N; i++ {
208211
param := params.At(i)
209212
pty := b.ts.FromGoType(param.Type().Underlying())
210-
fn.params[i] =
211-
b.Pos(param.Pos()).Type(pty).Attrs(memory.IsParam | opaque).Gen()
212-
b.walkObj(fn.params[i])
213+
obj, fn.params[i] =
214+
b.Pos(param.Pos()).Type(pty).Attrs(memory.IsParam | opaque).WithPointer()
215+
b.walkObj(obj)
213216
}
214217
rets := sig.Results()
215218
N = rets.Len()
216219
for i := 0; i < N; i++ {
217220
ret := rets.At(i)
218221
rty := b.ts.FromGoType(ret.Type())
219-
fn.results[i] =
220-
b.Pos(ret.Pos()).Type(rty).Attrs(memory.IsReturn | opaque).Gen()
221-
b.walkObj(fn.results[i])
222+
obj, fn.results[i] =
223+
b.Pos(ret.Pos()).Type(rty).Attrs(memory.IsReturn | opaque).WithPointer()
224+
b.walkObj(obj)
222225
}
223226
// TBD: FreeVars
224227
b.omap[fn.loc] = fn

0 commit comments

Comments
 (0)