Skip to content

Commit

Permalink
dissallow placeholders in array macros
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Apr 7, 2024
1 parent ca15a54 commit 73103df
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/compile/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ impl Compiler {

// Handle macro
let ident_margs = ident_modifier_args(&name);
let placeholder_count = count_placeholders(&binding.words);
if binding.array_macro {
if placeholder_count > 0 {
return Err(
self.fatal_error(span.clone(), "Array macros may not contain placeholders")
);
}
// Array macro
if ident_margs == 0 {
self.add_error(
Expand Down Expand Up @@ -109,7 +115,6 @@ impl Compiler {
return Ok(());
}
// Stack macro
let placeholder_count = count_placeholders(&binding.words);
match (ident_margs > 0, placeholder_count > 0) {
(true, true) | (false, false) => {}
(true, false) => {
Expand Down

0 comments on commit 73103df

Please sign in to comment.