forked from qt-creator/qt-creator
QmlJS: Avoid infinite loop with recursive prototypes.
This commit is contained in:
@@ -397,6 +397,7 @@ public:
|
||||
QString className() const;
|
||||
void setClassName(const QString &className);
|
||||
|
||||
// not guaranteed to not recurse, use PrototypeIterator!
|
||||
const ObjectValue *prototype(const Context *context) const;
|
||||
void setPrototype(const Value *prototype);
|
||||
|
||||
@@ -422,6 +423,24 @@ private:
|
||||
QString _className;
|
||||
};
|
||||
|
||||
class QMLJS_EXPORT PrototypeIterator
|
||||
{
|
||||
public:
|
||||
PrototypeIterator(const ObjectValue *start, const Context *context);
|
||||
|
||||
bool hasNext();
|
||||
const ObjectValue *peekNext();
|
||||
const ObjectValue *next();
|
||||
|
||||
QList<const ObjectValue *> all();
|
||||
|
||||
private:
|
||||
const ObjectValue *m_current;
|
||||
const ObjectValue *m_next;
|
||||
QList<const ObjectValue *> m_prototypes;
|
||||
const Context *m_context;
|
||||
};
|
||||
|
||||
class QMLJS_EXPORT QmlObjectValue: public ObjectValue
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user