1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
/*
* Environment object representation.
*/
#if !defined(DUK_HENV_H_INCLUDED)
#define DUK_HENV_H_INCLUDED
#if defined(DUK_USE_ASSERTIONS)
DUK_INTERNAL_DECL void duk_hdecenv_assert_valid(duk_hdecenv *h);
DUK_INTERNAL_DECL void duk_hobjenv_assert_valid(duk_hobjenv *h);
#define DUK_HDECENV_ASSERT_VALID(h) \
do { \
duk_hdecenv_assert_valid((h)); \
} while (0)
#define DUK_HOBJENV_ASSERT_VALID(h) \
do { \
duk_hobjenv_assert_valid((h)); \
} while (0)
#else
#define DUK_HDECENV_ASSERT_VALID(h) \
do { \
} while (0)
#define DUK_HOBJENV_ASSERT_VALID(h) \
do { \
} while (0)
#endif
struct duk_hdecenv {
/* Shared object part. */
duk_hobject obj;
/* These control variables provide enough information to access live
* variables for a closure that is still open. If thread == NULL,
* the record is closed and the identifiers are in the property table.
*/
duk_hthread *thread;
duk_hobject *varmap;
duk_size_t regbase_byteoff;
};
struct duk_hobjenv {
/* Shared object part. */
duk_hobject obj;
/* Target object and 'this' binding for object binding. */
duk_hobject *target;
/* The 'target' object is used as a this binding in only some object
* environments. For example, the global environment does not provide
* a this binding, but a with statement does.
*/
duk_bool_t has_this;
};
#endif /* DUK_HENV_H_INCLUDED */
|