diff options
author | Adrian Thurston <thurston@complang.org> | 2013-03-29 13:03:51 -0400 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2013-03-29 13:03:51 -0400 |
commit | 49694236b45faddbb0eba720da31e87b96d8a01b (patch) | |
tree | 2f5c2903ba390f8add4d77d9a8436677d98a2320 | |
parent | 3d7fcac0a8ec6cfa6ea34ea12014f43980f546ec (diff) | |
download | colm-49694236b45faddbb0eba720da31e87b96d8a01b.tar.gz |
copy location, if present, when copying strings
-rw-r--r-- | colm/string.c | 8 |
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; } |