summaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/statements.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/go/gofrontend/statements.cc')
-rw-r--r--gcc/go/gofrontend/statements.cc59
1 files changed, 23 insertions, 36 deletions
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index ca1ad07af6c..0261f9d4882 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -1658,46 +1658,23 @@ Statement::make_tuple_type_guard_assignment(Expression* val, Expression* ok,
location);
}
-// An expression statement.
+// Class Expression_statement.
-class Expression_statement : public Statement
-{
- public:
- Expression_statement(Expression* expr, bool is_ignored)
- : Statement(STATEMENT_EXPRESSION, expr->location()),
- expr_(expr), is_ignored_(is_ignored)
- { }
-
- Expression*
- expr()
- { return this->expr_; }
-
- protected:
- int
- do_traverse(Traverse* traverse)
- { return this->traverse_expression(traverse, &this->expr_); }
-
- void
- do_determine_types()
- { this->expr_->determine_type_no_context(); }
-
- void
- do_check_types(Gogo*);
-
- bool
- do_may_fall_through() const;
+// Constructor.
- Bstatement*
- do_get_backend(Translate_context* context);
+Expression_statement::Expression_statement(Expression* expr, bool is_ignored)
+ : Statement(STATEMENT_EXPRESSION, expr->location()),
+ expr_(expr), is_ignored_(is_ignored)
+{
+}
- void
- do_dump_statement(Ast_dump_context*) const;
+// Determine types.
- private:
- Expression* expr_;
- // Whether the value of this expression is being explicitly ignored.
- bool is_ignored_;
-};
+void
+Expression_statement::do_determine_types()
+{
+ this->expr_->determine_type_no_context();
+}
// Check the types of an expression statement. The only check we do
// is to possibly give an error about discarding the value of the
@@ -4093,6 +4070,16 @@ Type_case_clauses::Type_case_clause::lower(Type* switch_val_type,
bool
Type_case_clauses::Type_case_clause::may_fall_through() const
{
+ if (this->is_fallthrough_)
+ {
+ // This case means that we automatically fall through to the
+ // next case (it's used for T1 in case T1, T2:). It does not
+ // mean that we fall through to the end of the type switch as a
+ // whole. There is sure to be a next case and that next case
+ // will determine whether we fall through to the statements
+ // after the type switch.
+ return false;
+ }
if (this->statements_ == NULL)
return true;
return this->statements_->may_fall_through();