forked from qt-creator/qt-creator
QmlJS.PropertyReader: Allow access to raw ast value
Change-Id: I92f9f241c9780345dd03b931232c4a811356c216 Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
@@ -148,6 +148,7 @@ PropertyReader::PropertyReader(Document::Ptr doc, AST::UiObjectInitializer *ast)
|
|||||||
const QString astValue = cleanupSemicolon(textAt(doc,
|
const QString astValue = cleanupSemicolon(textAt(doc,
|
||||||
property->statement->firstSourceLocation(),
|
property->statement->firstSourceLocation(),
|
||||||
property->statement->lastSourceLocation()));
|
property->statement->lastSourceLocation()));
|
||||||
|
m_astPropertyValues.insert(propertyName, astValue);
|
||||||
if (isLiteralValue(property)) {
|
if (isLiteralValue(property)) {
|
||||||
m_properties.insert(propertyName, QVariant(deEscape(stripQuotes(astValue))));
|
m_properties.insert(propertyName, QVariant(deEscape(stripQuotes(astValue))));
|
||||||
} else if (isEnum(property->statement)) { //enum
|
} else if (isEnum(property->statement)) { //enum
|
||||||
@@ -164,6 +165,7 @@ PropertyReader::PropertyReader(Document::Ptr doc, AST::UiObjectInitializer *ast)
|
|||||||
const QString astValue = cleanupSemicolon(textAt(doc,
|
const QString astValue = cleanupSemicolon(textAt(doc,
|
||||||
property->statement->firstSourceLocation(),
|
property->statement->firstSourceLocation(),
|
||||||
property->statement->lastSourceLocation()));
|
property->statement->lastSourceLocation()));
|
||||||
|
m_astPropertyValues.insert(propertyName, astValue);
|
||||||
if (isLiteralValue(property)) {
|
if (isLiteralValue(property)) {
|
||||||
m_properties.insert(propertyName + QLatin1Char('.') + propertyNamePart2,
|
m_properties.insert(propertyName + QLatin1Char('.') + propertyNamePart2,
|
||||||
QVariant(deEscape(stripQuotes(astValue))));
|
QVariant(deEscape(stripQuotes(astValue))));
|
||||||
@@ -181,6 +183,7 @@ PropertyReader::PropertyReader(Document::Ptr doc, AST::UiObjectInitializer *ast)
|
|||||||
initializer->rbraceToken));
|
initializer->rbraceToken));
|
||||||
const QString propertyName = objectBinding->qualifiedId->name.toString();
|
const QString propertyName = objectBinding->qualifiedId->name.toString();
|
||||||
m_properties.insert(propertyName, QVariant(astValue));
|
m_properties.insert(propertyName, QVariant(astValue));
|
||||||
|
m_astPropertyValues.insert(propertyName, astValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -54,6 +54,14 @@ public:
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString readAstValue(const QString &propertyName) const
|
||||||
|
{
|
||||||
|
if (hasProperty(propertyName))
|
||||||
|
return m_astPropertyValues.value(propertyName);
|
||||||
|
else
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
QLinearGradient parseGradient(const QString &propertyName, bool *isBound) const;
|
QLinearGradient parseGradient(const QString &propertyName, bool *isBound) const;
|
||||||
|
|
||||||
QStringList properties() const
|
QStringList properties() const
|
||||||
@@ -64,6 +72,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QHash<QString, QVariant> m_properties;
|
QHash<QString, QVariant> m_properties;
|
||||||
|
QHash<QString, QString> m_astPropertyValues;
|
||||||
QList<QString> m_bindingOrEnum;
|
QList<QString> m_bindingOrEnum;
|
||||||
AST::UiObjectInitializer *m_ast;
|
AST::UiObjectInitializer *m_ast;
|
||||||
Document::Ptr m_doc;
|
Document::Ptr m_doc;
|
||||||
|
Reference in New Issue
Block a user