Commit 3a3aa942 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Allow symbols to be defined after use, provided their use gives

them a clear type.

Fixes #2016
parent ec59b44e
...@@ -10,15 +10,16 @@ server s1 { ...@@ -10,15 +10,16 @@ server s1 {
} -start } -start
varnish v1 -arg "-p vsl_mask=+VCL_trace" -vcl+backend { varnish v1 -arg "-p vsl_mask=+VCL_trace" -vcl+backend {
acl acl1 {
"${localhost}";
}
sub vcl_recv { sub vcl_recv {
if (client.ip ~ acl1) { if (client.ip ~ acl1) {
set req.url = "/"; set req.url = "/";
} }
} }
acl acl1 {
"${localhost}";
}
sub vcl_deliver { sub vcl_deliver {
set resp.http.acl = acl1; set resp.http.acl = acl1;
} }
......
...@@ -235,13 +235,14 @@ VCC_HandleSymbol(struct vcc *tl, const struct token *tk, vcc_type_t fmt, ...@@ -235,13 +235,14 @@ VCC_HandleSymbol(struct vcc *tl, const struct token *tk, vcc_type_t fmt,
AN(sym->def_b); AN(sym->def_b);
vcc_ErrWhere(tl, sym->def_b); vcc_ErrWhere(tl, sym->def_b);
return (sym); return (sym);
} else if (sym != NULL) { } else if (sym != NULL && sym->kind != kind) {
VSB_printf(tl->sb, VSB_printf(tl->sb,
"Name %.*s is a reserved name.\n", PF(tk)); "Name %.*s is a reserved name.\n", PF(tk));
vcc_ErrWhere(tl, tk); vcc_ErrWhere(tl, tk);
return (sym); return (sym);
} }
sym = VCC_SymbolTok(tl, NULL, tk, kind, 1); if (sym == NULL)
sym = VCC_SymbolTok(tl, NULL, tk, kind, 1);
AN(sym); AN(sym);
AZ(sym->ndef); AZ(sym->ndef);
va_start(ap, str); va_start(ap, str);
......
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