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

Function array_unlock

src/simulate/runtime_array.cpp:46–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44 }
45
46 void array_unlock ( Context & context, Array & arr, LineInfo * at ) {
47 if ( arr.shared || arr.hopeless ) return;
48 if ( arr.magic != DAS_ARRAY_MAGIC ) {
49 context.throw_error_at(at, "array magic mismatch on unlock, was it moved or overwritten?");
50 }
51 if ( arr.lock==0 ) {
52 context.throw_error_at(at, "array lock underflow, was it moved or overwritten?");
53 }
54 arr.lock --;
55 if ( arr.lock==0 ) {
56 arr.magic = 0;
57 }
58 }
59
60 void array_reserve(Context & context, Array & arr, uint64_t newCapacity, uint32_t stride, LineInfo * at) {
61 if ( arr.isLocked() ) context.throw_error_at(at, "can't change capacity of a locked array");

Calls 1

throw_error_atMethod · 0.80

Tested by

no test coverage detected