blob: 870540240e35995c45c963f7dd040d22051d45f8 (
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
31
32
33
34
|
pragma Strict
import QtQml
QtObject {
function absMinusOne(amount: real) : real {
// Access it before the condition below, to make sure we still get the original
var minusOne = amount !== 0 ? -1 : 0;
// The condition causes the original arguemnt to be overwritten rather than a new
// register to be allocated
if (amount < 0)
amount = -amount;
return amount + minusOne;
}
property real a: absMinusOne(-5)
property real b: absMinusOne(10)
function stringMinusOne(amount: real) : string {
// Access it before the condition below, to make sure we still get the original
var minusOne = amount !== 0 ? -1 : 0;
// The condition causes the original arguemnt to be overwritten rather than a new
// register to be allocated
if (amount < 0)
amount = -amount + "t";
return amount + minusOne;
}
property string c: stringMinusOne(-5)
property string d: stringMinusOne(10)
}
|