aboutsummaryrefslogtreecommitdiff
path: root/build2/test/script/parser.cxx
diff options
context:
space:
mode:
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.