| 85 | } |
| 86 | |
| 87 | void Translator::FillNodeDef(const TreeNode& tree_node, NodeDef* node_def) { |
| 88 | Prop* prop = tree_node.GetProp(); |
| 89 | // fill op_alias |
| 90 | node_def->op_alias_ = tree_node.GetOpAlias(); |
| 91 | // fill norm prop and udf |
| 92 | bool udf = false, udf_with_num_p = false; |
| 93 | for (const std::string& prop_key : prop->GetValues()) { |
| 94 | if (prop_key.substr(0, 4) == "udf_") { |
| 95 | udf = true; |
| 96 | node_def->udf_name_ = prop_key; |
| 97 | } else { |
| 98 | if (udf == false) { |
| 99 | node_def->attrs_.push_back(std::make_shared<NormAttrDef>(prop_key)); |
| 100 | } else { |
| 101 | if (prop_key == "[") { |
| 102 | udf_with_num_p = true; |
| 103 | } else if (prop_key == "]") { |
| 104 | udf_with_num_p = false; |
| 105 | } else { |
| 106 | if (!udf_with_num_p) { |
| 107 | node_def->udf_str_params_.push_back(prop_key); |
| 108 | } else { |
| 109 | node_def->udf_num_params_.push_back(prop_key); |
| 110 | } |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | // fill condition |
| 116 | std::vector<Prop*> condition = prop->GetNestingValues(); |
| 117 | if (!condition.empty()) { |
| 118 | std::shared_ptr<AttrDef> cond_attr_def = std::make_shared<CondAttrDef>(); |
| 119 | Prop* dnf = condition[0]; |
| 120 | if (dnf != nullptr) { |
| 121 | FillDNF(*dnf, cond_attr_def.get()); |
| 122 | } |
| 123 | Prop* post_process = condition[1]; |
| 124 | if (post_process != nullptr) { |
| 125 | FillPostProcess(*post_process, cond_attr_def.get()); |
| 126 | } |
| 127 | node_def->attrs_.push_back(cond_attr_def); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | bool IsSelectPreNode(const TreeNode& api_node, |
| 132 | TreeNode** search_with_select_node) { |
nothing calls this directly
no test coverage detected