aboutsummaryrefslogtreecommitdiff
path: root/build2/test/script/parser.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-01-18 18:38:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-01-18 18:38:06 +0200
commit8ecc2d18bf86b1021a31a2e5d01e71afbaa1efd0 (patch)
tree3b83ee62860ef53121e1a20dcad78af4a5698121 /build2/test/script/parser.cxx
parent34faaea18926120fa9cd68686fe69d81b81ad4b7 (diff)
Add missing diagnostics in testscript parser
Diffstat (limited to 'build2/test/script/parser.cxx')
-rw-r--r--build2/test/script/parser.cxx25
1 files changed, 25 insertions, 0 deletions
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.