diff options
-rw-r--r-- | src/consinit.cc | 2 | ||||
-rw-r--r-- | src/declare.cc | 4 | ||||
-rw-r--r-- | src/program.c | 7 | ||||
-rw-r--r-- | src/struct.c | 6 |
4 files changed, 7 insertions, 12 deletions
diff --git a/src/consinit.cc b/src/consinit.cc index 0f63ab84..b91748d7 100644 --- a/src/consinit.cc +++ b/src/consinit.cc @@ -777,7 +777,7 @@ void ConsInit::exportTree( StmtList *stmtList ) NamespaceQual *nspaceQual = NamespaceQual::cons( curNspace() ); TypeRef *typeRef = TypeRef::cons( internal, nspaceQual, String("start"), RepeatNone ); ObjectField *program = ObjectField::cons( internal, - ObjectField::UserFieldType, typeRef, String("ColmTree") ); + ObjectField::StructFieldType, typeRef, String("ColmTree") ); LangStmt *programExport = exportStmt( program, LangStmt::AssignType, expr ); stmtList->append( programExport ); } diff --git a/src/declare.cc b/src/declare.cc index 0a1073fb..02d40e85 100644 --- a/src/declare.cc +++ b/src/declare.cc @@ -955,13 +955,13 @@ void Compiler::addArgv() { /* Create the field and insert it into the map. */ ObjectField *el = ObjectField::cons( internal, - ObjectField::UserFieldType, argvTypeRef, "argv" ); + ObjectField::StructFieldType, argvTypeRef, "argv" ); el->isConst = true; globalObjectDef->rootScope->insertField( el->name, el ); argvList = el; el = ObjectField::cons( internal, - ObjectField::UserFieldType, argvTypeRef, "argv0" ); + ObjectField::StructFieldType, argvTypeRef, "argv0" ); el->isConst = true; globalObjectDef->rootScope->insertField( el->name, el ); argv0 = el; diff --git a/src/program.c b/src/program.c index 56d78741..d6cd88e8 100644 --- a/src/program.c +++ b/src/program.c @@ -24,12 +24,6 @@ static void colm_alloc_global( Program *prg ) prg->global = colm_struct_new( prg, prg->rtd->globalId ) ; } -static void colm_clear_global( Program *prg, Tree **sp ) -{ - colm_struct_delete( prg, sp, prg->global ); - prg->global = 0; -} - void vm_init( Program *prg ) { StackBlock *b = malloc( sizeof(StackBlock) ); @@ -300,7 +294,6 @@ int colm_delete_program( Program *prg ) int exitStatus = prg->exitStatus; treeDownref( prg, sp, prg->returnVal ); - colm_clear_global( prg, sp ); colm_clear_orig_heap( prg, sp ); colm_clear_heap( prg, sp ); diff --git a/src/struct.c b/src/struct.c index b54f5870..dd56f1a0 100644 --- a/src/struct.c +++ b/src/struct.c @@ -35,7 +35,9 @@ void colm_struct_delete( Program *prg, Tree **sp, struct colm_struct *el ) { short *t = prg->rtd->selInfo[el->id].trees; int i, len = prg->rtd->selInfo[el->id].treesLen; - for ( i = 0; i < len; i++ ) - treeDownref( prg, sp, ((Tree**)(el+1))[t[i]] ); + for ( i = 0; i < len; i++ ) { + Tree *tree = colm_struct_get_field( el, t[i] ); + treeDownref( prg, sp, tree ); + } free( el ); } |