From 756c734e221f946f9bb69cf8c28134e07c784726 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Thu, 24 Nov 2011 11:40:37 +0100 Subject: QmlJS: Add documentation for Evaluate. Change-Id: I02543af2ce90dfa5bda88533ead39a7dbede90d4 Reviewed-by: Leandro Melo --- src/libs/qmljs/qmljsevaluate.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/libs/qmljs/qmljsevaluate.cpp') diff --git a/src/libs/qmljs/qmljsevaluate.cpp b/src/libs/qmljs/qmljsevaluate.cpp index e6220881b5..fd4703240a 100644 --- a/src/libs/qmljs/qmljsevaluate.cpp +++ b/src/libs/qmljs/qmljsevaluate.cpp @@ -39,6 +39,31 @@ using namespace QmlJS; +/*! + \class QmlJS::Evaluate + \brief Evaluates \l{AST::Node}s to \l{Value}s. + \sa Value ScopeChain + + The Evaluate visitor is constructed with a ScopeChain and accepts JavaScript + expressions as well as some other AST::Nodes. It evaluates the expression in + the given ScopeChain and returns a Value representing the result. + + Example: Pass in the AST for "1 + 2" and NumberValue will be returned. + + In normal cases only the call operator (or the equivalent value() method) + will be used. + + The reference() method has the special behavior of not resolving \l{Reference}s + which can be useful when interested in the identity of a variable instead + of its value. + + Example: In a scope where "var a = 1" + \list + \o value(Identifier-a) will return NumberValue + \o reference(Identifier-a) will return the ASTVariableReference for the declaration of "a" + \endlist +*/ + Evaluate::Evaluate(const ScopeChain *scopeChain, ReferenceContext *referenceContext) : _valueOwner(scopeChain->context()->valueOwner()), _context(scopeChain->context()), -- cgit v1.2.1