| 59 | } |
| 60 | |
| 61 | void ApplyRule::AddRule(const String& sourceType, const String& targetType, const String& name, |
| 62 | const Expression::Ptr& expression, const Expression::Ptr& filter, const String& package, const String& fkvar, |
| 63 | const String& fvvar, const Expression::Ptr& fterm, bool ignoreOnError, const DebugInfo& di, const Dictionary::Ptr& scope) |
| 64 | { |
| 65 | auto actualTargetType (&targetType); |
| 66 | |
| 67 | if (*actualTargetType == "") { |
| 68 | auto& targetTypes (GetTargetTypes(sourceType)); |
| 69 | |
| 70 | if (targetTypes.size() == 1u) { |
| 71 | actualTargetType = &targetTypes[0]; |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | ApplyRule::Ptr rule = new ApplyRule(name, expression, filter, package, fkvar, fvvar, fterm, ignoreOnError, di, scope); |
| 76 | auto& rules (m_Rules[Type::GetByName(sourceType).get()]); |
| 77 | |
| 78 | if (!AddTargetedRule(rule, *actualTargetType, rules)) { |
| 79 | rules.Regular[Type::GetByName(*actualTargetType).get()].emplace_back(std::move(rule)); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | bool ApplyRule::EvaluateFilter(ScriptFrame& frame) const |
| 84 | { |