2022-04-15 12:41:22 +00:00
|
|
|
#ifndef APFL_SCOPE_H
|
|
|
|
|
#define APFL_SCOPE_H
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "gc.h"
|
|
|
|
|
#include "hashmap.h"
|
|
|
|
|
#include "value.h"
|
|
|
|
|
|
|
|
|
|
struct scope {
|
|
|
|
|
struct apfl_hashmap map;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct scope *apfl_scope_new(struct gc *);
|
|
|
|
|
void apfl_scope_deinit(struct apfl_allocator, struct scope *);
|
|
|
|
|
|
|
|
|
|
bool apfl_scope_get(struct scope *, struct apfl_string *name, struct apfl_value *out);
|
2022-07-11 19:41:05 +00:00
|
|
|
bool apfl_scope_has(struct scope *, struct apfl_string *name);
|
2022-04-15 12:41:22 +00:00
|
|
|
bool apfl_scope_set(struct gc *, struct scope *, struct apfl_string *name, struct apfl_value value);
|
|
|
|
|
bool apfl_scope_create_var(struct gc *, struct scope *, struct apfl_string *name);
|
2022-07-11 19:41:05 +00:00
|
|
|
bool apfl_scope_update_existing(struct scope *, struct apfl_string *, struct apfl_value);
|
|
|
|
|
|
|
|
|
|
bool apfl_scope_merge_into(struct scope *self, struct scope *other);
|
2022-04-15 12:41:22 +00:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|