Skip to content

Commit

Permalink
Scope expanded repeat body with variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
dillof committed Jan 1, 2024
1 parent bd17cc7 commit 538a60c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/RepeatBody.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Body RepeatBody::create(Symbol variable, const std::optional<Expression>& start,
environment->add(variable, Expression(index));
auto new_body = body.evaluated(context);
// TODO: handle result
expanded_body.append(new_body ? *new_body : body);
expanded_body.append(new_body ? new_body->scoped() : body);
}
else {
expanded_body.append(body);
Expand Down
14 changes: 12 additions & 2 deletions tests/repeat.test
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,24 @@ file a.lib {} <>
visibility: private
section: data
body <
.data $00, $02
.scope {
.data $00
}
.scope {
.data $02
}
>
}
.object variable_start {
visibility: private
section: data
body <
.data $02, $03
.scope {
.data $02
}
.scope {
.data $03
}
>
}
end-of-inline-data

0 comments on commit 538a60c

Please sign in to comment.