self->name = name ? util_strdup(name) : NULL;
self->expression.vtype = t;
self->expression.next = NULL;
- self->isconst = false;
+ self->hasvalue = false;
self->uses = 0;
memset(&self->constval, 0, sizeof(self->constval));
{
if (self->name)
mem_d((void*)self->name);
- if (self->isconst) {
+ if (self->hasvalue) {
switch (self->expression.vtype)
{
case TYPE_STRING:
ast_instantiate(ast_function, ctx, ast_function_delete);
if (!vtype ||
- vtype->isconst ||
+ vtype->hasvalue ||
vtype->expression.vtype != TYPE_FUNCTION)
{
asterror(ast_ctx(self), "internal error: ast_function_new condition %i %i type=%i",
(int)!vtype,
- (int)vtype->isconst,
+ (int)vtype->hasvalue,
vtype->expression.vtype);
mem_d(self);
return NULL;
self->breakblock = NULL;
self->continueblock = NULL;
- vtype->isconst = true;
+ vtype->hasvalue = true;
vtype->constval.vfunc = self;
return self;
mem_d((void*)self->name);
if (self->vtype) {
/* ast_value_delete(self->vtype); */
- self->vtype->isconst = false;
+ self->vtype->hasvalue = false;
self->vtype->constval.vfunc = NULL;
/* We use unref - if it was stored in a global table it is supposed
* to be deleted from *there*
{
ir_value *v = NULL;
- if (self->isconst && self->expression.vtype == TYPE_FUNCTION)
+ if (self->hasvalue && self->expression.vtype == TYPE_FUNCTION)
{
ir_function *func = ir_builder_create_function(ir, self->name, self->expression.next->expression.vtype);
if (!func)
if (isfield && self->expression.vtype == TYPE_FIELD) {
ast_expression *fieldtype = self->expression.next;
- if (self->isconst) {
+ if (self->hasvalue) {
asterror(ast_ctx(self), "TODO: constant field pointers with value");
goto error;
}
v->context = ast_ctx(self);
}
- if (self->isconst) {
+ if (self->hasvalue) {
switch (self->expression.vtype)
{
case TYPE_FLOAT:
bool ast_local_codegen(ast_value *self, ir_function *func, bool param)
{
ir_value *v = NULL;
- if (self->isconst && self->expression.vtype == TYPE_FUNCTION)
+ if (self->hasvalue && self->expression.vtype == TYPE_FUNCTION)
{
/* Do we allow local functions? I think not...
* this is NOT a function pointer atm.
/* A constant local... hmmm...
* I suppose the IR will have to deal with this
*/
- if (self->isconst) {
+ if (self->hasvalue) {
switch (self->expression.vtype)
{
case TYPE_FLOAT:
ai = (ast_array_index*)self->dest;
idx = (ast_value*)ai->index;
- if (ast_istype(ai->index, ast_value) && idx->isconst)
+ if (ast_istype(ai->index, ast_value) && idx->hasvalue)
ai = NULL;
}
ai = (ast_array_index*)self->dest;
idx = (ast_value*)ai->index;
- if (ast_istype(ai->index, ast_value) && idx->isconst)
+ if (ast_istype(ai->index, ast_value) && idx->hasvalue)
ai = NULL;
}
arr = (ast_value*)self->array;
idx = (ast_value*)self->index;
- if (!ast_istype(self->index, ast_value) || !idx->isconst) {
+ if (!ast_istype(self->index, ast_value) || !idx->hasvalue) {
/* Time to use accessor functions */
ast_expression_codegen *cgen;
ir_value *iridx, *funval;