Skip to content

Commit

Permalink
change Inconsistent number of Params assert to raise diag error
Browse files Browse the repository at this point in the history
  • Loading branch information
SooluThomas committed Mar 26, 2024
1 parent a9cf9fa commit a91ee0e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/AST/ASTGates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,14 @@ ASTGateNode::ASTGateNode(const ASTIdentifierNode *Id,
++C;
}

assert(C == Params.size() && "Inconsistent number of Params!");
if (C != Params.size()) {
std::stringstream M;
M << "Inconsistent number of Params." << C;
QasmDiagnosticEmitter::Instance().EmitDiagnostic(
DIAGLineCounter::Instance().GetLocation(), M.str(),
DiagLevel::Error);
return;
}

C = 0;
Ty = ASTTypeUndefined;
Expand Down

0 comments on commit a91ee0e

Please sign in to comment.