summaryrefslogtreecommitdiff
path: root/src/resolve.cc
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2015-01-04 16:29:36 -0500
committerAdrian Thurston <thurston@complang.org>2015-01-04 16:29:36 -0500
commit4070e94fcedeffc25128c2f613ee6aec687eae72 (patch)
treead3b5335d5f9cc493c0f24cd50f22170f3768a76 /src/resolve.cc
parent07547abf01f117076f36587f462a68dae0959b11 (diff)
downloadcolm-4070e94fcedeffc25128c2f613ee6aec687eae72.tar.gz
push towards embedded list elements
Diffstat (limited to 'src/resolve.cc')
-rw-r--r--src/resolve.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/resolve.cc b/src/resolve.cc
index 7dda501c..2751134c 100644
--- a/src/resolve.cc
+++ b/src/resolve.cc
@@ -110,6 +110,23 @@ UniqueType *TypeRef::resolveTypeList( Compiler *pd )
UniqueType *utValue = typeRef1->resolveType( pd );
+ /* Find the offset of the list element. */
+ int off = 0;
+ bool found = false;
+ FieldList *fieldList = utValue->structEl->context->objectDef->fieldList;
+ for ( FieldList::Iter f = *fieldList; f.lte(); f++, off++ ) {
+ UniqueType *fUT = f->value->typeRef->resolveType( pd );
+ if ( fUT->typeId == TYPE_GENERIC && fUT->generic != 0 &&
+ fUT->generic->typeId == GEN_LIST_EL )
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if ( !found )
+ error( loc ) << "could not find list element in type ref" << endp;
+
UniqueGeneric searchKey( UniqueGeneric::List, utValue );
UniqueGeneric *inMap = pd->uniqueGenericMap.find( &searchKey );
if ( inMap == 0 ) {