2008-04-13 Jürg Billeter <j@bitron.ch>
+ * 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 <j@bitron.ch>
+
* vapi/dbus-glib-1.vapi: fix DBusGProxyCall binding,
fixes bug 527127
}
expect (TokenType.SEMICOLON);
} else {
+ var accessor_begin = get_location ();
parse_attributes ();
var accessor_access = parse_access_modifier (SymbolAccessibility.PUBLIC);
if (accept (TokenType.GET)) {
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;
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;
}
}
}
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));
}
}