summaryrefslogtreecommitdiffstats
path: root/elaborate.cxx
diff options
context:
space:
mode:
authorfche <fche>2005-08-03 22:14:41 +0000
committerfche <fche>2005-08-03 22:14:41 +0000
commitd5d7c2cc6123580686d5934d83e2b41a8a90cfbb (patch)
tree422cea4c21dfe40927a5bf90784edd796ee2c45c /elaborate.cxx
parent863c02e866122ff21bcba6253b8addfd39703136 (diff)
downloadsystemtap-steved-d5d7c2cc6123580686d5934d83e2b41a8a90cfbb.tar.gz
systemtap-steved-d5d7c2cc6123580686d5934d83e2b41a8a90cfbb.tar.xz
systemtap-steved-d5d7c2cc6123580686d5934d83e2b41a8a90cfbb.zip
2005-08-03 Frank Ch. Eigler <fche@redhat.com>
* stap.1: More meat, all stub sections filled. * elaborate.cxx (visit_assignment): Add numerous missing cases. * parse.cxx: Parse ".=" operator. * testsuite/semok/sixteen.stp: Check them. * main.cxx (usage): Don't show incompletely supported options.
Diffstat (limited to 'elaborate.cxx')
-rw-r--r--elaborate.cxx30
1 files changed, 29 insertions, 1 deletions
diff --git a/elaborate.cxx b/elaborate.cxx
index 54d102ec..8adcc2a7 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -1030,6 +1030,7 @@ typeresolution_info::visit_logical_and_expr (logical_and_expr *e)
void
typeresolution_info::visit_comparison (comparison *e)
{
+ // NB: result of any comparison is an integer!
if (t == pe_stats || t == pe_string)
invalid (e->tok, t);
@@ -1092,11 +1093,36 @@ typeresolution_info::visit_assignment (assignment *e)
}
}
else if (e->op == "+=" || // numeric only
+ e->op == "-=" ||
+ e->op == "*=" ||
+ e->op == "/=" ||
+ e->op == "%=" ||
+ e->op == "&=" ||
+ e->op == "^=" ||
+ e->op == "|=" ||
+ e->op == "<<=" ||
+ e->op == ">>=" ||
false)
{
visit_binary_expression (e);
}
- else // overloaded for string & numeric operands
+ else if (e->op == ".=" || // string only
+ false)
+ {
+ if (t == pe_long || t == pe_stats)
+ invalid (e->tok, t);
+
+ t = pe_string;
+ e->left->visit (this);
+ t = pe_string;
+ e->right->visit (this);
+ if (e->type == pe_unknown)
+ {
+ e->type = pe_string;
+ resolved (e->tok, e->type);
+ }
+ }
+ else if (e->op == "=") // overloaded = for string & numeric operands
{
// logic similar to ternary_expression
exp_type sub_type = t;
@@ -1130,6 +1156,8 @@ typeresolution_info::visit_assignment (assignment *e)
e->left->type != e->right->type)
mismatch (e->tok, e->left->type, e->right->type);
}
+ else
+ throw semantic_error ("unsupported assignment operator " + e->op);
}