lib/scss_lint/linter.rb in scss_lint-0.49.0 vs lib/scss_lint/linter.rb in scss_lint-0.50.0
- old
+ new
@@ -50,11 +50,12 @@
protected
# Helper for creating lint from a parse tree node
#
- # @param node_or_line_or_location [Sass::Script::Tree::Node, Fixnum, SCSSLint::Location]
+ # @param node_or_line_or_location [Sass::Script::Tree::Node, Fixnum,
+ # SCSSLint::Location, Sass::Source::Position]
# @param message [String]
def add_lint(node_or_line_or_location, message)
@lints << Lint.new(self,
engine.filename,
extract_location(node_or_line_or_location),
@@ -163,9 +164,11 @@
end
def extract_location(node_or_line_or_location)
if node_or_line_or_location.is_a?(Location)
node_or_line_or_location
+ elsif node_or_line_or_location.is_a?(Sass::Source::Position)
+ Location.new(node_or_line_or_location.line, node_or_line_or_location.offset)
elsif node_or_line_or_location.respond_to?(:source_range) &&
node_or_line_or_location.source_range
location_from_range(node_or_line_or_location.source_range)
elsif node_or_line_or_location.respond_to?(:line)
Location.new(node_or_line_or_location.line)