diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-09-11 19:28:13 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-12 23:00:42 +0200 |
commit | 53d005693eaba49b90fb636dd420d8993b698b66 (patch) | |
tree | c1e05cd9017b114a64a9be06412ed0ef76b30537 /src/qml/compiler/qqmlcodegenerator_p.h | |
parent | 1e17eb6cbd3c38e95c994ff00e529aecb6d530eb (diff) |
[new compiler] Implement name sanity checking for properties, signals and functions
Change-Id: I58c442dc56075c449ebd2534ab6b9f90e7da8eae
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qqmlcodegenerator_p.h')
-rw-r--r-- | src/qml/compiler/qqmlcodegenerator_p.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator_p.h b/src/qml/compiler/qqmlcodegenerator_p.h index 4d6b988fb8..100c1df1a4 100644 --- a/src/qml/compiler/qqmlcodegenerator_p.h +++ b/src/qml/compiler/qqmlcodegenerator_p.h @@ -51,6 +51,7 @@ #include <private/qv4codegen_p.h> #include <private/qv4compiler_p.h> #include <QTextStream> +#include <QCoreApplication> QT_BEGIN_NAMESPACE @@ -168,6 +169,8 @@ struct ParsedQML // Doesn't really generate code per-se, but more the data structure struct Q_QML_EXPORT QQmlCodeGenerator : public AST::Visitor { + Q_DECLARE_TR_FUNCTIONS(QQmlCodeGenerator) +public: QQmlCodeGenerator(); bool generateFromQml(const QString &code, const QUrl &url, const QString &urlString, ParsedQML *output); @@ -210,8 +213,12 @@ struct Q_QML_EXPORT QQmlCodeGenerator : public AST::Visitor void setBindingValue(QV4::CompiledData::Binding *binding, AST::Statement *statement); - void appendBinding(int propertyNameIndex, AST::Statement *value); - void appendBinding(int propertyNameIndex, int objectIndex); + void appendBinding(const AST::SourceLocation &nameLocation, int propertyNameIndex, AST::Statement *value); + void appendBinding(const AST::SourceLocation &nameLocation, int propertyNameIndex, int objectIndex); + + bool sanityCheckPropertyName(const AST::SourceLocation &nameLocation, int nameIndex); + + void recordError(const AST::SourceLocation &location, const QString &description); static QQmlScript::LocationSpan location(AST::SourceLocation start, AST::SourceLocation end); @@ -225,10 +232,14 @@ struct Q_QML_EXPORT QQmlCodeGenerator : public AST::Visitor QList<AST::Node*> _functions; QmlObject *_object; + QSet<QString> _propertyNames; + QSet<QString> _signalNames; QQmlJS::MemoryPool *pool; QString sourceCode; + QUrl url; QV4::Compiler::JSUnitGenerator *jsGenerator; + bool sanityCheckFunctionNames(); }; struct Q_QML_EXPORT QmlUnitGenerator |