summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2015-01-17 16:24:48 -0500
committerAdrian Thurston <thurston@complang.org>2015-01-17 16:24:48 -0500
commitd868a2614948f8f8b7f73c1a5fa5f59c4bebe0b3 (patch)
tree1642d2c34d06f0cf78f21ca33f6e379b6063d721
parent8e87d8e820bee8f4a957bdc00b33b7966f542189 (diff)
downloadcolm-d868a2614948f8f8b7f73c1a5fa5f59c4bebe0b3.tar.gz
updated binary1 test case
-rw-r--r--src/synthesis.cc6
-rw-r--r--test/binary1.lm18
2 files changed, 17 insertions, 7 deletions
diff --git a/src/synthesis.cc b/src/synthesis.cc
index 91856383..bc37c59e 100644
--- a/src/synthesis.cc
+++ b/src/synthesis.cc
@@ -1171,8 +1171,10 @@ UniqueType *LangTerm::evaluateConstruct( Compiler *pd, CodeVect &code ) const
if ( item->type == ConsItem::ExprType ) {
UniqueType *ut = item->expr->evaluate( pd, code );
- if ( ut->typeId != TYPE_TREE )
- error() << "variables used in replacements must be trees" << endp;
+ if ( ut->typeId != TYPE_TREE ) {
+ error(constructor->loc) << "variables used in "
+ "replacements must be trees" << endp;
+ }
item->langEl = ut->langEl;
}
diff --git a/test/binary1.lm b/test/binary1.lm
index 80f6b248..d84790c6 100644
--- a/test/binary1.lm
+++ b/test/binary1.lm
@@ -449,7 +449,12 @@ int print_RR_A( s: start )
}
}
-int print_name( n: name m: map<int name> )
+struct name_map_el
+ Name: name
+ map_el<int> el
+end
+
+int print_name( n: name m: map<int name_map_el> )
{
for P: name_part in n {
match P [part_len D:nbytes]
@@ -460,8 +465,8 @@ int print_name( n: name m: map<int name> )
if match E [o1:octet o2:octet] {
val: int = (o1.data.uord8() - 192) * 256 + o2.data.uord8()
print( '[' val ']' )
- nameInMap: name = m->find( val )
- print_name( nameInMap m )
+ nameInMap: name_map_el = m->find( val )
+ print_name( nameInMap->Name m )
}
}
}
@@ -469,7 +474,7 @@ int print_name( n: name m: map<int name> )
int print_all_names( s: start )
{
for M: message in s {
- m: map<int name> = new map<int name>
+ m: map<int name_map_el> = new map<int name_map_el>
O: octet = octet in M
@@ -480,7 +485,10 @@ int print_all_names( s: start )
if match NP [L: octet nbytes name_part*] {
messageOffset: int = L.pos - O.pos
construct n: name [NP E]
- m->insert( messageOffset n )
+ El: name_map_el = new name_map_el
+ El->key = messageOffset
+ El->Name = n
+ m->insert( El )
}
}
}