Skip to content

Commit

Permalink
Add: Basic range check for replace()
Browse files Browse the repository at this point in the history
  • Loading branch information
glx22 committed Apr 7, 2024
1 parent 26f271f commit e507643
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nml/ast/replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def __init__(self, param_list, sprite_list, name, pos):

def pre_process(self):
self.start_id = self.start_id.reduce(global_constants.const_list)
if isinstance(self.start_id, expression.ConstantNumeric):
generic.check_range(self.start_id.value, 0, 4895 - len(self.sprite_list), "replace-block parameter 1 'start'", self.start_id.pos)

Check failure on line 58 in nml/ast/replace.py

View workflow job for this annotation

GitHub Actions / Flake8 / Flake8

line too long (141 > 120 characters)

def debug_print(self, indentation):
generic.print_dbg(indentation, "Replace sprites starting at")
Expand Down

0 comments on commit e507643

Please sign in to comment.