diff options
author | Adrian Thurston <thurston@colm.net> | 2016-09-23 11:43:54 -0700 |
---|---|---|
committer | Adrian Thurston <thurston@colm.net> | 2016-09-23 11:43:54 -0700 |
commit | fb9e7b3b77657a7e2db63d7cd2d9cd4706715d21 (patch) | |
tree | 3f99154440b15fa15a5b36e670f2c8f6aafc1100 /src | |
parent | cb778b42f4859ca464ad56ecb60ad7ee01f51df0 (diff) | |
download | colm-fb9e7b3b77657a7e2db63d7cd2d9cd4706715d21.tar.gz |
if matching a ref, return a tree type
A match will turn a ref into a tree. Need to return a tree type.
Diffstat (limited to 'src')
-rw-r--r-- | src/synthesis.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/synthesis.cc b/src/synthesis.cc index 1fb8c17a..64178cae 100644 --- a/src/synthesis.cc +++ b/src/synthesis.cc @@ -1171,6 +1171,7 @@ UniqueType *LangVarRef::evaluateCall( Compiler *pd, CodeVect &code, CallArgVect return lookup.uniqueType; } +/* Can match on a tree or a ref. A tree always comes back. */ UniqueType *LangTerm::evaluateMatch( Compiler *pd, CodeVect &code ) const { /* Add the vars bound by the pattern into the local scope. */ @@ -1205,6 +1206,10 @@ UniqueType *LangTerm::evaluateMatch( Compiler *pd, CodeVect &code ) const } } + /* The process of matching turns refs into trees. */ + if ( ut->typeId == TYPE_REF ) + ut = pd->findUniqueType( TYPE_TREE, ut->langEl ); + return ut; } |