Commit aacdc253 authored by Russ Cox's avatar Russ Cox

fix http://b/1748082

package main
var f = func(a, b int) int { return a + b }

R=ken
OCL=26935
CL=26935
parent 441da9af
......@@ -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)
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment