Skip to content

Commit

Permalink
fix: semgrep
Browse files Browse the repository at this point in the history
  • Loading branch information
kshyatt-aws committed Sep 24, 2024
1 parent 6ef17af commit fd1aaf1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Quasar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1463,13 +1463,15 @@ function evaluate(v::V, expr::QasmExpression) where {V<:AbstractVisitor}
end
evaluate(v::AbstractVisitor, exprs::Vector{QasmExpression}) = [evaluate(v, expr) for expr in exprs]

# nosemgrep
function _evaluate_qubits(::Val{:identifier}, v, qubit_expr::QasmExpression)::Vector{Int}
qubit_name = name(qubit_expr)
mapping = qubit_mapping(v)::Dict{String, Vector{Int}}
haskey(mapping, qubit_name) || throw(QasmVisitorError("Missing input variable '$qubit_name'.", "NameError"))
return mapping[qubit_name]
end

# nosemgrep
function _evaluate_qubits(::Val{:indexed_identifier}, v, qubit_expr::QasmExpression)::Vector{Int}
qubit_name = name(qubit_expr)
mapping = qubit_mapping(v)::Dict{String, Vector{Int}}
Expand Down

0 comments on commit fd1aaf1

Please sign in to comment.