File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,17 @@ static inline ASR::ttype_t *type_get_past_array(ASR::ttype_t *f)
115115 }
116116}
117117
118+ static inline ASR::ttype_t *type_get_past_const (ASR::ttype_t *f)
119+ {
120+ if (ASR::is_a<ASR::Const_t>(*f)) {
121+ ASR::Const_t *e = ASR::down_cast<ASR::Const_t>(f);
122+ LCOMPILERS_ASSERT (!ASR::is_a<ASR::Const_t>(*e->m_type ));
123+ return e->m_type ;
124+ } else {
125+ return f;
126+ }
127+ }
128+
118129static inline ASR::Variable_t* EXPR2VAR (const ASR::expr_t *f)
119130{
120131 return ASR::down_cast<ASR::Variable_t>(symbol_get_past_external (
Original file line number Diff line number Diff line change @@ -1015,6 +1015,22 @@ class VerifyVisitor : public BaseWalkVisitor<VerifyVisitor>
10151015 BaseWalkVisitor<VerifyVisitor>::visit_ArrayConstant (x);
10161016 }
10171017
1018+ void visit_dimension (const dimension_t &x) {
1019+ if (x.m_start ) {
1020+ require_with_loc (ASR::is_a<ASR::Integer_t>(
1021+ *ASRUtils::type_get_past_const (ASRUtils::expr_type (x.m_start ))),
1022+ " Start dimension must be a signed integer" , x.loc );
1023+ visit_expr (*x.m_start );
1024+ }
1025+
1026+ if (x.m_length ) {
1027+ require_with_loc (ASR::is_a<ASR::Integer_t>(
1028+ *ASRUtils::type_get_past_const (ASRUtils::expr_type (x.m_length ))),
1029+ " Length dimension must be a signed integer" , x.loc );
1030+ visit_expr (*x.m_length );
1031+ }
1032+ }
1033+
10181034 void visit_Array (const Array_t& x) {
10191035 visit_ttype (*x.m_type );
10201036 require (x.n_dims != 0 , " Array type cannot have 0 dimensions." )
You can’t perform that action at this time.
0 commit comments