Evaluate Class
(QmlJS::Evaluate)The Evaluate class evaluates AST::Nodes to Values. More...
Header: | #include <Evaluate> |
Public Functions
Evaluate(const ScopeChain *scopeChain, ReferenceContext *referenceContext = 0) | |
~Evaluate() | |
const Value * | reference(AST::Node *ast) |
const Value * | value(AST::Node *ast) |
const Value * | operator()(AST::Node *ast) |
Protected Functions
void | accept(AST::Node *node) |
const Value * | switchResult(const Value *result) |
bool | visit(AST::UiProgram *ast) override |
bool | visit(AST::UiHeaderItemList *ast) override |
bool | visit(AST::NewMemberExpression *ast) override |
bool | visit(AST::NewExpression *ast) override |
bool | visit(AST::CallExpression *ast) override |
bool | visit(AST::ArgumentList *ast) override |
bool | visit(AST::PostIncrementExpression *ast) override |
bool | visit(AST::PostDecrementExpression *ast) override |
bool | visit(AST::DeleteExpression *ast) override |
bool | visit(AST::VoidExpression *ast) override |
bool | visit(AST::TypeOfExpression *ast) override |
bool | visit(AST::PreIncrementExpression *ast) override |
bool | visit(AST::PreDecrementExpression *ast) override |
bool | visit(AST::UnaryPlusExpression *ast) override |
bool | visit(AST::UnaryMinusExpression *ast) override |
bool | visit(AST::TildeExpression *ast) override |
bool | visit(AST::NotExpression *ast) override |
bool | visit(AST::BinaryExpression *ast) override |
bool | visit(AST::ConditionalExpression *ast) override |
bool | visit(AST::Expression *ast) override |
bool | visit(AST::Block *ast) override |
bool | visit(AST::StatementList *ast) override |
bool | visit(AST::VariableStatement *ast) override |
bool | visit(AST::VariableDeclarationList *ast) override |
bool | visit(AST::VariableDeclaration *ast) override |
bool | visit(AST::EmptyStatement *ast) override |
bool | visit(AST::ExpressionStatement *ast) override |
bool | visit(AST::IfStatement *ast) override |
bool | visit(AST::DoWhileStatement *ast) override |
bool | visit(AST::WhileStatement *ast) override |
bool | visit(AST::ForStatement *ast) override |
bool | visit(AST::LocalForStatement *ast) override |
bool | visit(AST::ForEachStatement *ast) override |
bool | visit(AST::LocalForEachStatement *ast) override |
bool | visit(AST::ContinueStatement *ast) override |
bool | visit(AST::BreakStatement *ast) override |
bool | visit(AST::ReturnStatement *ast) override |
bool | visit(AST::WithStatement *ast) override |
bool | visit(AST::UiQualifiedPragmaId *ast) override |
bool | visit(AST::SwitchStatement *ast) override |
bool | visit(AST::CaseBlock *ast) override |
bool | visit(AST::CaseClauses *ast) override |
bool | visit(AST::CaseClause *ast) override |
bool | visit(AST::DefaultClause *ast) override |
bool | visit(AST::LabelledStatement *ast) override |
bool | visit(AST::ThrowStatement *ast) override |
bool | visit(AST::TryStatement *ast) override |
bool | visit(AST::Catch *ast) override |
bool | visit(AST::Finally *ast) override |
bool | visit(AST::FunctionDeclaration *ast) override |
bool | visit(AST::FunctionExpression *ast) override |
bool | visit(AST::FormalParameterList *ast) override |
bool | visit(AST::FunctionBody *ast) override |
bool | visit(AST::Program *ast) override |
bool | visit(AST::SourceElements *ast) override |
bool | visit(AST::FunctionSourceElement *ast) override |
bool | visit(AST::StatementSourceElement *ast) override |
bool | visit(AST::DebuggerStatement *ast) override |
bool | visit(AST::UiPragma *ast) override |
bool | visit(AST::UiImport *ast) override |
bool | visit(AST::UiPublicMember *ast) override |
bool | visit(AST::UiSourceElement *ast) override |
bool | visit(AST::UiObjectDefinition *ast) override |
bool | visit(AST::UiObjectInitializer *ast) override |
bool | visit(AST::UiObjectBinding *ast) override |
bool | visit(AST::UiScriptBinding *ast) override |
bool | visit(AST::UiArrayBinding *ast) override |
bool | visit(AST::UiObjectMemberList *ast) override |
bool | visit(AST::UiArrayMemberList *ast) override |
bool | visit(AST::UiQualifiedId *ast) override |
bool | visit(AST::ThisExpression *ast) override |
bool | visit(AST::IdentifierExpression *ast) override |
bool | visit(AST::NullExpression *ast) override |
bool | visit(AST::TrueLiteral *ast) override |
bool | visit(AST::FalseLiteral *ast) override |
bool | visit(AST::StringLiteral *ast) override |
bool | visit(AST::NumericLiteral *ast) override |
bool | visit(AST::RegExpLiteral *ast) override |
bool | visit(AST::ArrayLiteral *ast) override |
bool | visit(AST::ObjectLiteral *ast) override |
bool | visit(AST::ElementList *ast) override |
bool | visit(AST::Elision *ast) override |
bool | visit(AST::PropertyAssignmentList *ast) override |
bool | visit(AST::PropertyGetterSetter *ast) override |
bool | visit(AST::PropertyNameAndValue *ast) override |
bool | visit(AST::NestedExpression *ast) override |
bool | visit(AST::IdentifierPropertyName *ast) override |
bool | visit(AST::StringLiteralPropertyName *ast) override |
bool | visit(AST::NumericLiteralPropertyName *ast) override |
bool | visit(AST::ArrayMemberExpression *ast) override |
bool | visit(AST::FieldMemberExpression *ast) override |
Detailed Description
The Evaluate class evaluates AST::Nodes to Values.
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() function) will be used.
The reference() function has the special behavior of not resolving References which can be useful when interested in the identity of a variable instead of its value.
Example: In a scope where "var a = 1"
- value(Identifier-a) will return NumberValue
- reference(Identifier-a) will return the ASTVariableReference for the declaration of "a"
See also Value and ScopeChain.
Member Function Documentation
Evaluate::Evaluate(const ScopeChain *scopeChain, ReferenceContext *referenceContext = 0)
Default constructs an instance of Evaluate.
Evaluate::~Evaluate()
Destroys the instance of Evaluate.