Fixes unnamed protocols from templates

This commit is contained in:
Ondrej Zajicek 2015-05-22 11:12:48 +02:00
parent d0e23d42de
commit 9fe1d3ca8a

View file

@ -183,16 +183,18 @@ proto_name:
} }
| FROM SYM { | FROM SYM {
struct symbol *s = cf_default_name(this_proto->protocol->template, &this_proto->protocol->name_counter); struct symbol *s = cf_default_name(this_proto->protocol->template, &this_proto->protocol->name_counter);
s->class = this_proto->class;
s->def = this_proto;
this_proto->name = s->name; this_proto->name = s->name;
if (($2->class != SYM_TEMPLATE) && ($2->class != SYM_PROTO)) cf_error("Template or protocol name expected"); if (($2->class != SYM_TEMPLATE) && ($2->class != SYM_PROTO)) cf_error("Template or protocol name expected");
proto_copy_config(this_proto, $2->def); proto_copy_config(this_proto, $2->def);
} }
| SYM FROM SYM { | SYM FROM SYM {
if (($3->class != SYM_TEMPLATE) && ($3->class != SYM_PROTO)) cf_error("Template or protocol name expected");
cf_define_symbol($1, this_proto->class, this_proto); cf_define_symbol($1, this_proto->class, this_proto);
this_proto->name = $1->name; this_proto->name = $1->name;
if (($3->class != SYM_TEMPLATE) && ($3->class != SYM_PROTO)) cf_error("Template or protocol name expected");
proto_copy_config(this_proto, $3->def); proto_copy_config(this_proto, $3->def);
} }
; ;