]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix scanning of case where single line comments are appended to end of a line
authorJamie McCracken <jamiemcc gnome org>
Sun, 23 Aug 2009 04:03:46 +0000 (00:03 -0400)
committerJamie McCracken <jamiemcc gnome org>
Sun, 23 Aug 2009 04:03:46 +0000 (00:03 -0400)
Fixes GNOME  Bug 592369 -  compiler is complaining about indentation if there are comments

vala/valageniescanner.vala

index d28ff761a54d8cba5a214fca8f70c7e3bf8b7874..ecbb426a4d479cae5717e312c7b08628f4483623 100644 (file)
@@ -1040,13 +1040,16 @@ public class Vala.Genie.Scanner {
                        // single-line comment
                        current += 2;
                        char* begin = current;
+                       
                        // skip until end of line or end of file
                        while (current < end && current[0] != '\n') {
                                current++;
                        }
+                       
                        push_comment (((string) begin).ndup ((long) (current - begin)), line == 1);
 
-                       if (current[0] == '\n') {
+                       /* do not ignore EOL if comment does not exclusively occupy the line */
+                       if (current[0] == '\n' && last_token == TokenType.EOL) {
                                current++;
                                line++;
                                column = 1;