haml-edge 2.3.202 → 2.3.203

Sign up to get free protection for your applications and to get access to all the features.
data/EDGE_GEM_VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.202
1
+ 2.3.203
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.202
1
+ 2.3.203
@@ -97,12 +97,7 @@ module Sass
97
97
  # @return [Array<Script::Node>] The root nodes of the arguments.
98
98
  # @raise [Sass::SyntaxError] if the argument list isn't valid SassScript
99
99
  def parse_mixin_definition_arglist
100
- args = []
101
-
102
- if try_tok(:lparen)
103
- args = defn_arglist(false) || args
104
- assert_tok(:rparen)
105
- end
100
+ args = defn_arglist!(false)
106
101
  assert_done
107
102
 
108
103
  args.each do |k, v|
@@ -239,26 +234,33 @@ RUBY
239
234
  end
240
235
  end
241
236
 
242
- def defn_arglist(must_have_default)
243
- line = @lexer.line
244
- offset = @lexer.offset + 1
245
- return unless c = try_tok(:const)
246
- var = Script::Variable.new(c.value)
247
- if tok = (try_tok(:colon) || try_tok(:single_eq))
248
- val = assert_expr(:concat)
249
-
250
- if tok.type == :single_eq
251
- val.context = :equals
252
- val.options = @options
253
- Script.equals_warning("mixin argument defaults", "$#{c.value}",
254
- val.to_sass, false, line, offset, @options[:filename])
237
+ def defn_arglist!(must_have_default)
238
+ return [] unless try_tok(:lparen)
239
+ return [] if try_tok(:rparen)
240
+ res = []
241
+ loop do
242
+ line = @lexer.line
243
+ offset = @lexer.offset + 1
244
+ c = assert_tok(:const)
245
+ var = Script::Variable.new(c.value)
246
+ if tok = (try_tok(:colon) || try_tok(:single_eq))
247
+ val = assert_expr(:concat)
248
+
249
+ if tok.type == :single_eq
250
+ val.context = :equals
251
+ val.options = @options
252
+ Script.equals_warning("mixin argument defaults", "$#{c.value}",
253
+ val.to_sass, false, line, offset, @options[:filename])
254
+ end
255
+ must_have_default = true
256
+ elsif must_have_default
257
+ raise SyntaxError.new("Required argument #{var.inspect} must come before any optional arguments.")
255
258
  end
256
- elsif must_have_default
257
- raise SyntaxError.new("Required argument #{var.inspect} must come before any optional arguments.")
259
+ res << [var, val]
260
+ break unless try_tok(:comma)
258
261
  end
259
-
260
- return [[var, val]] unless try_tok(:comma)
261
- [[var, val], *defn_arglist(val)]
262
+ assert_tok(:rparen)
263
+ res
262
264
  end
263
265
 
264
266
  def fn_arglist
@@ -81,10 +81,10 @@ MSG
81
81
  "a\n b: c\na\n d: e" => ["The line was indented 2 levels deeper than the previous line.", 4],
82
82
  "a\n b: c\n a\n d: e" => ["The line was indented 3 levels deeper than the previous line.", 4],
83
83
  "a\n \tb: c" => ["Indentation can't use both tabs and spaces.", 2],
84
- "=a(" => 'Invalid CSS after "(": expected ")", was ""',
85
- "=a(b)" => 'Invalid CSS after "(": expected ")", was "b)"',
86
- "=a(,)" => 'Invalid CSS after "(": expected ")", was ",)"',
87
- "=a(!)" => 'Invalid CSS after "(": expected ")", was "!)"',
84
+ "=a(" => 'Invalid CSS after "(": expected variable (e.g. $foo), was ""',
85
+ "=a(b)" => 'Invalid CSS after "(": expected variable (e.g. $foo), was "b)"',
86
+ "=a(,)" => 'Invalid CSS after "(": expected variable (e.g. $foo), was ",)"',
87
+ "=a($)" => 'Invalid CSS after "(": expected variable (e.g. $foo), was "$)"',
88
88
  "=a($foo bar)" => 'Invalid CSS after "($foo ": expected ")", was "bar)"',
89
89
  "=foo\n bar: baz\n+foo" => ["Properties aren't allowed at the root of a document.", 2],
90
90
  "a-\#{$b\n c: d" => ['Invalid CSS after "a-#{$b": expected "}", was ""', 1],
@@ -940,7 +940,7 @@ SASS
940
940
  def test_equals_warning_for_mixin_args
941
941
  assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SASS))}
942
942
  DEPRECATION WARNING:
943
- On line 1, character 6 of 'test_equals_warning_for_mixin_args_inline.sass'
943
+ On line 1, character 10 of 'test_equals_warning_for_mixin_args_inline.sass'
944
944
  Setting mixin argument defaults with = has been deprecated and will be removed in version 3.2.
945
945
  Use "$arg: 1px" instead.
946
946
 
@@ -1901,6 +1901,15 @@ a
1901
1901
  SASS
1902
1902
  end
1903
1903
 
1904
+ def test_mixin_no_arg_error
1905
+ assert_raise(Sass::SyntaxError, 'Invalid CSS after "($bar,": expected variable name, was ")"') do
1906
+ render(<<SASS)
1907
+ =foo($bar,)
1908
+ bip: bap
1909
+ SASS
1910
+ end
1911
+ end
1912
+
1904
1913
  # Encodings
1905
1914
 
1906
1915
  unless Haml::Util.ruby1_8?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml-edge
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.202
4
+ version: 2.3.203
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum