[Sass] Set the line numbers for illegal-property-syntax exceptions.

This commit is contained in:
Nathan Weizenbaum 2009-09-13 14:34:22 -07:00
parent 9e354ac2bb
commit a373d92bfb
2 changed files with 4 additions and 2 deletions

View File

@ -42,9 +42,9 @@ module Sass::Tree
# @raise [Sass::SyntaxError] if the property uses invalid syntax
def to_s(tabs, parent_name = nil)
if @options[:property_syntax] == :old && @prop_syntax == :new
raise Sass::SyntaxError.new("Illegal property syntax: can't use new syntax when :property_syntax => :old is set.")
raise Sass::SyntaxError.new("Illegal property syntax: can't use new syntax when :property_syntax => :old is set.", @line)
elsif @options[:property_syntax] == :new && @prop_syntax == :old
raise Sass::SyntaxError.new("Illegal property syntax: can't use old syntax when :property_syntax => :new is set.")
raise Sass::SyntaxError.new("Illegal property syntax: can't use old syntax when :property_syntax => :new is set.", @line)
end
if value[-1] == ?;

View File

@ -255,12 +255,14 @@ SASS
rescue Sass::SyntaxError => e
assert_equal("Illegal property syntax: can't use new syntax when :property_syntax => :old is set.",
e.message)
assert_equal(2, e.sass_line)
else
assert(false, "SyntaxError not raised for :property_syntax => :old")
end
begin
render("a\n :b c", :property_syntax => :new)
assert_equal(2, e.sass_line)
rescue Sass::SyntaxError => e
assert_equal("Illegal property syntax: can't use old syntax when :property_syntax => :new is set.",
e.message)