Skip to content

Commit

Permalink
Adds Native.make_error(message) and refactors functions handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Ocampo-Gooding committed Jul 13, 2015
1 parent 9bde318 commit 5d4ca17
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
12 changes: 1 addition & 11 deletions lib/sassc/functions_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,8 @@ def setup(native_options)
private

def error(message)
value = Native::SassValue.new
value[:unknown] = Native::SassUnknown.new

error = Native::SassError.new
error[:tag] = :sass_error

Native.error_set_message(error, Native.native_string(message))
$stderr.puts "[SassC::FunctionsHandler] #{message}"

value[:unknown][:tag] = :sass_error
value[:error] = error
value.pointer
Native.make_error(message)
end

class FunctionWrapper
Expand Down
3 changes: 3 additions & 0 deletions lib/sassc/native/native_functions_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ module Native
# ADDAPI union Sass_Value* ADDCALL sass_make_qstring (const char* val);
attach_function :sass_make_qstring, [:string], :sass_value_ptr

# ADDAPI union Sass_Value* ADDCALL sass_make_error (const char* msg);
attach_function :sass_make_error, [:string], :sass_value_ptr

# ADDAPI enum Sass_Tag ADDCALL sass_value_get_tag (const union Sass_Value* v);
attach_function :sass_value_get_tag, [:sass_value_ptr], SassTag
attach_function :sass_value_is_null, [:sass_value_ptr], :bool
Expand Down
2 changes: 1 addition & 1 deletion test/functions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def stylesheet_path(path)
end

def stderr_output
$stderr.string.gsub("\u0000\n", '')
$stderr.string.gsub("\u0000\n", '').chomp
end
end
end

0 comments on commit 5d4ca17

Please sign in to comment.