diff options
| author | Erik Verbruggen <erik.verbruggen@qt.io> | 2017-09-19 14:22:18 +0200 |
|---|---|---|
| committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2017-09-20 12:46:19 +0000 |
| commit | 737275826330cb2988a147be534e3d8e74cb02c6 (patch) | |
| tree | 1445289f61bbbfbf2c0ac1cd0d2a200302ac5c8e /src/qml/jsruntime/qv4regexpobject.cpp | |
| parent | 3d076faeea52ef67daf4d51635d8bb49376de087 (diff) | |
Fix delayed loading of arguments in binary expressions
Consider the following functions:
function f(x) {
return x + (++x)
}
function g(x) {
return x + x
}
In f() it is not correct to delay the load of x on the left-hand side of
the + operator, while in g() it is. The reason is that calculating the
right-hand side of the + operator in f() will change the value of x.
So, if an argument is written to in an expression in a statement, it
cannot be delay-loaded. The same is true for member/field accesses,
because the accessors can be overwritten and do anything.
Change-Id: I5bed4b0d03919edc1c94a82127e2dd705fc1d9b1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4regexpobject.cpp')
0 files changed, 0 insertions, 0 deletions
