[master] 340abd045 Recognize type-based methods and fix error messages accordingly.
Poul-Henning Kamp
phk at FreeBSD.org
Mon Jun 3 07:23:12 UTC 2019
commit 340abd0456e4d018fd1589f406287057ab6740ff
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Jun 3 07:22:10 2019 +0000
Recognize type-based methods and fix error messages accordingly.
No methods are implemented yet.
diff --git a/bin/varnishtest/tests/v00016.vtc b/bin/varnishtest/tests/v00016.vtc
index 0b8b7b474..7da6152ea 100644
--- a/bin/varnishtest/tests/v00016.vtc
+++ b/bin/varnishtest/tests/v00016.vtc
@@ -41,7 +41,7 @@ varnish v1 -errvcl {Operator > not possible on BACKEND} {
sub vcl_recv { if (a > b) { } }
}
-varnish v1 -errvcl {Symbol not found: 'req.foo'} {
+varnish v1 -errvcl {Unknown property 'foo' for type HTTP} {
backend b { .host = "127.0.0.1"; }
sub vcl_hash { if (req.foo != "bar") { } }
}
diff --git a/bin/varnishtest/tests/v00018.vtc b/bin/varnishtest/tests/v00018.vtc
index fd519c981..3ce6bd051 100644
--- a/bin/varnishtest/tests/v00018.vtc
+++ b/bin/varnishtest/tests/v00018.vtc
@@ -38,7 +38,7 @@ varnish v1 -errvcl {Expected ';' got 'if'} {
sub vcl_recv { set req.url = "foo" if "bar"; }
}
-varnish v1 -errvcl {Symbol not found: 'req.foo'} {
+varnish v1 -errvcl {Unknown property 'foo' for type HTTP} {
backend b { .host = "127.0.0.1"; }
sub vcl_hash { hash_data(req.foo); }
}
diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c
index 49970f2bc..9517bcca1 100644
--- a/lib/libvcc/vcc_expr.c
+++ b/lib/libvcc/vcc_expr.c
@@ -688,7 +688,7 @@ vcc_expr5(struct vcc *tl, struct expr **e, vcc_type_t fmt)
switch (tl->t->tok) {
case ID:
t = tl->t;
- sym = VCC_SymbolGet(tl, SYM_NONE, SYMTAB_EXISTING, XREF_REF);
+ sym = VCC_SymbolGet(tl, SYM_NONE, SYMTAB_PARTIAL, XREF_REF);
ERRCHK(tl);
AN(sym);
if (sym->kind == SYM_FUNC && sym->type == VOID) {
@@ -811,7 +811,16 @@ vcc_expr4(struct vcc *tl, struct expr **e, vcc_type_t fmt)
*e = NULL;
vcc_expr5(tl, e, fmt);
- return;
+ while (tl->t->tok == '.') {
+ vcc_NextToken(tl);
+ ExpectErr(tl, ID);
+ VSB_printf(tl->sb, "Unknown property ");
+ vcc_ErrToken(tl, tl->t);
+ VSB_printf(tl->sb,
+ " for type %s\n", (*e)->fmt->name);
+ vcc_ErrWhere(tl, tl->t);
+ return;
+ }
}
/*--------------------------------------------------------------------
diff --git a/lib/libvcc/vcc_symb.c b/lib/libvcc/vcc_symb.c
index d33a2a564..6da0505e8 100644
--- a/lib/libvcc/vcc_symb.c
+++ b/lib/libvcc/vcc_symb.c
@@ -238,7 +238,7 @@ struct symbol *
VCC_SymbolGet(struct vcc *tl, vcc_kind_t kind,
const struct symmode *e, const struct symxref *x)
{
- struct symtab *st, *st2;
+ struct symtab *st, *st2 = NULL;
struct symbol *sym = NULL, *sym2 = NULL;
struct token *t0, *tn, *tn1, *tn2 = NULL;
More information about the varnish-commit
mailing list