Commit 99629965 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Fix an issue where the order of symbol definition determined if

code could compile or not.

Fixes #1569
parent 5a83b69d
varnishtest "symbol lookup order issue"
varnish v1 -vcl {
vcl 4.0;
import ${vmod_debug};
backend debug {
.host = "127.0.0.1";
.port = "80";
}
sub debug {
set req.backend_hint = debug;
}
sub vcl_recv {
call debug;
}
}
......@@ -688,7 +688,15 @@ vcc_expr4(struct vcc *tl, struct expr **e, enum var_type fmt)
* XXX: what if var and func/proc had same name ?
* XXX: look for SYM_VAR first for consistency ?
*/
sym = VCC_FindSymbol(tl, tl->t, SYM_NONE);
sym = NULL;
if (fmt == BACKEND)
sym = VCC_FindSymbol(tl, tl->t, SYM_BACKEND);
if (sym == NULL)
sym = VCC_FindSymbol(tl, tl->t, SYM_VAR);
if (sym == NULL)
sym = VCC_FindSymbol(tl, tl->t, SYM_FUNC);
if (sym == NULL)
sym = VCC_FindSymbol(tl, tl->t, SYM_NONE);
if (sym == NULL || sym->eval == NULL) {
VSB_printf(tl->sb, "Symbol not found: ");
vcc_ErrToken(tl, tl->t);
......
......@@ -50,7 +50,6 @@ VCC_SymKind(struct vcc *tl, const struct symbol *s)
}
}
static struct symbol *
vcc_AddSymbol(struct vcc *tl, const char *nb, int l, enum symkind kind)
{
......
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