From 8ecc2d18bf86b1021a31a2e5d01e71afbaa1efd0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 18 Jan 2017 18:38:06 +0200 Subject: Add missing diagnostics in testscript parser --- build2/test/script/parser.cxx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'build2/test/script/parser.cxx') diff --git a/build2/test/script/parser.cxx b/build2/test/script/parser.cxx index f250d27..f381118 100644 --- a/build2/test/script/parser.cxx +++ b/build2/test/script/parser.cxx @@ -240,6 +240,19 @@ namespace build2 next (t, tt); // Get '{'. const location sl (get_location (t)); + // First check that we don't have any teardown commands yet. + // This will detect things like variable assignments between + // scopes. + // + if (!group_->tdown_.empty ()) + { + location tl ( + group_->tdown_.back ().tokens.front ().location ()); + + fail (sl) << "scope after teardown" << + info (tl) << "last teardown line appears here"; + } + // If there is no user-supplied id, use the line number // (prefixed with include id) as the scope id. // @@ -763,6 +776,18 @@ namespace build2 // const location sl (ls.back ().tokens.front ().location ()); + // First check that we don't have any teardown commands yet. This + // will detect things like variable assignments between scopes. + // + if (!group_->tdown_.empty ()) + { + location tl ( + group_->tdown_.back ().tokens.front ().location ()); + + fail (sl) << "scope after teardown" << + info (tl) << "last teardown line appears here"; + } + // If there is no user-supplied id, use the line number (prefixed with // include id) as the scope id. Note that we use the same id for all // scopes in the chain. -- cgit v1.1