1
0
Fork 0
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:
Chris Eppstein 2008-12-09 08:58:58 -08:00
parent 1e0902b793
commit 0ad8321326
2 changed files with 11 additions and 5 deletions

View file

@ -66,10 +66,14 @@ RUBY
def funcall def funcall
return paren unless name = try_tok(:ident) return paren unless name = try_tok(:ident)
# An identifier without arguments is just a string # An identifier without arguments is just a string
return Script::String.new(name.last) unless try_tok(:lparen) unless try_tok(:lparen)
args = arglist || [] warn %Q{WARNING: Implicit strings are deprecated. '#{name.last}' was not quoted. Please add double quotes. E.g. "#{name.last}".}
assert_tok(:rparen) Script::String.new(name.last)
Script::Funcall.new(name.last, args) else
args = arglist || []
assert_tok(:rparen)
Script::Funcall.new(name.last, args)
end
end end
def arglist def arglist

View file

@ -719,7 +719,9 @@ SASS
end end
def test_inaccessible_functions 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()")) assert_equal("a {\n b: public_instance_methods(); }\n", render("a\n b = public_instance_methods()"))
end end