MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / push

Method push

Source/Utils/dukglue/dukvalue.h:277–315  ·  view source on GitHub ↗

push the value we hold onto the stack

Source from the content-addressed store, hash-verified

275
276 // push the value we hold onto the stack
277 inline void push() const {
278 duk_context* ctx = mContext;
279
280 switch (mType) {
281 case UNDEFINED:
282 duk_push_undefined(ctx);
283 break;
284 case NULLREF:
285 duk_push_null(ctx);
286 break;
287
288 case BOOLEAN:
289 duk_push_boolean(ctx, mPOD.boolean);
290 break;
291
292 case NUMBER:
293 duk_push_number(ctx, mPOD.number);
294 break;
295
296 case STRING:
297 duk_push_lstring(ctx, mString.data(), mString.size());
298 break;
299
300 case OBJECT:
301 push_ref_array(ctx);
302 duk_get_prop_index(ctx, -1, mPOD.ref_array_idx);
303 duk_remove(ctx, -2);
304 break;
305
306 case POINTER:
307 duk_push_pointer(ctx, mPOD.pointer);
308 break;
309
310 case BUFFER:
311 case LIGHTFUNC:
312 default:
313 throw DukException() << "DukValue.push() not implemented for type (" << type_name() << ")";
314 }
315 }
316
317 // various (type-safe) getters
318 inline bool as_bool() const {

Callers 1

operator==Method · 0.95

Calls 3

DukExceptionClass · 0.85
type_nameFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected