Skip to content

Commit f18c13f

Browse files
authored
Merge pull request #328 from boriel/feature/refact_symbolVAR_class
SymbolVAR always return its final value
2 parents 0dedd71 + 2aeb072 commit f18c13f

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

symbols/bound.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ def make_node(lower, upper, lineno):
4848
syntax_error(lineno, 'Array bounds must be constants')
4949
return None
5050

51-
while isinstance(lower, SymbolVAR):
51+
if isinstance(lower, SymbolVAR):
5252
lower = lower.value
5353
if lower is None: # semantic error
5454
syntax_error(lineno, "Unknown lower bound for array dimension")
5555
return
5656

57-
while isinstance(upper, SymbolVAR):
57+
if isinstance(upper, SymbolVAR):
5858
upper = upper.value
5959
if upper is None: # semantic error
6060
syntax_error(lineno, "Unknown upper bound for array dimension")

symbols/var.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ def value(self):
170170
""" An alias of default value, only available is class_ is CONST
171171
"""
172172
assert self.class_ == CLASS.const
173+
if isinstance(self.default_value, SymbolVAR):
174+
return self.default_value.value
175+
173176
return self.default_value
174177

175178
@value.setter

0 commit comments

Comments
 (0)