From 99efe4309379482fce5c231885883e359bf85290 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 6 Mar 2014 16:55:09 +0100 Subject: Remove old compiler and VME This removes the bulk of the code. A few smaller cleanups remain, to be done in smaller changes as they move code around. Additionally the "optimize" option of qqmlbundle was removed. It called QQmlScript::Parser::preparseData, which however was not implemented and always returned an empty QByteArray. Therefore "optimize" would not do anything and the class is gone now :) Change-Id: I0c265e756704cb53c5250be1f69e4a3e1b6e64d5 Reviewed-by: Lars Knoll --- src/qml/qml/qqmlcustomparser.cpp | 189 --------------------------------------- 1 file changed, 189 deletions(-) (limited to 'src/qml/qml/qqmlcustomparser.cpp') diff --git a/src/qml/qml/qqmlcustomparser.cpp b/src/qml/qml/qqmlcustomparser.cpp index f661317794..16e3abf3a0 100644 --- a/src/qml/qml/qqmlcustomparser.cpp +++ b/src/qml/qml/qqmlcustomparser.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include "qqmlcustomparser_p.h" -#include "qqmlcustomparser_p_p.h" #include "qqmlcompiler_p.h" @@ -93,189 +92,11 @@ using namespace QQmlScript; The \a object will be an instance of the TypeClass specified by QML_REGISTER_CUSTOM_TYPE. */ -QQmlCustomParserNode -QQmlCustomParserNodePrivate::fromObject(QQmlScript::Object *root) -{ - QQmlCustomParserNode rootNode; - if (root->typeReference) - rootNode.d->name = root->typeReference->name; - rootNode.d->location = root->location.start; - - for (QQmlScript::Property *p = root->properties.first(); p; p = root->properties.next(p)) { - rootNode.d->properties << fromProperty(p); - } - - if (root->defaultProperty) - rootNode.d->properties << fromProperty(root->defaultProperty); - - return rootNode; -} - -QQmlCustomParserProperty -QQmlCustomParserNodePrivate::fromProperty(QQmlScript::Property *p) -{ - QQmlCustomParserProperty prop; - prop.d->name = p->name().toString(); - prop.d->isList = p->values.isMany(); - prop.d->location = p->location.start; - - if (p->value) { - QQmlCustomParserNode node = fromObject(p->value); - QList props = node.properties(); - for (int ii = 0; ii < props.count(); ++ii) - prop.d->values << QVariant::fromValue(props.at(ii)); - } else { - for (QQmlScript::Value *v = p->values.first(); v; v = p->values.next(v)) { - v->type = QQmlScript::Value::Literal; - - if(v->object) { - QQmlCustomParserNode node = fromObject(v->object); - prop.d->values << QVariant::fromValue(node); - } else { - prop.d->values << QVariant::fromValue(v->value); - } - - } - } - - return prop; -} - -QQmlCustomParserNode::QQmlCustomParserNode() -: d(new QQmlCustomParserNodePrivate) -{ -} - -QQmlCustomParserNode::QQmlCustomParserNode(const QQmlCustomParserNode &other) -: d(new QQmlCustomParserNodePrivate) -{ - *this = other; -} - -QQmlCustomParserNode &QQmlCustomParserNode::operator=(const QQmlCustomParserNode &other) -{ - d->name = other.d->name; - d->properties = other.d->properties; - d->location = other.d->location; - return *this; -} - -QQmlCustomParserNode::~QQmlCustomParserNode() -{ - delete d; d = 0; -} - -QString QQmlCustomParserNode::name() const -{ - return d->name; -} - -QList QQmlCustomParserNode::properties() const -{ - return d->properties; -} - -QQmlScript::Location QQmlCustomParserNode::location() const -{ - return d->location; -} - -QQmlCustomParserProperty::QQmlCustomParserProperty() -: d(new QQmlCustomParserPropertyPrivate) -{ -} - -QQmlCustomParserProperty::QQmlCustomParserProperty(const QQmlCustomParserProperty &other) -: d(new QQmlCustomParserPropertyPrivate) -{ - *this = other; -} - -QQmlCustomParserProperty &QQmlCustomParserProperty::operator=(const QQmlCustomParserProperty &other) -{ - d->name = other.d->name; - d->isList = other.d->isList; - d->values = other.d->values; - d->location = other.d->location; - return *this; -} - -QQmlCustomParserProperty::~QQmlCustomParserProperty() -{ - delete d; d = 0; -} - -QString QQmlCustomParserProperty::name() const -{ - return d->name; -} - -bool QQmlCustomParserProperty::isList() const -{ - return d->isList; -} - -QQmlScript::Location QQmlCustomParserProperty::location() const -{ - return d->location; -} - -QList QQmlCustomParserProperty::assignedValues() const -{ - return d->values; -} - void QQmlCustomParser::clearErrors() { exceptions.clear(); } -/*! - Reports an error with the given \a description. - - This can only be used during the compile() step. For errors during setCustomData(), use qmlInfo(). - - An error is generated referring to the position of the element in the source file. -*/ -void QQmlCustomParser::error(const QString& description) -{ - Q_ASSERT(object); - QQmlError error; - QString exceptionDescription; - error.setLine(object->location.start.line); - error.setColumn(object->location.start.column); - error.setDescription(description); - exceptions << error; -} - -/*! - Reports an error in parsing \a prop, with the given \a description. - - An error is generated referring to the position of \a node in the source file. -*/ -void QQmlCustomParser::error(const QQmlCustomParserProperty& prop, const QString& description) -{ - QQmlError error; - error.setLine(prop.location().line); - error.setColumn(prop.location().column); - error.setDescription(description); - exceptions << error; -} - -/*! - Reports an error in parsing \a node, with the given \a description. - - An error is generated referring to the position of \a node in the source file. -*/ -void QQmlCustomParser::error(const QQmlCustomParserNode& node, const QString& description) -{ - QQmlError error; - error.setLine(node.location().line); - error.setColumn(node.location().column); - error.setDescription(description); - exceptions << error; -} - /*! Reports an error with the given \a description. @@ -318,16 +139,6 @@ const QMetaObject *QQmlCustomParser::resolveType(const QString& name) const return compiler->resolveType(name); } -/*! - Rewrites \a value and returns an identifier that can be - used to construct the binding later. \a name - is used as the name of the rewritten function. -*/ -QQmlBinding::Identifier QQmlCustomParser::bindingIdentifier(const QQmlScript::Variant &value, const QString& name) -{ - return compiler->bindingIdentifier(value, name, this); -} - QQmlBinding::Identifier QQmlCustomParser::bindingIdentifier(const QV4::CompiledData::Binding *binding) { return compiler->bindingIdentifier(binding, this); -- cgit v1.2.3