vala r1202 - in trunk: . vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1202 - in trunk: . vala
- Date: Sun, 13 Apr 2008 13:05:05 +0100 (BST)
Author: juergbi
Date: Sun Apr 13 13:05:05 2008
New Revision: 1202
URL: http://svn.gnome.org/viewvc/vala?rev=1202&view=rev
Log:
2008-04-13 Juerg 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
Modified:
trunk/ChangeLog
trunk/vala/valaparser.vala
trunk/vala/valasemanticanalyzer.vala
Modified: trunk/vala/valaparser.vala
==============================================================================
--- trunk/vala/valaparser.vala (original)
+++ trunk/vala/valaparser.vala Sun Apr 13 13:05:05 2008
@@ -2063,6 +2063,7 @@
}
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 @@
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 @@
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;
}
}
Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala (original)
+++ trunk/vala/valasemanticanalyzer.vala Sun Apr 13 13:05:05 2008
@@ -701,10 +701,12 @@
}
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));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]