After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 527770 - `this` not working in struct creation methods
`this` not working in struct creation methods
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: general
0.2.x
Other All
: Normal normal
: ---
Assigned To: Jürg Billeter
Vala maintainers
Depends on:
Blocks: 531918
 
 
Reported: 2008-04-12 19:40 UTC by Jürg Billeter
Modified: 2008-05-09 09:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
trivial patch (491 bytes, patch)
2008-05-05 09:21 UTC, Jared Moore
committed Details | Review

Description Jürg Billeter 2008-04-12 19:40:46 UTC
It should be possible to access the struct under construction with the `this` expression.
Comment 1 Jared Moore 2008-05-05 09:21:15 UTC
Created attachment 110396 [details] [review]
trivial patch 

Patch based on implementation of "this" in vala/valaclass.vala.

Test case:

using GLib;
public class Test : Object {
	public static int main(string[] args) {
		Blah b = Blah();
		stdout.printf("%d\n", b.i);
		// Expected:
		// 5
		return 0;
	}
}

public struct Blah {
	public Blah () {
		this.i = 5;
	}
	public int i;
}
Comment 2 Jürg Billeter 2008-05-08 21:10:21 UTC
Thanks for the patch.
Comment 3 Jürg Billeter 2008-05-08 21:11:29 UTC
2008-05-08  Jürg Billeter  <j@bitron.ch>

	* vala/valastruct.vala:

	Support `this' in struct creation methods,
	patch by Jared Moore, fixes bug 527770

Fixed in r1349.