46 lines
1016 B
C
46 lines
1016 B
C
#include "tlang.h"
|
|
|
|
extern void __node_single_free(node_t* n);
|
|
tobject_t* __postdec_node_exec(node_t* n,scope_t* sc,retarg_t* retArg)
|
|
{
|
|
bool freeleftifzero=true;
|
|
|
|
node_t* left = n->data.single_node_node;
|
|
|
|
tobject_t* l=left->execute(left,sc,retArg);
|
|
|
|
tobject_t* out=NULL;
|
|
|
|
out = l;
|
|
l->count++;
|
|
node_t* n3=node_setvariable_create(left,node_sub_create(node_const_object_create(l),node_const_number_create(1)),true);
|
|
|
|
n3->execute(n3,sc,retArg);
|
|
|
|
n3->data.two_node_node.left = node_const_number_create(0);
|
|
node_free(n3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(out == NULL)
|
|
{
|
|
return tobject_basic(sc->rt,tnull);
|
|
}else{
|
|
out->count--;
|
|
}
|
|
|
|
return out;
|
|
}
|
|
node_t* node_postfix_decrement_create(node_t* left)
|
|
{
|
|
node_t* node = (node_t*)malloc(sizeof(node_t));
|
|
node->type = postfixdecrementnode;
|
|
node->data.single_node_node = left;
|
|
|
|
node->execute = __postdec_node_exec;
|
|
node->free = __node_single_free;
|
|
return node;
|
|
} |