File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828import src .api .symboltable .symboltable
2929from src .api .debug import __DEBUG__ # analysis:ignore
3030from src .api .opcodestemps import OpcodesTemps
31- from src .api .errmsg import error
31+ from src .api .errmsg import error , warning_condition_is_always
3232from src .api .errmsg import warning
3333from src .api .global_ import LoopInfo
3434
@@ -1869,11 +1869,8 @@ def p_while_sentence(p):
18691869 gl .LOOPS .pop ()
18701870 q = make_block (p [2 ], p [3 ])
18711871
1872- if is_number (p [1 ]) and p [1 ].value :
1873- if q is None :
1874- warning (p [1 ].lineno , "Condition is always true and leads to an infinite loop." )
1875- else :
1876- warning (p [1 ].lineno , "Condition is always true and might lead to an infinite loop." )
1872+ if is_number (p [1 ]):
1873+ warning_condition_is_always (p .lineno (1 ), bool (p [1 ].value ))
18771874
18781875 p [0 ] = make_sentence (p .lineno (1 ), "WHILE" , p [1 ], q )
18791876
You can’t perform that action at this time.
0 commit comments