diff options
author | Adrian Thurston <thurston@complang.org> | 2014-11-02 10:50:21 -0500 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2014-11-02 10:50:21 -0500 |
commit | 7a12881504b6e16387796957dfba3e4d30f5f470 (patch) | |
tree | fdbf71eb75c17d2d8e7ebb15816063ec47bf9cf7 /src/parsetree.cc | |
parent | 26c0ce006f365f18a3102c74bc011e97b6c314ed (diff) | |
download | colm-7a12881504b6e16387796957dfba3e4d30f5f470.tar.gz |
some initial work on non-tree list types
Can allocate a list type.
Diffstat (limited to 'src/parsetree.cc')
-rw-r--r-- | src/parsetree.cc | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/src/parsetree.cc b/src/parsetree.cc index 43f6faa6..4aca980f 100644 --- a/src/parsetree.cc +++ b/src/parsetree.cc @@ -87,24 +87,33 @@ int CmpUniqueType::compare( const UniqueType &ut1, const UniqueType &ut2 ) return -1; else if ( ut1.typeId > ut2.typeId ) return 1; - else if ( ut1.typeId == TYPE_TREE || - ut1.typeId == TYPE_PTR || - ut1.typeId == TYPE_REF ) - { - if ( ut1.langEl < ut2.langEl ) - return -1; - else if ( ut1.langEl > ut2.langEl ) - return 1; - } - else if ( ut1.typeId == TYPE_ITER ) { - if ( ut1.iterDef < ut2.iterDef ) - return -1; - else if ( ut1.iterDef > ut2.iterDef ) - return 1; - } - else { - /* Fail on anything unimplemented. */ - assert( false ); + switch ( ut1.typeId ) { + case TYPE_TREE: + case TYPE_PTR: + case TYPE_REF: + { + if ( ut1.langEl < ut2.langEl ) + return -1; + else if ( ut1.langEl > ut2.langEl ) + return 1; + break; + } + case TYPE_ITER: { + if ( ut1.iterDef < ut2.iterDef ) + return -1; + else if ( ut1.iterDef > ut2.iterDef ) + return 1; + break; + } + case TYPE_LIST2: { + if ( ut1.list < ut2.list ) + return -1; + else if ( ut1.list > ut2.list ) + return 1; + break; + } + case TYPE_NIL: + break; } return 0; |