diff options
author | Adrian Thurston <thurston@complang.org> | 2015-01-04 14:39:40 -0500 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2015-01-04 14:39:40 -0500 |
commit | b86d5b2fa8e4ab4773a0fdb252d5dd8356feec16 (patch) | |
tree | 2b80ce329e7c67d3434674ba7259d0289c8b61e9 /src/declare.cc | |
parent | 7f6c8260b492b5bbc4213e22b98c8aa7a3a437ab (diff) | |
download | colm-b86d5b2fa8e4ab4773a0fdb252d5dd8356feec16.tar.gz |
more rough work on object-based lists
Diffstat (limited to 'src/declare.cc')
-rw-r--r-- | src/declare.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/declare.cc b/src/declare.cc index 4014c729..f6c9d87c 100644 --- a/src/declare.cc +++ b/src/declare.cc @@ -927,12 +927,17 @@ void Compiler::initListFunctions( GenericType *gen ) void Compiler::initListElField( GenericType *gen, const char *name, int offset ) { + TypeRef *typeRef = TypeRef::cons( + internal, TypeRef::ListEl, 0, gen->typeArg, 0 ); + + typeRef->resolveType( this ); + /* Make the type ref and create the field. */ - TypeRef *typeRef = TypeRef::cons( internal, gen->utArg ); ObjectField *el = ObjectField::cons( internal, ObjectField::InbuiltOffType, typeRef, name ); - el->inGetR = IN_GET_LIST2EL_MEM_R; + el->inGetR = IN_GET_LIST_EL_MEM_R; + el->inGetValR = IN_GET_LIST_EL_MEM_R; // el->inGetWC = IN_GET_LIST2EL_MEM_WC; // el->inGetWV = IN_GET_LIST2EL_MEM_WV; // el->inSetWC = IN_SET_LIST2EL_MEM_WC; @@ -948,12 +953,18 @@ void Compiler::initListElField( GenericType *gen, const char *name, int offset ) void Compiler::initListElFields( GenericType *gen ) { initListElField( gen, "next", 0 ); + initListElField( gen, "value", 2 ); } void Compiler::initListField( GenericType *gen, const char *name, int offset ) { + /* Type reference for the list element. */ + TypeRef *typeRef = TypeRef::cons( + internal, TypeRef::ListEl, 0, gen->typeArg, 0 ); + + typeRef->resolveType( this ); + /* Make the type ref and create the field. */ - TypeRef *typeRef = TypeRef::cons( internal, gen->utArg ); ObjectField *el = ObjectField::cons( internal, ObjectField::InbuiltOffType, typeRef, name ); @@ -963,6 +974,8 @@ void Compiler::initListField( GenericType *gen, const char *name, int offset ) el->inSetWC = IN_SET_LIST_MEM_WC; el->inSetWV = IN_SET_LIST_MEM_WV; + el->inGetValR = IN_GET_LIST_MEM_R; + gen->objDef->rootScope->insertField( el->name, el ); /* Zero for head, One for tail. */ |