Commit 2a70111e authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

VMOD functions which return VOID are really procedures and cannot be used

in expressoins.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5204 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 10aabc36
......@@ -538,7 +538,8 @@ vcc_expr4(struct vcc *tl, struct expr **e, enum var_type fmt)
}
AN(sym);
if (sym->kind == SYM_VAR) {
switch(sym->kind) {
case SYM_VAR:
vcc_AddUses(tl, tl->t, sym->r_methods, "Not available");
vp = vcc_FindVar(tl, tl->t, 0, "cannot be read");
ERRCHK(tl);
......@@ -546,12 +547,19 @@ vcc_expr4(struct vcc *tl, struct expr **e, enum var_type fmt)
vsb_printf(e1->vsb, "%s", vp->rname);
e1->fmt = vp->fmt;
vcc_NextToken(tl);
} else if (sym->kind == SYM_FUNC) {
break;
case SYM_FUNC:
vcc_expr_call(tl, &e1, sym);
ERRCHK(tl);
*e = e1;
return;
} else {
case SYM_PROC:
vsb_printf(tl->sb,
"%.*s() is a procedure, it returns no data.\n",
PF(tl->t));
vcc_ErrWhere(tl, tl->t);
return;
default:
vsb_printf(tl->sb, "Wrong kind of symbol.\n");
vcc_ErrWhere(tl, tl->t);
return;
......@@ -908,7 +916,8 @@ vcc_Expr(struct vcc *tl, enum var_type fmt)
vcc_expr_fmt(tl->fb, tl->indent, e);
vsb_putc(tl->fb, '\n');
} else {
vcc_ErrWhere2(tl, t1, tl->t);
if (t1 != tl->t)
vcc_ErrWhere2(tl, t1, tl->t);
}
vcc_delete_expr(e);
}
......@@ -156,6 +156,10 @@ vcc_ParseImport(struct vcc *tl)
sym->cfunc = p;
p += strlen(p) + 1;
sym->args = p;
/* Functions which return VOID are procedures */
if (!memcmp(p, "VOID\0", 5))
sym->kind = SYM_PROC;
}
}
Fh(tl, 0, "\n%s\n", proto);
......
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