Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support change slots for properties starting with '_'
According to ECMA-262r3, property names may begin with a letter, underscore ('_'), dollar sign ('$'), or unicode escape sequence. We previously supported Change slots for properties only if the property name began with a letter; this patch adds support for properties which begin with one or more underscore. Task-number: QTBUG-17950 Reviewed-by: Aaron Kennedy Change-Id: I6f28bde18a38e32c2131e0990fe0f69bda36f90e
- Loading branch information
Chris Adams
committed
May 23, 2011
1 parent
cca7611
commit 9605fc7
Showing
7 changed files
with
144 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...s/auto/declarative/qdeclarativeecmascript/data/changeslots/propertyChangeSlotErrors.1.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import QtQuick 1.0 | ||
|
||
Item { | ||
property int changeCount: 0 | ||
|
||
property bool _nameWithUnderscore: false | ||
|
||
// this should error, since the first alpha isn't capitalised. | ||
on_nameWithUnderscoreChanged: { | ||
changeCount = changeCount + 2; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...s/auto/declarative/qdeclarativeecmascript/data/changeslots/propertyChangeSlotErrors.2.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import QtQuick 1.0 | ||
|
||
Item { | ||
property int changeCount: 0 | ||
|
||
property bool ____nameWithUnderscores: false | ||
|
||
// this should error, since the first alpha isn't capitalised | ||
on____nameWithUnderscoresChanged: { | ||
changeCount = changeCount + 3; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...s/auto/declarative/qdeclarativeecmascript/data/changeslots/propertyChangeSlotErrors.3.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import QtQuick 1.0 | ||
|
||
Item { | ||
property int changeCount: 0 | ||
|
||
// invalid property name - we don't allow $ | ||
property bool $nameWithDollarsign: false | ||
|
||
on$NameWithDollarsignChanged: { | ||
changeCount = changeCount + 4; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...s/auto/declarative/qdeclarativeecmascript/data/changeslots/propertyChangeSlotErrors.4.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import QtQuick 1.0 | ||
|
||
Item { | ||
property int changeCount: 0 | ||
|
||
property bool _6nameWithUnderscoreNumber: false | ||
|
||
// invalid property name - the first character after an underscore must be a letter | ||
on_6NameWithUnderscoreNumberChanged: { | ||
changeCount = changeCount + 3; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
tests/auto/declarative/qdeclarativeecmascript/data/changeslots/propertyChangeSlots.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import QtQuick 1.0 | ||
|
||
Item { | ||
property int changeCount: 0 | ||
|
||
property bool normalName: false | ||
property bool _nameWithUnderscore: false | ||
property bool ____nameWithUnderscores: false | ||
|
||
onNormalNameChanged: { | ||
changeCount = changeCount + 1; | ||
} | ||
|
||
on_NameWithUnderscoreChanged: { | ||
changeCount = changeCount + 2; | ||
} | ||
|
||
on____NameWithUnderscoresChanged: { | ||
changeCount = changeCount + 3; | ||
} | ||
|
||
Component.onCompleted: { | ||
normalName = true; | ||
_nameWithUnderscore = true; | ||
____nameWithUnderscores = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters