"func sys.slicestring (? string, ? int, ? int) (? string)\n"
"func sys.indexstring (? string, ? int) (? uint8)\n"
"func sys.intstring (? int64) (? string)\n"
- "func sys.byteastring (? *uint8, ? int) (? string)\n"
"func sys.arraystring (? []uint8) (? string)\n"
"func sys.stringiter (? string, ? int) (? int)\n"
"func sys.stringiter2 (? string, ? int) (retk int, retv int)\n"
addvar(n, t, dclcontext);
autoexport(n->sym);
- addtop = list(addtop, nod(ODCL, n, N));
+ if(funcdepth > 0)
+ addtop = list(addtop, nod(ODCL, n, N));
}
void
Node *done;
Node *a, *fn, *r;
uint32 h;
- Sym *s;
+ Sym *s, *initsym;
if(strcmp(package, "PACKAGE") == 0) {
// sys.go or unsafe.go during compiler build
snprint(namebuf, sizeof(namebuf), "init");
fn = nod(ODCLFUNC, N, N);
- fn->nname = newname(lookup(namebuf));
+ initsym = lookup(namebuf);
+ fn->nname = newname(initsym);
fn->type = functype(N, N, N);
funchdr(fn);
continue;
if(s->oname == N)
continue;
+ if(s == initsym)
+ continue;
// could check that it is fn of no args/returns
a = nod(OCALL, s->oname, N);
$$ = rev($1);
dodclvar($$, $2);
- $$ = nod(OAS, $$, N);
- addtotop($$);
+ if(funcdepth == 0) {
+ $$ = N;
+ } else {
+ $$ = nod(OAS, $$, N);
+ addtotop($$);
+ }
}
Bvardcl:
$$ = rev($1);
dodclvar($$, $2);
- $$ = nod(OAS, $$, N);
- addtotop($$);
+ if(funcdepth == 0) {
+ $$ = N;
+ } else {
+ $$ = nod(OAS, $$, N);
+ addtotop($$);
+ }
}
| new_name_list_r type '=' expr_list
{
func slicestring(string, int, int) string;
func indexstring(string, int) byte;
func intstring(int64) string;
-func byteastring(*byte, int) string;
func arraystring([]byte) string;
func stringiter(string, int) int;
func stringiter2(string, int) (retk int, retv int);
FLUSH(&s);
}
-void
-sys·byteastring(byte *a, int32 l, String s)
-{
- s = gostringsize(l);
- mcpy(s.str, a, l);
- FLUSH(&s);
-}
-
void
sys·arraystring(Array b, String s)
{