From bffb580d6f0e8b6f9623128d38ea653a99a58d49 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 29 Sep 2021 21:48:48 -0700 Subject: compiler: avoid calling Expression::type before lowering This is a minor cleanup to ensure that the various Expression::do_type methods don't have to worry about the possibility that the Expression has not been lowered. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/353140 --- gcc/go/gofrontend/expressions.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gcc/go/gofrontend/expressions.h') diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h index 9f8f4e9..9348354 100644 --- a/gcc/go/gofrontend/expressions.h +++ b/gcc/go/gofrontend/expressions.h @@ -999,7 +999,9 @@ class Expression determine_type_no_context(); // Return the current type of the expression. This may be changed - // by determine_type. + // by determine_type. This should not be called before the lowering + // pass, unless the is_type_expression method returns true (i.e., + // this is an EXPRESSION_TYPE). Type* type() { return this->do_type(); } -- cgit v1.1