@@ -152,17 +152,6 @@ static inline const ASR::symbol_t *symbol_get_past_external(const ASR::symbol_t
152
152
}
153
153
}
154
154
155
- static inline ASR::ttype_t *type_get_past_const (ASR::ttype_t *f)
156
- {
157
- if (ASR::is_a<ASR::Const_t>(*f)) {
158
- ASR::Const_t *e = ASR::down_cast<ASR::Const_t>(f);
159
- LCOMPILERS_ASSERT (!ASR::is_a<ASR::Const_t>(*e->m_type ));
160
- return e->m_type ;
161
- } else {
162
- return f;
163
- }
164
- }
165
-
166
155
static inline ASR::ttype_t *type_get_past_pointer (ASR::ttype_t *f)
167
156
{
168
157
if (ASR::is_a<ASR::Pointer_t>(*f)) {
@@ -227,9 +216,6 @@ static inline int extract_kind_from_ttype_t(const ASR::ttype_t* type) {
227
216
case ASR::ttypeType::Allocatable: {
228
217
return extract_kind_from_ttype_t (ASR::down_cast<ASR::Allocatable_t>(type)->m_type );
229
218
}
230
- case ASR::ttypeType::Const: {
231
- return extract_kind_from_ttype_t (ASR::down_cast<ASR::Const_t>(type)->m_type );
232
- }
233
219
default : {
234
220
return -1 ;
235
221
}
@@ -277,10 +263,6 @@ static inline void set_kind_to_ttype_t(ASR::ttype_t* type, int kind) {
277
263
set_kind_to_ttype_t (ASR::down_cast<ASR::Allocatable_t>(type)->m_type , kind);
278
264
break ;
279
265
}
280
- case ASR::ttypeType::Const: {
281
- set_kind_to_ttype_t (ASR::down_cast<ASR::Const_t>(type)->m_type , kind);
282
- break ;
283
- }
284
266
default : {
285
267
return ;
286
268
}
@@ -392,10 +374,6 @@ static inline ASR::ttype_t* get_contained_type(ASR::ttype_t* asr_type, int overl
392
374
ASR::Allocatable_t* pointer_asr = ASR::down_cast<ASR::Allocatable_t>(asr_type);
393
375
return pointer_asr->m_type ;
394
376
}
395
- case ASR::ttypeType::Const: {
396
- ASR::Const_t* const_asr = ASR::down_cast<ASR::Const_t>(asr_type);
397
- return const_asr->m_type ;
398
- }
399
377
default : {
400
378
return asr_type;
401
379
}
@@ -602,10 +580,6 @@ static inline std::string type_to_str(const ASR::ttype_t *t)
602
580
encode_dimensions (array_t ->n_dims , res, false );
603
581
return res;
604
582
}
605
- case ASR::ttypeType::Const: {
606
- return type_to_str (ASRUtils::get_contained_type (
607
- const_cast <ASR::ttype_t *>(t))) + " const" ;
608
- }
609
583
case ASR::ttypeType::TypeParameter: {
610
584
ASR::TypeParameter_t* tp = ASR::down_cast<ASR::TypeParameter_t>(t);
611
585
return tp->m_param ;
@@ -660,10 +634,6 @@ static inline std::string type_to_str_with_substitution(const ASR::ttype_t *t,
660
634
encode_dimensions (array_t ->n_dims , res, false );
661
635
return res;
662
636
}
663
- case ASR::ttypeType::Const: {
664
- return type_to_str_with_substitution (ASRUtils::get_contained_type (
665
- const_cast <ASR::ttype_t *>(t)), subs) + " const" ;
666
- }
667
637
case ASR::ttypeType::FunctionType: {
668
638
ASR::FunctionType_t* ftp = ASR::down_cast<ASR::FunctionType_t>(t);
669
639
std::string result = " (" ;
@@ -1552,15 +1522,6 @@ static inline std::string get_type_code(const ASR::ttype_t *t, bool use_undersco
1552
1522
return " Allocatable[" + get_type_code (p->m_type , use_underscore_sep,
1553
1523
encode_dimensions_, set_dimensional_hint) + " ]" ;
1554
1524
}
1555
- case ASR::ttypeType::Const: {
1556
- ASR::Const_t* p = ASR::down_cast<ASR::Const_t>(t);
1557
- if ( use_underscore_sep ) {
1558
- return " Const_" + get_type_code (p->m_type , use_underscore_sep,
1559
- encode_dimensions_, set_dimensional_hint) + " _" ;
1560
- }
1561
- return " Const[" + get_type_code (p->m_type , use_underscore_sep,
1562
- encode_dimensions_, set_dimensional_hint) + " ]" ;
1563
- }
1564
1525
case ASR::ttypeType::SymbolicExpression: {
1565
1526
return " S" ;
1566
1527
}
@@ -1694,10 +1655,6 @@ static inline std::string type_to_str_python(const ASR::ttype_t *t,
1694
1655
ASR::Allocatable_t* p = ASR::down_cast<ASR::Allocatable_t>(t);
1695
1656
return " Allocatable[" + type_to_str_python (p->m_type ) + " ]" ;
1696
1657
}
1697
- case ASR::ttypeType::Const: {
1698
- ASR::Const_t* p = ASR::down_cast<ASR::Const_t>(t);
1699
- return " Const[" + type_to_str_python (p->m_type ) + " ]" ;
1700
- }
1701
1658
case ASR::ttypeType::TypeParameter: {
1702
1659
ASR::TypeParameter_t *p = ASR::down_cast<ASR::TypeParameter_t>(t);
1703
1660
return p->m_param ;
@@ -2008,6 +1965,18 @@ bool use_overloaded_file_read_write(std::string &read_write, Vec<ASR::expr_t*> a
2008
1965
2009
1966
void set_intrinsic (ASR::symbol_t * sym);
2010
1967
1968
+ static inline bool is_const (ASR::expr_t *x) {
1969
+ if (ASR::is_a<ASR::Var_t>(*x)) {
1970
+ ASR::Var_t* v = ASR::down_cast<ASR::Var_t>(x);
1971
+ ASR::symbol_t * sym = ASRUtils::symbol_get_past_external (v->m_v );
1972
+ if (sym && ASR::is_a<ASR::Variable_t>(*sym)) {
1973
+ ASR::Variable_t* var = ASR::down_cast<ASR::Variable_t>(sym);
1974
+ return var->m_storage == ASR::storage_typeType::Parameter;
1975
+ }
1976
+ }
1977
+ return false ;
1978
+ }
1979
+
2011
1980
static inline bool is_pointer (ASR::ttype_t *x) {
2012
1981
return ASR::is_a<ASR::Pointer_t>(*x);
2013
1982
}
@@ -2020,10 +1989,9 @@ static inline bool is_integer(ASR::ttype_t &x) {
2020
1989
// type_get_past_pointer(
2021
1990
// type_get_past_const(&x))))));
2022
1991
return ASR::is_a<ASR::Integer_t>(
2023
- *type_get_past_const (
2024
- type_get_past_array (
1992
+ *type_get_past_array (
2025
1993
type_get_past_allocatable (
2026
- type_get_past_pointer (&x))))) ;
1994
+ type_get_past_pointer (&x))));
2027
1995
}
2028
1996
2029
1997
static inline bool is_unsigned_integer (ASR::ttype_t &x) {
@@ -2174,10 +2142,6 @@ inline size_t extract_dimensions_from_ttype(ASR::ttype_t *x,
2174
2142
n_dims = extract_dimensions_from_ttype (ASR::down_cast<ASR::Allocatable_t>(x)->m_type , m_dims);
2175
2143
break ;
2176
2144
}
2177
- case ASR::ttypeType::Const: {
2178
- n_dims = extract_dimensions_from_ttype (ASR::down_cast<ASR::Const_t>(x)->m_type , m_dims);
2179
- break ;
2180
- }
2181
2145
case ASR::ttypeType::SymbolicExpression:
2182
2146
case ASR::ttypeType::Integer:
2183
2147
case ASR::ttypeType::UnsignedInteger:
@@ -2476,9 +2440,6 @@ inline bool is_array(ASR::ttype_t *x) {
2476
2440
}
2477
2441
2478
2442
static inline bool is_aggregate_type (ASR::ttype_t * asr_type) {
2479
- if ( ASR::is_a<ASR::Const_t>(*asr_type) ) {
2480
- asr_type = ASR::down_cast<ASR::Const_t>(asr_type)->m_type ;
2481
- }
2482
2443
return ASRUtils::is_array (asr_type) ||
2483
2444
!(ASR::is_a<ASR::Integer_t>(*asr_type) ||
2484
2445
ASR::is_a<ASR::UnsignedInteger_t>(*asr_type) ||
@@ -2581,12 +2542,6 @@ static inline ASR::ttype_t* duplicate_type(Allocator& al, const ASR::ttype_t* t,
2581
2542
ASR::CPtr_t* ptr = ASR::down_cast<ASR::CPtr_t>(t);
2582
2543
return ASRUtils::TYPE (ASR::make_CPtr_t (al, ptr->base .base .loc ));
2583
2544
}
2584
- case ASR::ttypeType::Const: {
2585
- ASR::Const_t* c = ASR::down_cast<ASR::Const_t>(t);
2586
- ASR::ttype_t * dup_type = duplicate_type (al, c->m_type , dims);
2587
- return ASRUtils::TYPE (ASR::make_Const_t (al, c->base .base .loc ,
2588
- dup_type));
2589
- }
2590
2545
case ASR::ttypeType::List: {
2591
2546
ASR::List_t* l = ASR::down_cast<ASR::List_t>(t);
2592
2547
ASR::ttype_t * dup_type = duplicate_type (al, l->m_type );
@@ -3442,11 +3397,6 @@ inline bool check_equal_type(ASR::ttype_t* x, ASR::ttype_t* y, bool check_for_di
3442
3397
x = ASRUtils::type_get_past_allocatable (x);
3443
3398
y = ASRUtils::type_get_past_allocatable (y);
3444
3399
return check_equal_type (x, y);
3445
- } else if (ASR::is_a<ASR::Const_t>(*x) ||
3446
- ASR::is_a<ASR::Const_t>(*y)) {
3447
- x = ASRUtils::get_contained_type (x);
3448
- y = ASRUtils::get_contained_type (y);
3449
- return check_equal_type (x, y);
3450
3400
} else if (ASR::is_a<ASR::List_t>(*x) && ASR::is_a<ASR::List_t>(*y)) {
3451
3401
x = ASR::down_cast<ASR::List_t>(x)->m_type ;
3452
3402
y = ASR::down_cast<ASR::List_t>(y)->m_type ;
@@ -5189,9 +5139,9 @@ static inline void Call_t_body(Allocator& al, ASR::symbol_t* a_name,
5189
5139
}
5190
5140
if ( ASRUtils::is_array (arg_type) && ASRUtils::is_array (orig_arg_type) ) {
5191
5141
ASR::Array_t* arg_array_t = ASR::down_cast<ASR::Array_t>(
5192
- ASRUtils::type_get_past_pointer (ASRUtils::type_get_past_const ( arg_type) ));
5142
+ ASRUtils::type_get_past_pointer (arg_type));
5193
5143
ASR::Array_t* orig_arg_array_t = ASR::down_cast<ASR::Array_t>(
5194
- ASRUtils::type_get_past_pointer (ASRUtils::type_get_past_const ( orig_arg_type) ));
5144
+ ASRUtils::type_get_past_pointer (orig_arg_type));
5195
5145
if ( (arg_array_t ->m_physical_type != orig_arg_array_t ->m_physical_type ) ||
5196
5146
(arg_array_t ->m_physical_type == ASR::array_physical_typeType::DescriptorArray &&
5197
5147
arg_array_t ->m_physical_type == orig_arg_array_t ->m_physical_type &&
0 commit comments