apfl/src/scope.h

35 lines
960 B
C
Raw Normal View History

#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);
bool apfl_scope_has(struct scope *, struct apfl_string *name);
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);
bool apfl_scope_update_existing(struct scope *, struct apfl_string *, struct apfl_value);
bool apfl_scope_merge_into(struct scope *self, struct scope *other);
void apfl_gc_var_traverse(struct apfl_value *, gc_visitor, void *);
void apfl_gc_scope_traverse(struct scope *, gc_visitor, void *);
#ifdef __cplusplus
}
#endif
#endif