This is in preparation of escape analysis; function parameters
can now be tagged with interesting bits by the compiler by
assigning to n->note.
tested by having typecheck put a fake tag on all parameters of
pointer type and compiling the tree.
R=rsc
CC=golang-dev
https://golang.org/cl/
4524092
}
hidden_dcl:
- hidden_opt_sym hidden_type
+ hidden_opt_sym hidden_type hidden_tag
{
$$ = nod(ODCLFIELD, $1, typenod($2));
+ $$->val = $3;
}
-| hidden_opt_sym LDDD
- {
- Type *t;
-
- yyerror("invalid variadic function type in import - recompile import");
-
- t = typ(TARRAY);
- t->bound = -1;
- t->type = typ(TINTER);
- $$ = nod(ODCLFIELD, $1, typenod(t));
- $$->isddd = 1;
- }
-
-| hidden_opt_sym LDDD hidden_type
+| hidden_opt_sym LDDD hidden_type hidden_tag
{
Type *t;
t->type = $3;
$$ = nod(ODCLFIELD, $1, typenod(t));
$$->isddd = 1;
+ $$->val = $4;
}
hidden_structdcl:
}
-// Parameter = ( identifier | "?" ) [ "..." ] Type .
+// Parameter = ( identifier | "?" ) [ "..." ] Type [ ":" string_lit ] .
//
func (p *gcParser) parseParameter() (par *ast.Object, isVariadic bool) {
name := p.parseName()
isVariadic = true
}
ptyp := p.parseType()
+ // ignore argument tag
+ if p.tok == ':' {
+ p.next()
+ p.expect(scanner.String)
+ }
par = ast.NewObj(ast.Var, name)
par.Type = ptyp
return