From 49694236b45faddbb0eba720da31e87b96d8a01b Mon Sep 17 00:00:00 2001 From: Adrian Thurston Date: Fri, 29 Mar 2013 13:03:51 -0400 Subject: copy location, if present, when copying strings --- colm/string.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'colm/string.c') 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; } -- cgit v1.2.1