return objectValue;
}
+const Value *Context::lookupReference(const Reference *reference)
+{
+ if (_referenceStack.contains(reference))
+ return 0;
+
+ _referenceStack.append(reference);
+ const Value *v = reference->value(this);
+ _referenceStack.removeLast();
+
+ return v;
+}
+
const Value *Context::property(const ObjectValue *object, const QString &name) const
{
const Properties properties = _properties.value(object);
const ObjectValue *prototypeObject = value_cast<const ObjectValue *>(_prototype);
if (! prototypeObject) {
if (const Reference *prototypeReference = value_cast<const Reference *>(_prototype)) {
- prototypeObject = value_cast<const ObjectValue *>(prototypeReference->value(context));
+ prototypeObject = value_cast<const ObjectValue *>(context->lookupReference(prototypeReference));
}
}
return prototypeObject;
const Value *lookup(const QString &name);
const ObjectValue *lookupType(const Document *doc, AST::UiQualifiedId *qmlTypeName);
const ObjectValue *lookupType(const Document *doc, const QStringList &qmlTypeName);
+ const Value *lookupReference(const Reference *reference);
const Value *property(const ObjectValue *object, const QString &name) const;
void setProperty(const ObjectValue *object, const QString &name, const Value *value);
ScopeChain _scopeChain;
int _qmlScopeObjectIndex;
bool _qmlScopeObjectSet;
+ QList<const Reference *> _referenceStack;
};
class QMLJS_EXPORT Reference: public Value
virtual ~Reference();
Engine *engine() const;
- virtual const Value *value(Context *context) const;
// Value interface
virtual const Reference *asReference() const;
virtual void accept(ValueVisitor *) const;
private:
+ virtual const Value *value(Context *context) const;
+
Engine *_engine;
+ friend class Context;
};
class QMLJS_EXPORT ColorValue: public Value
AST::UiQualifiedId *qmlTypeName() const;
+private:
virtual const Value *value(Context *context) const;
-private:
AST::UiQualifiedId *_qmlTypeName;
const Document *_doc;
};
ASTVariableReference(AST::VariableDeclaration *ast, Engine *engine);
virtual ~ASTVariableReference();
+private:
virtual const Value *value(Context *context) const;
};
QString onChangedSlotName() const { return _onChangedSlotName; }
virtual bool getSourceLocation(QString *fileName, int *line, int *column) const;
+
+private:
virtual const Value *value(Context *context) const;
};
QString slotName() const { return _slotName; }
virtual bool getSourceLocation(QString *fileName, int *line, int *column) const;
+
+private:
virtual const Value *value(Context *context) const;
};