summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/properties/property-syntax.slang
blob: 41a2513d38ce8434b5ea08015be15f8995944c62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// property-syntax.slang

// Confirm that property syntax is parsed correctly.

//TEST:SIMPLE:

struct Data
{
    int _a;
    int _b;

    // Traditional syntax
	property int a
	{
		get { return _a; }
		set(int newValue) { _a = newValue; }
	}

	// "Modern" syntax
	property b : int
	{
		get { return _b; }
		set(newValue : int) { _a = newValue; }
	}
}

int test(Data d)
{
	return d.a + d.b;
}