haml-edge 2.3.202 → 2.3.203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/EDGE_GEM_VERSION +1 -1
- data/VERSION +1 -1
- data/lib/sass/script/parser.rb +26 -24
- data/test/sass/engine_test.rb +14 -5
- metadata +1 -1
data/EDGE_GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.203
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.203
|
data/lib/sass/script/parser.rb
CHANGED
@@ -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
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
val
|
253
|
-
|
254
|
-
|
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
|
-
|
257
|
-
|
259
|
+
res << [var, val]
|
260
|
+
break unless try_tok(:comma)
|
258
261
|
end
|
259
|
-
|
260
|
-
|
261
|
-
[[var, val], *defn_arglist(val)]
|
262
|
+
assert_tok(:rparen)
|
263
|
+
res
|
262
264
|
end
|
263
265
|
|
264
266
|
def fn_arglist
|
data/test/sass/engine_test.rb
CHANGED
@@ -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
|
85
|
-
"=a(b)" => 'Invalid CSS after "(": expected
|
86
|
-
"=a(,)" => 'Invalid CSS after "(": expected
|
87
|
-
"=a(
|
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
|
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?
|