| 1114 | } |
| 1115 | |
| 1116 | void BuiltInFunction::constructInterop (const vector<TypeDeclPtr> & args ) { |
| 1117 | this->totalStackSize = sizeof(Prologue); |
| 1118 | for ( size_t argi=1; argi!=args.size(); ++argi ) { |
| 1119 | auto arg = new Variable(); |
| 1120 | arg->name = "arg" + to_string(argi-1); |
| 1121 | arg->type = args[argi]; |
| 1122 | if ( arg->type->baseType==Type::fakeContext ) { |
| 1123 | arg->init = new ExprFakeContext(at); |
| 1124 | arg->init->generated = true; |
| 1125 | } else if ( arg->type->baseType==Type::fakeLineInfo ) { |
| 1126 | arg->init = new ExprFakeLineInfo(at); |
| 1127 | arg->init->generated = true; |
| 1128 | } |
| 1129 | this->arguments.push_back(arg); |
| 1130 | } |
| 1131 | result = args[0]; |
| 1132 | if ( result->isRefType() && !result->ref ) { |
| 1133 | if ( result->canCopy() ) { |
| 1134 | copyOnReturn = true; |
| 1135 | moveOnReturn = false; |
| 1136 | } else if ( result->canMove() ) { |
| 1137 | copyOnReturn = false; |
| 1138 | moveOnReturn = true; |
| 1139 | } else if ( !result->ref ) { |
| 1140 | DAS_FATAL_ERROR("InteropFn %s can't be bound. It returns values which can't be copied or moved\n", name.c_str()); |
| 1141 | } |
| 1142 | } else { |
| 1143 | copyOnReturn = false; |
| 1144 | moveOnReturn = false; |
| 1145 | } |
| 1146 | } |
| 1147 | |
| 1148 | // expression |
| 1149 |
no test coverage detected