summaryrefslogtreecommitdiff
path: root/src/libs/qmljs/qmljsevaluate.cpp
diff options
context:
space:
mode:
authorChristian Kamm <christian.d.kamm@nokia.com>2011-11-24 11:40:37 +0100
committerChristian Kamm <christian.d.kamm@nokia.com>2011-11-24 14:42:29 +0100
commit756c734e221f946f9bb69cf8c28134e07c784726 (patch)
treef2af921c20b53055ffba1459b11547cd274477db /src/libs/qmljs/qmljsevaluate.cpp
parent65c7d92531c2d75695d599a5137e4e888c7e476d (diff)
downloadqt-creator-756c734e221f946f9bb69cf8c28134e07c784726.tar.gz
QmlJS: Add documentation for Evaluate.
Change-Id: I02543af2ce90dfa5bda88533ead39a7dbede90d4 Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
Diffstat (limited to 'src/libs/qmljs/qmljsevaluate.cpp')
-rw-r--r--src/libs/qmljs/qmljsevaluate.cpp25
1 files changed, 25 insertions, 0 deletions
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()),