| 2975 | } |
| 2976 | |
| 2977 | data_map CGenerator::firstAllocOnServerWhenIsNeed(const string &name, StructMember *structMember) |
| 2978 | { |
| 2979 | DataType *dataType = structMember->getDataType(); |
| 2980 | DataType *trueDataType = dataType->getTrueDataType(); |
| 2981 | param_direction_t structMemberDir = structMember->getDirection(); |
| 2982 | if (!findAnnotation(structMember, SHARED_ANNOTATION)) |
| 2983 | { |
| 2984 | if (structMemberDir == param_direction_t::kInoutDirection) |
| 2985 | { |
| 2986 | if (!trueDataType->isBuiltin() && !trueDataType->isEnum() && !trueDataType->isList() && |
| 2987 | !trueDataType->isArray() && !trueDataType->isFunction()) |
| 2988 | { |
| 2989 | return allocateCall(name, structMember); |
| 2990 | } |
| 2991 | } |
| 2992 | else if (structMemberDir == param_direction_t::kInDirection) |
| 2993 | { |
| 2994 | if (trueDataType->isStruct() || trueDataType->isUnion()) |
| 2995 | { |
| 2996 | return allocateCall(name, structMember); |
| 2997 | } |
| 2998 | } |
| 2999 | else if (structMember->getDirection() == param_direction_t::kOutDirection) |
| 3000 | { |
| 3001 | if (!trueDataType->isBuiltin() && !trueDataType->isEnum() && !trueDataType->isArray() && |
| 3002 | !trueDataType->isFunction()) |
| 3003 | { |
| 3004 | return allocateCall(name, structMember); |
| 3005 | } |
| 3006 | else if (trueDataType->isString()) |
| 3007 | { |
| 3008 | if (!findAnnotation(structMember, MAX_LENGTH_ANNOTATION)) |
| 3009 | { |
| 3010 | Symbol *symbol = structMember; |
| 3011 | assert(symbol); |
| 3012 | throw semantic_error( |
| 3013 | format_string("For out string variable '%s' on line '%d' max_length annotation has to be set.", |
| 3014 | symbol->getName().c_str(), symbol->getLocation().m_firstLine)); |
| 3015 | } |
| 3016 | data_map returnValue = allocateCall(name, structMember); |
| 3017 | returnValue["isOutChar"] = true; |
| 3018 | return returnValue; |
| 3019 | } |
| 3020 | } |
| 3021 | } |
| 3022 | |
| 3023 | data_map r; |
| 3024 | return r; |
| 3025 | } |
| 3026 | |
| 3027 | bool CGenerator::isNeedCallFree(DataType *dataType) |
| 3028 | { |
nothing calls this directly
no test coverage detected