summaryrefslogtreecommitdiff
path: root/colm/string.c
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2013-03-29 13:03:51 -0400
committerAdrian Thurston <thurston@complang.org>2013-03-29 13:03:51 -0400
commit49694236b45faddbb0eba720da31e87b96d8a01b (patch)
tree2f5c2903ba390f8add4d77d9a8436677d98a2320 /colm/string.c
parent3d7fcac0a8ec6cfa6ea34ea12014f43980f546ec (diff)
downloadcolm-49694236b45faddbb0eba720da31e87b96d8a01b.tar.gz
copy location, if present, when copying strings
Diffstat (limited to 'colm/string.c')
-rw-r--r--colm/string.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/colm/string.c b/colm/string.c
index 21c3aac4..5b5e39e2 100644
--- a/colm/string.c
+++ b/colm/string.c
@@ -44,6 +44,14 @@ Head *stringCopy( Program *prg, Head *head )
result = stringAllocFull( prg, head->data, head->length );
else
result = stringAllocPointer( prg, head->data, head->length );
+
+ if ( head->location != 0 ) {
+ result->location = locationAllocate( prg );
+ result->location->file = head->location->file;
+ result->location->line = head->location->line;
+ result->location->column = head->location->column;
+ result->location->byte = head->location->byte;
+ }
}
return result;
}