[Sass] Fix invalid-comma errors for functions.
Closes gh-171
This commit is contained in:
parent
8f826f2128
commit
3dd0be18b2
|
@ -3,6 +3,11 @@
|
|||
* Table of contents
|
||||
{:toc}
|
||||
|
||||
## 3.0.4 (Unreleased)
|
||||
|
||||
* Raise an informative error when function arguments have a mispaced comma,
|
||||
as in `foo(bar, )`.
|
||||
|
||||
## 3.0.3
|
||||
|
||||
[Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.3).
|
||||
|
|
|
@ -265,7 +265,7 @@ RUBY
|
|||
def fn_arglist
|
||||
return unless e = equals
|
||||
return [e] unless try_tok(:comma)
|
||||
[e, *fn_arglist]
|
||||
[e, *assert_expr(:fn_arglist)]
|
||||
end
|
||||
|
||||
def arglist
|
||||
|
@ -334,6 +334,7 @@ RUBY
|
|||
:string => "string",
|
||||
:default => "expression (e.g. 1px, bold)",
|
||||
:arglist => "mixin argument",
|
||||
:fn_arglist => "function argument",
|
||||
}
|
||||
|
||||
def assert_expr(name)
|
||||
|
|
|
@ -329,6 +329,11 @@ SASS
|
|||
assert_equal "#2", resolve('"##{1 + 1}"')
|
||||
end
|
||||
|
||||
def test_misplaced_comma_in_funcall
|
||||
assert_raise(Sass::SyntaxError,
|
||||
'Invalid CSS after "foo(bar, ": expected function argument, was ")"') {eval('foo(bar, )')}
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def resolve(str, opts = {}, environment = env)
|
||||
|
|
Loading…
Reference in New Issue