* If the given filter is like the following, extract the object name ("N"): * * $lcType$.name == "N" * * The order of operands of == doesn't matter. * * @returns The object name on success and nullptr on failure. */
| 191 | * @returns The object name on success and nullptr on failure. |
| 192 | */ |
| 193 | const String * ApplyRule::GetComparedName(Expression* assignFilter, const char * lcType, const Dictionary::Ptr& constants) |
| 194 | { |
| 195 | auto eq (dynamic_cast<EqualExpression*>(assignFilter)); |
| 196 | |
| 197 | if (!eq) { |
| 198 | return nullptr; |
| 199 | } |
| 200 | |
| 201 | auto op1 (eq->GetOperand1().get()); |
| 202 | auto op2 (eq->GetOperand2().get()); |
| 203 | |
| 204 | if (IsNameIndexer(op1, lcType, constants)) { |
| 205 | return GetConstString(op2, constants); |
| 206 | } |
| 207 | |
| 208 | if (IsNameIndexer(op2, lcType, constants)) { |
| 209 | return GetConstString(op1, constants); |
| 210 | } |
| 211 | |
| 212 | return nullptr; |
| 213 | } |
| 214 | |
| 215 | /** |
| 216 | * @returns Whether the given expression is like $lcType$.name. |