summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2013-12-27 09:26:51 -0500
committerAdrian Thurston <thurston@complang.org>2013-12-27 09:26:51 -0500
commit954ee9801b5681cfbfbaa74458988a74e87b428a (patch)
treedd89a063fd37b13ebd7514740421a8cc9fa3e43d
parent4d753c413462eaa1c84ba8a535c51b8edddef789 (diff)
downloadcolm-954ee9801b5681cfbfbaa74458988a74e87b428a.tar.gz
expression values of type void are ignored by stream send
Allows us to call a function in a send without printing the return value of the function.
-rw-r--r--src/synthesis.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/synthesis.cc b/src/synthesis.cc
index 1d168c42..ba402556 100644
--- a/src/synthesis.cc
+++ b/src/synthesis.cc
@@ -1607,6 +1607,9 @@ void LangTerm::evaluateSendStream( Compiler *pd, CodeVect &code ) const
code.append( IN_LOAD_STR );
code.appendWord( mapEl->value );
+
+ code.append( IN_PRINT_STREAM );
+ code.append( 1 );
break;
}
case ConsItem::InputText: {
@@ -1617,15 +1620,25 @@ void LangTerm::evaluateSendStream( Compiler *pd, CodeVect &code ) const
code.append( IN_LOAD_STR );
code.appendWord( mapEl->value );
+
+ code.append( IN_PRINT_STREAM );
+ code.append( 1 );
break;
}
case ConsItem::ExprType:
- item->expr->evaluate( pd, code );
+ UniqueType *ut = item->expr->evaluate( pd, code );
+ if ( ut->typeId == TYPE_TREE && ut->langEl == pd->voidLangEl ) {
+ code.append( IN_POP );
+ code.append( IN_POP );
+ }
+ else {
+ code.append( IN_PRINT_STREAM );
+ code.append( 1 );
+ }
+
break;
}
- code.append( IN_PRINT_STREAM );
- code.append( 1 );
}