summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFawzi Mohamed <fawzi.mohamed@digia.com>2014-06-02 14:35:57 +0200
committerFawzi Mohamed <fawzi.mohamed@digia.com>2014-06-23 11:37:11 +0200
commit4ae01e973ad180509c301ff302807215303154a3 (patch)
tree86b7bcc52e040e5d7edbc178e3f30b935fe1a70e /src
parente61119feb9a88f9bd5d6a2e3debdd09ad85d1cb5 (diff)
downloadqt-creator-4ae01e973ad180509c301ff302807215303154a3.tar.gz
qmljs/qmljsdescribevalue: try to use context to resolve prototypes
Change-Id: I0e8529dc339e995be1817b2f3d18ca9bc2c80738 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/libs/qmljs/qmljsdescribevalue.cpp23
-rw-r--r--src/libs/qmljs/qmljsdescribevalue.h6
2 files changed, 21 insertions, 8 deletions
diff --git a/src/libs/qmljs/qmljsdescribevalue.cpp b/src/libs/qmljs/qmljsdescribevalue.cpp
index ff35e1719f..c0c8f2785f 100644
--- a/src/libs/qmljs/qmljsdescribevalue.cpp
+++ b/src/libs/qmljs/qmljsdescribevalue.cpp
@@ -30,20 +30,23 @@
#include "qmljsdescribevalue.h"
#include "qmljsinterpreter.h"
+#include "qmljscontext.h"
#include "parser/qmljsast_p.h"
#include <QString>
namespace QmlJS {
-QString DescribeValueVisitor::describe(const Value *value, int depth)
+QString DescribeValueVisitor::describe(const Value *value, int depth, ContextPtr context)
{
- DescribeValueVisitor describer(-depth);
+ DescribeValueVisitor describer(-depth, 0, 2, context);
return describer(value);
}
-DescribeValueVisitor::DescribeValueVisitor(int detailDepth, int startIndent, int indentIncrement)
- : m_depth(-detailDepth), m_indent(startIndent), m_indentIncrement(indentIncrement)
+DescribeValueVisitor::DescribeValueVisitor(int startDepth, int startIndent, int indentIncrement,
+ ContextPtr context)
+ : m_depth(startDepth), m_indent(startIndent), m_indentIncrement(indentIncrement),
+ m_context(context)
{ }
DescribeValueVisitor::~DescribeValueVisitor()
@@ -381,8 +384,16 @@ void DescribeValueVisitor::visit(const Reference *value)
}
if (printDetail) {
ValueOwner *vOwner = value->valueOwner();
- dump(QLatin1String("\n valueOwner@"));
- dump(QString::fromLatin1("@%1").arg((quintptr)(void *)vOwner, 0, 16));
+ dumpNewline();
+ dump(QString::fromLatin1("valueOwner@%1").arg((quintptr)(void *)vOwner, 0, 16));
+ if (!m_context.isNull()) {
+ dumpNewline();
+ dump("referencedObject:");
+ const Value *refObj = m_context->lookupReference(value);
+ openContext();
+ (*this)(refObj);
+ closeContext();
+ }
closeContext();
}
--m_depth;
diff --git a/src/libs/qmljs/qmljsdescribevalue.h b/src/libs/qmljs/qmljsdescribevalue.h
index f82a4512f7..9707f303b4 100644
--- a/src/libs/qmljs/qmljsdescribevalue.h
+++ b/src/libs/qmljs/qmljsdescribevalue.h
@@ -41,9 +41,10 @@ namespace QmlJS {
class QMLJS_EXPORT DescribeValueVisitor : public ValueVisitor
{
public:
- static QString describe(const Value *value, int depth = 1);
+ static QString describe(const Value *value, int depth = 1, ContextPtr context = ContextPtr());
- DescribeValueVisitor(int detailDepth = 1, int startIndent = 0, int indentIncrement = 2);
+ DescribeValueVisitor(int detailDepth = 1, int startIndent = 0, int indentIncrement = 2,
+ ContextPtr context = ContextPtr());
virtual ~DescribeValueVisitor();
QString operator()(const Value *value);
@@ -70,6 +71,7 @@ private:
int m_indent;
int m_indentIncrement;
bool m_emptyContext;
+ ContextPtr m_context;
QSet<const Value *> m_visited;
QString m_description;
};