aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmlcodegenerator_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/compiler/qqmlcodegenerator_p.h')
-rw-r--r--src/qml/compiler/qqmlcodegenerator_p.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator_p.h b/src/qml/compiler/qqmlcodegenerator_p.h
index f4752506b0..a231745e25 100644
--- a/src/qml/compiler/qqmlcodegenerator_p.h
+++ b/src/qml/compiler/qqmlcodegenerator_p.h
@@ -114,6 +114,9 @@ struct Signal
int nameIndex;
QV4::CompiledData::Location location;
PoolList<SignalParameter> *parameters;
+
+ QStringList parameterStringList(const QStringList &stringPool) const;
+
Signal *next;
};
@@ -177,6 +180,8 @@ public:
QQmlCodeGenerator();
bool generateFromQml(const QString &code, const QUrl &url, const QString &urlString, ParsedQML *output);
+ static bool isSignalPropertyName(const QString &name);
+
using AST::Visitor::visit;
using AST::Visitor::endVisit;
@@ -274,6 +279,49 @@ private:
QV4::Compiler::JSUnitGenerator *jsUnitGenerator;
};
+struct PropertyResolver
+{
+ PropertyResolver(QQmlPropertyCache *cache)
+ : cache(cache)
+ {}
+
+ QQmlPropertyData *property(int index)
+ {
+ return cache->property(index);
+ }
+
+ QQmlPropertyData *property(const QString &name, bool *notInRevision);
+
+ // This code must match the semantics of QQmlPropertyPrivate::findSignalByName
+ QQmlPropertyData *signal(const QString &name, bool *notInRevision);
+
+ QQmlPropertyCache *cache;
+};
+
+// "Converts" signal expressions to full-fleged function declarations with
+// parameters taken from the signal declarations
+// It also updates the QV4::CompiledData::Binding objects to set the property name
+// to the final signal name (onTextChanged -> textChanged) and sets the IsSignalExpression flag.
+struct SignalHandlerConverter
+{
+ Q_DECLARE_TR_FUNCTIONS(QQmlCodeGenerator)
+public:
+ SignalHandlerConverter(ParsedQML *parsedQML, const QHash<int, QQmlPropertyCache*> &resolvedPropertyCaches,
+ QQmlCompiledData *unit);
+
+ bool convertSignalHandlerExpressionsToFunctionDeclarations();
+
+ QList<QQmlError> errors;
+
+private:
+ const QString &stringAt(int index) const { return parsedQML->jsGenerator.strings.at(index); }
+ void recordError(const QV4::CompiledData::Location &location, const QString &description);
+
+ ParsedQML *parsedQML;
+ const QHash<int, QQmlPropertyCache*> &resolvedPropertyCaches;
+ QQmlCompiledData *unit;
+};
+
struct Q_QML_EXPORT JSCodeGen : public QQmlJS::Codegen
{
JSCodeGen()