Skip to content

Commit

Permalink
Fix comparison with nothing to use checking identity by === or `!…
Browse files Browse the repository at this point in the history
…==`. (#159)
  • Loading branch information
Paalon authored Jun 12, 2024
1 parent 41b7bd1 commit 8180df4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/YAML.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const _dicttype = Union{Type,Function}

# add a dicttype-aware version of construct_mapping to the constructors
function _patch_constructors(more_constructors::_constructor, dicttype::_dicttype)
if more_constructors == nothing
if more_constructors === nothing
more_constructors = Dict{String,Function}()
else
more_constructors = copy(more_constructors) # do not change the outside world
Expand Down
2 changes: 1 addition & 1 deletion src/composer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct ComposerError
end

function show(io::IO, error::ComposerError)
if error.context != nothing
if error.context !== nothing
print(io, error.context, " at ", error.context_mark, ": ")
end
print(io, error.problem, " at ", error.problem_mark)
Expand Down
2 changes: 1 addition & 1 deletion src/constructor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct ConstructorError
end

function show(io::IO, error::ConstructorError)
if error.context != nothing
if error.context !== nothing
print(io, error.context, " at ", error.context_mark, ": ")
end
print(io, error.problem, " at ", error.problem_mark)
Expand Down
8 changes: 4 additions & 4 deletions src/parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct ParserError
end

function show(io::IO, error::ParserError)
if error.context != nothing
if error.context !== nothing
print(io, error.context, " at ", error.context_mark, ": ")
end
print(io, error.problem, " at ", error.problem_mark)
Expand Down Expand Up @@ -246,9 +246,9 @@ end
function __parse_node(token::ScalarToken, stream::EventStream, block, start_mark, end_mark, anchor, tag, implicit)
forward!(stream.input)
end_mark = token.span.end_mark
if (token.plain && tag == nothing) || tag == "!"
if (token.plain && tag === nothing) || tag == "!"
implicit = true, false
elseif tag == nothing
elseif tag === nothing
implicit = false, true
else
implicit = false, false
Expand Down Expand Up @@ -345,7 +345,7 @@ function _parse_node(token, stream::EventStream, block, indentless_sequence)
end

token = peek(stream.input)
if start_mark == nothing
if start_mark === nothing
start_mark = end_mark = token.span.start_mark
end

Expand Down

0 comments on commit 8180df4

Please sign in to comment.