From: Juerg Billeter Date: Sun, 13 Apr 2008 12:05:05 +0000 (+0000) Subject: set correct source_reference for property accessors X-Git-Tag: VALA_0_3_1~100 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=195995167db78b73443e876058a8145668aaf337;p=platform%2Fupstream%2Fvala.git set correct source_reference for property accessors 2008-04-13 Juerg Billeter * vala/valaparser.vala: set correct source_reference for property accessors * vala/valasemanticanalyzer.vala: set source_reference for generated code of automatic properties, fixes bug 527131 svn path=/trunk/; revision=1202 --- diff --git a/ChangeLog b/ChangeLog index c873901..26c6784 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2008-04-13 Jürg Billeter + * vala/valaparser.vala: set correct source_reference for property + accessors + + * vala/valasemanticanalyzer.vala: set source_reference for + generated code of automatic properties, fixes bug 527131 + +2008-04-13 Jürg Billeter + * vapi/dbus-glib-1.vapi: fix DBusGProxyCall binding, fixes bug 527127 diff --git a/vala/valaparser.vala b/vala/valaparser.vala index 17f8ea1..aa84ccc 100644 --- a/vala/valaparser.vala +++ b/vala/valaparser.vala @@ -2063,6 +2063,7 @@ public class Vala.Parser : CodeVisitor { } expect (TokenType.SEMICOLON); } else { + var accessor_begin = get_location (); parse_attributes (); var accessor_access = parse_access_modifier (SymbolAccessibility.PUBLIC); if (accept (TokenType.GET)) { @@ -2073,7 +2074,7 @@ public class Vala.Parser : CodeVisitor { if (!accept (TokenType.SEMICOLON)) { block = parse_block (); } - prop.get_accessor = context.create_property_accessor (true, false, false, block, get_src (begin)); + prop.get_accessor = context.create_property_accessor (true, false, false, block, get_src (accessor_begin)); prop.get_accessor.access = accessor_access; } else { bool writable, _construct; @@ -2093,7 +2094,7 @@ public class Vala.Parser : CodeVisitor { if (!accept (TokenType.SEMICOLON)) { block = parse_block (); } - prop.set_accessor = context.create_property_accessor (false, writable, _construct, block, get_src (begin)); + prop.set_accessor = context.create_property_accessor (false, writable, _construct, block, get_src (accessor_begin)); prop.set_accessor.access = accessor_access; } } diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala index f3a0ee1..9e9b704 100644 --- a/vala/valasemanticanalyzer.vala +++ b/vala/valasemanticanalyzer.vala @@ -701,10 +701,12 @@ public class Vala.SemanticAnalyzer : CodeVisitor { } acc.automatic_body = true; acc.body = new Block (); + var ma = context.create_member_access_simple ("_%s".printf (acc.prop.name), acc.source_reference); if (acc.readable) { - acc.body.add_statement (new ReturnStatement (new MemberAccess.simple ("_%s".printf (acc.prop.name)), acc.source_reference)); + acc.body.add_statement (context.create_return_statement (ma, acc.source_reference)); } else { - acc.body.add_statement (new ExpressionStatement (context.create_assignment (new MemberAccess.simple ("_%s".printf (acc.prop.name)), new MemberAccess.simple ("value")), acc.source_reference)); + var assignment = context.create_assignment (ma, context.create_member_access_simple ("value", acc.source_reference), AssignmentOperator.SIMPLE, acc.source_reference); + acc.body.add_statement (context.create_expression_statement (assignment)); } }