Skip to content

Commit 94d11cb

Browse files
committed
Include compilation in compiler funtions/mixins hash code
1 parent da67d85 commit 94d11cb

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

lib/sass/compiler/host/function_registry.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class FunctionRegistry
1212
def initialize(functions, alert_color:)
1313
functions = functions.transform_keys(&:to_s)
1414

15-
@environment = BasicObject.new
15+
@environment = Object.new
1616
@global_functions = functions.keys
1717
@functions_by_name = functions.transform_keys do |signature|
1818
index = signature.index('(')

lib/sass/value/function.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,18 @@ def initialize(signature, &callback)
2929

3030
# @return [::Boolean]
3131
def ==(other)
32+
return false unless other.is_a?(Sass::Value::Function)
33+
3234
if defined?(@id)
33-
other.is_a?(Sass::Value::Function) && other.environment == environment && other.id == id
35+
other.environment == environment && other.id == id
3436
else
35-
other.equal?(self)
37+
other.signature == signature && other.callback == callback
3638
end
3739
end
3840

3941
# @return [Integer]
4042
def hash
41-
@hash ||= id.nil? ? signature.hash : id.hash
43+
@hash ||= defined?(@id) ? [environment, id].hash : [signature, callback].hash
4244
end
4345

4446
# @return [Function]

lib/sass/value/mixin.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def ==(other)
2525

2626
# @return [Integer]
2727
def hash
28-
@hash ||= id.hash
28+
@hash ||= [environment, id].hash
2929
end
3030

3131
# @return [Mixin]

0 commit comments

Comments
 (0)