Commit 265118eb authored by Christian Kamm's avatar Christian Kamm
Browse files

Add the onNameChanged signals that Qml properties generate implicitly.

parent 1f411118
......@@ -2026,11 +2026,14 @@ bool ASTObjectValue::getSourceLocation(QString *fileName, int *line, int *column
void ASTObjectValue::processMembers(MemberProcessor *processor) const
{
foreach (ASTPropertyReference *ref, _properties)
foreach (ASTPropertyReference *ref, _properties) {
processor->processProperty(ref->ast()->name->asString(), ref);
// ### Should get a different value?
processor->processGeneratedSlot(ref->onChangedSlotName(), ref);
}
foreach (ASTSignalReference *ref, _signals) {
// ### These two should get different values?
processor->processSignal(ref->ast()->name->asString(), ref);
// ### Should get a different value?
processor->processGeneratedSlot(ref->slotName(), ref);
}
......@@ -2125,6 +2128,11 @@ const Value *QmlPrototypeReference::value(Context *context) const
ASTPropertyReference::ASTPropertyReference(UiPublicMember *ast, const QmlJS::Document *doc, Engine *engine)
: Reference(engine), _ast(ast), _doc(doc)
{
const QString propertyName = ast->name->asString();
_onChangedSlotName = QLatin1String("on");
_onChangedSlotName += propertyName.at(0).toUpper();
_onChangedSlotName += propertyName.midRef(1);
_onChangedSlotName += QLatin1String("Changed");
}
ASTPropertyReference::~ASTPropertyReference()
......
......@@ -685,12 +685,14 @@ class QMLJS_EXPORT ASTPropertyReference: public Reference
{
AST::UiPublicMember *_ast;
const Document *_doc;
QString _onChangedSlotName;
public:
ASTPropertyReference(AST::UiPublicMember *ast, const Document *doc, Engine *engine);
virtual ~ASTPropertyReference();
AST::UiPublicMember *ast() const { return _ast; }
QString onChangedSlotName() const { return _onChangedSlotName; }
virtual bool getSourceLocation(QString *fileName, int *line, int *column) const;
virtual const Value *value(Context *context) const;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment