Made Block.source_reference non-null Added last_line and last_column to Block.source_reference Added source_reference to automatically created lambda methods and property accessors Added a parent_symbol != null check to TypeSymbol so that SeanticAnalyzer won't segfault on incremental parsing diff --git a/vala/valablock.vala b/vala/valablock.vala --- a/vala/valablock.vala +++ b/vala/valablock.vala @@ -41,7 +41,7 @@ public class Vala.Block : Symbol, Statem * * @param source reference to source code */ - public Block (SourceReference? source_reference = null) { + public Block (SourceReference source_reference) { this.source_reference = source_reference; } diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala --- a/vala/valagenieparser.vala +++ b/vala/valagenieparser.vala @@ -1651,7 +1651,7 @@ public class Vala.Genie.Parser : CodeVis comment = scanner.pop_comment (); - var block = new Block (); + var block = new Block (get_src_com (get_location ())); var stmt = parse_embedded_statement_without_block (); if (stmt == null) { // workaround for current limitation of exception handling diff --git a/vala/valaparser.vala b/vala/valaparser.vala --- a/vala/valaparser.vala +++ b/vala/valaparser.vala @@ -1300,7 +1300,7 @@ public class Vala.Parser : CodeVisitor { comment = scanner.pop_comment (); - var block = new Block (); + var block = new Block (get_src_com (get_location ())); var stmt = parse_embedded_statement_without_block (); if (stmt == null) { // workaround for current limitation of exception handling @@ -1343,6 +1343,9 @@ public class Vala.Parser : CodeVisitor { Report.error (get_current_src (), "expected `}'"); } } + + block.source_reference.last_line = get_current_src ().last_line; + block.source_reference.last_column = get_current_src ().last_column; return block; } diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala --- a/vala/valasemanticanalyzer.vala +++ b/vala/valasemanticanalyzer.vala @@ -710,7 +710,7 @@ public class Vala.SemanticAnalyzer : Cod return; } acc.automatic_body = true; - acc.body = new Block (); + acc.body = new Block (acc.source_reference); var ma = new MemberAccess.simple ("_%s".printf (acc.prop.name), acc.source_reference); if (acc.readable) { acc.body.add_statement (new ReturnStatement (ma, acc.source_reference)); @@ -3375,7 +3375,7 @@ public class Vala.SemanticAnalyzer : Cod } if (l.expression_body != null) { - var block = new Block (); + var block = new Block (l.source_reference); block.scope.parent_scope = l.method.scope; if (l.method.return_type.data_type != null) { diff --git a/vala/valatypesymbol.vala b/vala/valatypesymbol.vala --- a/vala/valatypesymbol.vala +++ b/vala/valatypesymbol.vala @@ -192,7 +192,7 @@ public abstract class Vala.TypeSymbol : } public override Gee.List get_cheader_filenames () { - if (cheader_filenames.size == 0) { + if (cheader_filenames.size == 0 && parent_symbol != null) { /* default to header filenames of the namespace */ foreach (string filename in parent_symbol.get_cheader_filenames ()) { add_cheader_filename (filename);