| 191 | } |
| 192 | |
| 193 | vec4f new_and_init ( Context & context, SimNode_CallBase * call, vec4f * ) { |
| 194 | TypeInfo * typeInfo = call->types[0]; |
| 195 | if ( typeInfo->dim || typeInfo->type!=Type::tStructure ) { |
| 196 | context.throw_error_at(call->debugInfo, "invalid type"); |
| 197 | return v_zero(); |
| 198 | } |
| 199 | auto size = getTypeSize(typeInfo); |
| 200 | auto data = context.allocate(size, &call->debugInfo); |
| 201 | if ( typeInfo->structType && typeInfo->structType->init_mnh ) { |
| 202 | auto fn = context.fnByMangledName(typeInfo->structType->init_mnh); |
| 203 | context.callWithCopyOnReturn(fn, nullptr, data, 0); |
| 204 | } else { |
| 205 | memset(data, 0, size); |
| 206 | } |
| 207 | return cast<char *>::from(data); |
| 208 | } |
| 209 | int g_st = 0; |
| 210 | int *getPtr() {return &g_st;} |
| 211 |
nothing calls this directly
no test coverage detected