Skip to content

Commit

Permalink
Refactoring of hash so that it can be used in analysis functions
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuraiAku committed Jan 9, 2024
1 parent e33cfa1 commit 2ce2502
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/api.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,14 @@ for pred in (:(==), :(isequal))
end
end

function Base.hash(A::AbstractSpdx, h::UInt)
for p in propertynames(A)
function _hash(A::AbstractSpdx, h::UInt, skipproperties::Vector{Symbol}= Symbol[])
propset= setdiff(propertynames(A), skipproperties)
for p in propset
h= hash(getproperty(A, p), h)
end
return h
end

function Base.hash(A::AbstractSpdx, h::UInt)
return _hash(A, h)
end

0 comments on commit 2ce2502

Please sign in to comment.