diff --git a/src/builtin/map.rs b/src/builtin/map.rs index 3f43594..878e22e 100644 --- a/src/builtin/map.rs +++ b/src/builtin/map.rs @@ -14,6 +14,7 @@ fn map_get(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { let map = match parser.arg(&mut args, 0, "map")? { Value::Map(m) => m, Value::List(v, ..) if v.is_empty() => SassMap::new(), + Value::ArgList(v) if v.is_empty() => SassMap::new(), v => { return Err(( format!("$map: {} is not a map.", v.inspect(args.span())?), @@ -31,6 +32,7 @@ fn map_has_key(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult let map = match parser.arg(&mut args, 0, "map")? { Value::Map(m) => m, Value::List(v, ..) if v.is_empty() => SassMap::new(), + Value::ArgList(v) if v.is_empty() => SassMap::new(), v => { return Err(( format!("$map: {} is not a map.", v.inspect(args.span())?), @@ -47,6 +49,7 @@ fn map_keys(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { let map = match parser.arg(&mut args, 0, "map")? { Value::Map(m) => m, Value::List(v, ..) if v.is_empty() => SassMap::new(), + Value::ArgList(v) if v.is_empty() => SassMap::new(), v => { return Err(( format!("$map: {} is not a map.", v.inspect(args.span())?), @@ -67,6 +70,7 @@ fn map_values(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult let map = match parser.arg(&mut args, 0, "map")? { Value::Map(m) => m, Value::List(v, ..) if v.is_empty() => SassMap::new(), + Value::ArgList(v) if v.is_empty() => SassMap::new(), v => { return Err(( format!("$map: {} is not a map.", v.inspect(args.span())?), @@ -87,6 +91,7 @@ fn map_merge(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { let mut map1 = match parser.arg(&mut args, 0, "map1")? { Value::Map(m) => m, Value::List(v, ..) if v.is_empty() => SassMap::new(), + Value::ArgList(v) if v.is_empty() => SassMap::new(), v => { return Err(( format!("$map1: {} is not a map.", v.inspect(args.span())?), @@ -98,6 +103,7 @@ fn map_merge(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { let map2 = match parser.arg(&mut args, 1, "map2")? { Value::Map(m) => m, Value::List(v, ..) if v.is_empty() => SassMap::new(), + Value::ArgList(v) if v.is_empty() => SassMap::new(), v => { return Err(( format!("$map2: {} is not a map.", v.inspect(args.span())?), @@ -114,6 +120,7 @@ fn map_remove(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult let mut map = match parser.arg(&mut args, 0, "map")? { Value::Map(m) => m, Value::List(v, ..) if v.is_empty() => SassMap::new(), + Value::ArgList(v) if v.is_empty() => SassMap::new(), v => { return Err(( format!("$map: {} is not a map.", v.inspect(args.span())?), diff --git a/tests/arglist.rs b/tests/arglist.rs index e37ce97..83b02ca 100644 --- a/tests/arglist.rs +++ b/tests/arglist.rs @@ -51,3 +51,14 @@ test!( }", "a {\n color: ();\n}\n" ); +test!( + empty_arglist_is_allowed_in_map_functions, + "@function foo($a...) { + @return map-get($map: $a, $key: foo); + } + + a { + color: inspect(foo()); + }", + "a {\n color: null;\n}\n" +);