MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / constructInterop

Method constructInterop

src/ast/ast.cpp:1116–1146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Calls 7

to_stringFunction · 0.85
sizeMethod · 0.45
push_backMethod · 0.45
isRefTypeMethod · 0.45
canCopyMethod · 0.45
canMoveMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected