mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Check for valid identifier in WhenStmt::Describe
This commit is contained in:
parent
da7457340c
commit
9abf8ea8b7
3 changed files with 23 additions and 1 deletions
|
@ -2029,7 +2029,10 @@ void WhenStmt::StmtDescribe(ODesc* d) const {
|
||||||
if ( c.IsDeepCopy() )
|
if ( c.IsDeepCopy() )
|
||||||
d->Add("copy ");
|
d->Add("copy ");
|
||||||
|
|
||||||
d->Add(c.Id()->Name());
|
if ( c.Id() )
|
||||||
|
d->Add(c.Id()->Name());
|
||||||
|
else
|
||||||
|
d->Add("<error>");
|
||||||
}
|
}
|
||||||
d->Add("]");
|
d->Add("]");
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
error in /Users/tim/Desktop/projects/zeek-master/testing/btest/.tmp/language.when-local-function-capture-error/when-local-function-capture-error.zeek, line 9: no such local identifier: z
|
||||||
|
error in /Users/tim/Desktop/projects/zeek-master/testing/btest/.tmp/language.when-local-function-capture-error/when-local-function-capture-error.zeek, lines 12-16: y is used inside "when" statement but not captured (when [x, <error>](T == T) { print hmm?, x, y} timeout 100.0 msecs { print timeout})
|
|
@ -0,0 +1,17 @@
|
||||||
|
# @TEST-DOC: Tests that a capture in a function that doesn't exist doesn't crash
|
||||||
|
# @TEST-EXEC-FAIL: zeek -b %INPUT >out 2>&1
|
||||||
|
# @TeST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out
|
||||||
|
|
||||||
|
function f() {
|
||||||
|
local x = 1;
|
||||||
|
local y = 2;
|
||||||
|
|
||||||
|
when [x, z] ( T == T )
|
||||||
|
{
|
||||||
|
print "hmm?", x, y;
|
||||||
|
}
|
||||||
|
timeout 100msec
|
||||||
|
{
|
||||||
|
print "timeout";
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue