diff --git a/src/args.rs b/src/args.rs index ef010a4..eb59663 100644 --- a/src/args.rs +++ b/src/args.rs @@ -77,7 +77,7 @@ pub(crate) fn eat_func_args>( ',' => { toks.next(); args.push(FuncArg { - name, + name: name.replace('_', "-"), default: Some(Value::from_tokens( &mut default.into_iter().peekable(), scope, @@ -88,7 +88,7 @@ pub(crate) fn eat_func_args>( } ')' => { args.push(FuncArg { - name, + name: name.replace('_', "-"), default: Some(Value::from_tokens( &mut default.into_iter().peekable(), scope, @@ -107,7 +107,7 @@ pub(crate) fn eat_func_args>( '.' => todo!("handle varargs"), ')' => { args.push(FuncArg { - name, + name: name.replace('_', "-"), default: if default.is_empty() { None } else { @@ -121,7 +121,7 @@ pub(crate) fn eat_func_args>( break; } ',' => args.push(FuncArg { - name, + name: name.replace('_', "-"), default: None, }), _ => {} diff --git a/tests/mixins.rs b/tests/mixins.rs index 6c3865d..221148f 100644 --- a/tests/mixins.rs +++ b/tests/mixins.rs @@ -190,7 +190,12 @@ test!( "a {\n color: red;\n}\n" ); test!( - args_interchangable_hypen_underscore, + args_hyphen_arg_allows_underscore, "@mixin foo($a-b) {\n color: $a-b;\n color: $a_b;\n}\na {\n @include foo($a_b: a);\n @include foo($a-b: a);\n}\n", "a {\n color: a;\n color: a;\n color: a;\n color: a;\n}\n" ); +test!( + args_underscore_arg_allows_hyphen, + "@mixin foo($a_b) {\n color: $a-b;\n color: $a_b;\n}\na {\n @include foo($a_b: a);\n @include foo($a-b: a);\n}\n", + "a {\n color: a;\n color: a;\n color: a;\n color: a;\n}\n" +);