Update symbol_c::first_file/last_file entries in list_c::add_element()
authorMario de Sousa <msousa@fe.up.pt>
Fri, 28 Dec 2012 11:51:24 +0000
changeset 779 2ed03e0e0e41
parent 778 44e02a88f1e7
child 785 b08167f156a1
Update symbol_c::first_file/last_file entries in list_c::add_element()
absyntax/absyntax.cc
--- a/absyntax/absyntax.cc	Thu Dec 27 15:31:01 2012 +0000
+++ b/absyntax/absyntax.cc	Fri Dec 28 11:51:24 2012 +0000
@@ -111,14 +111,23 @@
   if (NULL == elem) return;
 
   /* adjust the location parameters, taking into account the new element. */
-  if ((first_line == elem->first_line) &&
-      (first_column > elem->first_column)) {
+  if (NULL == first_file) {
+    first_file = elem->first_file;
+    first_line = elem->first_line;
+    first_column = elem->first_column;
+  }
+  if ((first_line == elem->first_line) && (first_column > elem->first_column)) {
     first_column = elem->first_column;
   }
   if (first_line > elem->first_line) {
     first_line = elem->first_line;
     first_column = elem->first_column;
   }
+  if (NULL == last_file) {
+    last_file = elem->last_file;
+    last_line = elem->last_line;
+    last_column = elem->last_column;
+  }
   if ((last_line == elem->last_line) &&
       (last_column < elem->last_column)) {
     last_column = elem->last_column;