summaryrefslogtreecommitdiffstats
path: root/staptree.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'staptree.cxx')
-rw-r--r--staptree.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/staptree.cxx b/staptree.cxx
index 1231f74d..321650eb 100644
--- a/staptree.cxx
+++ b/staptree.cxx
@@ -186,6 +186,30 @@ operator << (ostream& o, const exp_type& e)
}
+void
+target_symbol::assert_no_components(const std::string& tapset)
+{
+ if (components.empty())
+ return;
+
+ switch (components[0].type)
+ {
+ case target_symbol::comp_literal_array_index:
+ throw semantic_error(tapset + " variable '" + base_name +
+ "' may not be used as array",
+ components[0].tok);
+ case target_symbol::comp_struct_member:
+ throw semantic_error(tapset + " variable '" + base_name +
+ "' may not be used as a structure",
+ components[0].tok);
+ default:
+ throw semantic_error ("invalid use of " + tapset +
+ " variable '" + base_name + "'",
+ components[0].tok);
+ }
+}
+
+
// ------------------------------------------------------------------------
// parse tree printing