| 65 | } |
| 66 | |
| 67 | bool AR_EXP_IsAttribute(const AR_ExpNode *exp, char **attr) { |
| 68 | ASSERT(exp != NULL); |
| 69 | |
| 70 | // an arithmetic expression performs attribute extraction |
| 71 | // if it applys the "property" function, in which case the left-handside |
| 72 | // child represents the graph entity from which we access the attribute |
| 73 | // while the right-handside represents the attribute name |
| 74 | |
| 75 | if(exp->type != AR_EXP_OP) return false; |
| 76 | if(strcmp(AR_EXP_GetFuncName(exp), "property") != 0) return false; |
| 77 | |
| 78 | if(attr != NULL) { |
| 79 | AR_ExpNode *r = exp->op.children[1]; |
| 80 | ASSERT(AR_EXP_IsConstant(r)); |
| 81 | SIValue v = r->operand.constant; |
| 82 | ASSERT(SI_TYPE(v) == T_STRING); |
| 83 | *attr = v.stringval; |
| 84 | } |
| 85 | |
| 86 | return true; |
| 87 | } |
| 88 | |
| 89 | bool AR_EXP_PerformsDistinct(AR_ExpNode *exp) { |
| 90 | return AR_EXP_ContainsFunc(exp, "distinct"); |
no test coverage detected