1
0
mirror of https://github.com/golang/go synced 2024-11-26 06:47:58 -07:00
package main
var f = func(a, b int) int { return a + b }

R=ken
OCL=26935
CL=26935
This commit is contained in:
Russ Cox 2009-03-30 22:26:00 -07:00
parent 441da9af0d
commit aacdc25399
2 changed files with 8 additions and 1 deletions

View File

@ -481,8 +481,13 @@ funclit0(Type *t)
n = nod(OXXX, N, N);
n->outer = funclit;
n->dcl = autodcl;
funclit = n;
// new declaration context
autodcl = dcl();
autodcl->back = autodcl;
funcargs(t);
}
@ -592,6 +597,7 @@ funclit1(Type *type, Node *body)
n->nbody = body;
compile(n);
funcdepth--;
autodcl = func->dcl;
// if there's no closure, we can use f directly
if(func->cvars == N)

View File

@ -131,6 +131,7 @@ struct Val
typedef struct Sym Sym;
typedef struct Node Node;
typedef struct Type Type;
typedef struct Dcl Dcl;
struct Type
{
@ -211,6 +212,7 @@ struct Node
Node* enter;
Node* exit;
Node* cvars; // closure params
Dcl* dcl; // outer autodcl
// OLITERAL/OREGISTER
Val val;
@ -259,7 +261,6 @@ struct Sym
};
#define S ((Sym*)0)
typedef struct Dcl Dcl;
struct Dcl
{
uchar op;