Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow features with macros within macros #492

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions evm_arithmetization/src/cpu/kernel/assembler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ fn expand_macros(
expanded.extend(expand_macros(body.clone(), macros, macro_counter));
}
}
Item::ConditionalBlock(_, items) => {
expanded.extend(expand_macros(items.clone(), macros, macro_counter));
}
item => {
expanded.push(item);
}
Expand Down
14 changes: 13 additions & 1 deletion evm_arithmetization/src/cpu/kernel/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,14 @@ mod tests {
#[test]
fn test_feature() {
let code = r#"
%macro bar_foo
#[cfg(feature = feature_1)]
{
%bar
PUSH 3
ADD
}
%endmacro
#[cfg(feature = feature_1)]
{
%macro bar
Expand All @@ -260,7 +268,7 @@ mod tests {
#[cfg(feature = feature_1)]
{
%bar
%bar_foo
PUSH 1
}
PUSH 3
Expand Down Expand Up @@ -291,6 +299,8 @@ mod tests {
%macro bar
PUSH 2
MUL
PUSH 3
ADD
%endmacro
global foo_1:
Expand Down Expand Up @@ -353,6 +363,8 @@ mod tests {
%macro bar
PUSH 2
MUL
PUSH 3
ADD
%endmacro
global foo_1:
Expand Down
Loading