summaryrefslogtreecommitdiffstats
path: root/staptree.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'staptree.cxx')
-rw-r--r--staptree.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/staptree.cxx b/staptree.cxx
index a8651d1d..756fbc1e 100644
--- a/staptree.cxx
+++ b/staptree.cxx
@@ -96,10 +96,17 @@ void
vardecl::set_arity (int a)
{
assert (a >= 0);
- arity = a;
- index_types.resize (arity);
- for (int i=0; i<arity; i++)
- index_types[i] = pe_unknown;
+
+ if (arity != a && arity >= 0)
+ throw semantic_error ("inconsistent arity", tok);
+
+ if (arity != a)
+ {
+ arity = a;
+ index_types.resize (arity);
+ for (int i=0; i<arity; i++)
+ index_types[i] = pe_unknown;
+ }
}