MCPcopy Create free account
hub / github.com/OriginQ/QPanda-2 / transformQControlFlow

Method transformQControlFlow

Core/Utilities/Compiler/QProgStored.cpp:112–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112void QProgStored::transformQControlFlow(AbstractControlFlowNode *p_controlflow)
113{
114 if (nullptr == p_controlflow)
115 {
116 QCERR("pQControlFlow is null");
117 throw invalid_argument("pQControlFlow is null");
118 }
119
120 ClassicalCondition p_classcical_condition = p_controlflow->getCExpr();
121 auto expr = p_classcical_condition.getExprPtr().get();
122 transformCExpr(expr);
123
124 QNode *p_node = dynamic_cast<QNode *>(p_controlflow);
125 int node_type = p_node->getNodeType();
126
127 switch (node_type)
128 {
129 case NodeType::QIF_START_NODE:
130 transformQIfProg(p_controlflow);
131 break;
132 case NodeType::WHILE_START_NODE:
133 transformQWhileProg(p_controlflow);
134 break;
135 default:
136 QCERR("NodeType is error");
137 throw invalid_argument("NodeType is error");
138 break;
139 }
140
141 return;
142}
143
144
145void QProgStored::transformQIfProg(AbstractControlFlowNode *p_controlFlow)

Callers

nothing calls this directly

Calls 4

getCExprMethod · 0.80
getExprPtrMethod · 0.80
getMethod · 0.45
getNodeTypeMethod · 0.45

Tested by

no test coverage detected