mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Issue a deprecation warning if an implicit string is used.
This commit is contained in:
parent
1e0902b793
commit
0ad8321326
2 changed files with 11 additions and 5 deletions
|
@ -66,10 +66,14 @@ RUBY
|
|||
def funcall
|
||||
return paren unless name = try_tok(:ident)
|
||||
# An identifier without arguments is just a string
|
||||
return Script::String.new(name.last) unless try_tok(:lparen)
|
||||
args = arglist || []
|
||||
assert_tok(:rparen)
|
||||
Script::Funcall.new(name.last, args)
|
||||
unless try_tok(:lparen)
|
||||
warn %Q{WARNING: Implicit strings are deprecated. '#{name.last}' was not quoted. Please add double quotes. E.g. "#{name.last}".}
|
||||
Script::String.new(name.last)
|
||||
else
|
||||
args = arglist || []
|
||||
assert_tok(:rparen)
|
||||
Script::Funcall.new(name.last, args)
|
||||
end
|
||||
end
|
||||
|
||||
def arglist
|
||||
|
|
|
@ -719,7 +719,9 @@ SASS
|
|||
end
|
||||
|
||||
def test_inaccessible_functions
|
||||
assert_equal("a {\n b: send(to_s); }\n", render("a\n b = send(to_s)"))
|
||||
assert_warning %Q{WARNING: Implicit strings are deprecated. 'to_s' was not quoted. Please add double quotes. E.g. \"to_s\".} do
|
||||
assert_equal("a {\n b: send(to_s); }\n", render("a\n b = send(to_s)"))
|
||||
end
|
||||
assert_equal("a {\n b: public_instance_methods(); }\n", render("a\n b = public_instance_methods()"))
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue