Commit 4ae01e97 authored by Fawzi Mohamed's avatar Fawzi Mohamed
Browse files

qmljs/qmljsdescribevalue: try to use context to resolve prototypes



Change-Id: I0e8529dc339e995be1817b2f3d18ca9bc2c80738
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent e61119fe
......@@ -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;
......
......@@ -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;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment