2010-01-18 16:15:23 +01:00
|
|
|
/**************************************************************************
|
|
|
|
**
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
**
|
|
|
|
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
**
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
**
|
|
|
|
** Commercial Usage
|
|
|
|
**
|
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
** a written agreement between you and Nokia.
|
|
|
|
**
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
**
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
**
|
|
|
|
** If you are unsure which license is appropriate for your use, please
|
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
|
|
|
**
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
#include "parser/qmljsast_p.h"
|
2010-01-26 14:50:52 +01:00
|
|
|
#include "qmljsbind.h"
|
|
|
|
#include "qmljsmetatypesystem.h"
|
2010-01-26 17:23:18 +01:00
|
|
|
#include <QtCore/QDebug>
|
2010-01-18 16:15:23 +01:00
|
|
|
|
|
|
|
using namespace QmlJS;
|
2010-01-26 14:50:52 +01:00
|
|
|
using namespace QmlJS::AST;
|
|
|
|
using namespace QmlJS::Interpreter;
|
2010-01-18 16:15:23 +01:00
|
|
|
|
2010-01-26 16:21:03 +01:00
|
|
|
Bind::Bind(Document::Ptr doc, const Snapshot &snapshot, Interpreter::Engine *interp)
|
|
|
|
: _doc(doc),
|
|
|
|
_snapshot(snapshot),
|
|
|
|
_interp(interp),
|
2010-01-26 15:51:31 +01:00
|
|
|
_interestingMember(0),
|
|
|
|
_currentObjectValue(0),
|
|
|
|
_typeEnvironment(0),
|
|
|
|
_idEnvironment(0),
|
|
|
|
_interestingObjectValue(0),
|
|
|
|
_rootObjectValue(0)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Bind::~Bind()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-01-26 16:21:03 +01:00
|
|
|
Interpreter::ObjectValue *Bind::operator()(UiObjectMember *member)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
2010-01-26 16:21:03 +01:00
|
|
|
UiProgram *program = _doc->qmlProgram();
|
2010-01-26 14:50:52 +01:00
|
|
|
if (!program)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
_interestingMember = member;
|
|
|
|
|
|
|
|
_currentObjectValue = 0;
|
2010-01-26 15:51:31 +01:00
|
|
|
_typeEnvironment = _interp->newObject(/*prototype =*/ 0);
|
|
|
|
_idEnvironment = _interp->newObject(/*prototype =*/ 0);
|
2010-01-26 14:50:52 +01:00
|
|
|
_interestingObjectValue = 0;
|
|
|
|
_rootObjectValue = 0;
|
|
|
|
|
|
|
|
accept(program);
|
|
|
|
|
|
|
|
if (_interestingObjectValue) {
|
|
|
|
_idEnvironment->setScope(_interestingObjectValue);
|
|
|
|
|
|
|
|
if (_interestingObjectValue != _rootObjectValue)
|
|
|
|
_interestingObjectValue->setScope(_rootObjectValue);
|
|
|
|
} else {
|
|
|
|
_idEnvironment->setScope(_rootObjectValue);
|
|
|
|
}
|
|
|
|
_typeEnvironment->setScope(_idEnvironment);
|
|
|
|
|
|
|
|
return _typeEnvironment;
|
2010-01-18 16:15:23 +01:00
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
void Bind::accept(Node *node)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
2010-01-26 14:50:52 +01:00
|
|
|
Node::accept(node, this);
|
2010-01-18 16:15:23 +01:00
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(UiProgram *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(UiImportList *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
static QString serialize(UiQualifiedId *qualifiedId, QChar delimiter)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
2010-01-26 14:50:52 +01:00
|
|
|
QString result;
|
|
|
|
|
|
|
|
for (UiQualifiedId *iter = qualifiedId; iter; iter = iter->next) {
|
|
|
|
if (iter != qualifiedId)
|
|
|
|
result += delimiter;
|
|
|
|
|
|
|
|
if (iter->name)
|
|
|
|
result += iter->name->asString();
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
2010-01-18 16:15:23 +01:00
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
/*
|
|
|
|
import Qt 4.6
|
|
|
|
import Qt 4.6 as Xxx
|
|
|
|
(import com.nokia.qt is the same as the ones above)
|
|
|
|
|
|
|
|
import "content"
|
|
|
|
import "content" as Xxx
|
|
|
|
import "content" 4.6
|
|
|
|
import "content" 4.6 as Xxx
|
|
|
|
|
|
|
|
import "http://www.ovi.com/" as Ovi
|
|
|
|
*/
|
|
|
|
bool Bind::visit(UiImport *ast)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
2010-01-26 17:23:18 +01:00
|
|
|
if (! (ast->importUri || ast->fileName))
|
|
|
|
return false; // nothing to do.
|
|
|
|
|
|
|
|
ObjectValue *namespaceObject = 0;
|
2010-01-26 14:50:52 +01:00
|
|
|
|
|
|
|
if (ast->asToken.isValid()) { // with namespace we insert an object in the type env. to hold the imported types
|
|
|
|
if (!ast->importId)
|
|
|
|
return false; // this should never happen, but better be safe than sorry
|
2010-01-26 16:21:03 +01:00
|
|
|
|
2010-01-26 16:31:07 +01:00
|
|
|
namespaceObject = _interp->newObject(/*prototype */ 0);
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
_typeEnvironment->setProperty(ast->importId->asString(), namespaceObject);
|
2010-01-26 16:21:03 +01:00
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
} else { // without namespace we insert all types directly into the type env.
|
|
|
|
namespaceObject = _typeEnvironment;
|
|
|
|
}
|
|
|
|
|
|
|
|
// look at files first
|
|
|
|
|
|
|
|
// else try the metaobject system
|
2010-01-26 17:23:18 +01:00
|
|
|
if (ast->importUri) {
|
|
|
|
const QString package = serialize(ast->importUri, '/');
|
|
|
|
int majorVersion = -1; // ### TODO: Check these magic version numbers
|
|
|
|
int minorVersion = -1; // ### TODO: Check these magic version numbers
|
|
|
|
|
|
|
|
if (ast->versionToken.isValid()) {
|
|
|
|
const QString versionString = _doc->source().mid(ast->versionToken.offset, ast->versionToken.length);
|
|
|
|
const int dotIdx = versionString.indexOf(QLatin1Char('.'));
|
|
|
|
if (dotIdx == -1) {
|
|
|
|
// only major (which is probably invalid, but let's handle it anyway)
|
|
|
|
majorVersion = versionString.toInt();
|
|
|
|
minorVersion = 0; // ### TODO: Check with magic version numbers above
|
|
|
|
} else {
|
|
|
|
majorVersion = versionString.left(dotIdx).toInt();
|
|
|
|
minorVersion = versionString.mid(dotIdx + 1).toInt();
|
|
|
|
}
|
2010-01-26 14:50:52 +01:00
|
|
|
}
|
|
|
|
#ifndef NO_DECLARATIVE_BACKEND
|
2010-01-26 17:23:18 +01:00
|
|
|
foreach (QmlObjectValue *object, _interp->metaTypeSystem().staticTypesForImport(package, majorVersion, minorVersion)) {
|
|
|
|
namespaceObject->setProperty(object->qmlTypeName(), object);
|
|
|
|
}
|
2010-01-26 14:50:52 +01:00
|
|
|
#endif // NO_DECLARATIVE_BACKEND
|
2010-01-26 17:23:18 +01:00
|
|
|
} else if (ast->fileName) {
|
|
|
|
// got an import "contents"
|
|
|
|
const QString relativePath = ast->fileName->asString();
|
|
|
|
const QList<Document::Ptr> userComponents = _snapshot.importedDocuments(_doc, relativePath);
|
|
|
|
foreach (Document::Ptr userComponent, userComponents) {
|
|
|
|
if (UiProgram *program = userComponent->qmlProgram()) {
|
|
|
|
if (UiObjectMemberList *members = program->members) {
|
|
|
|
if (UiObjectDefinition *def = cast<UiObjectDefinition *>(members->member)) {
|
|
|
|
const ObjectValue *prototype = lookupType(def->qualifiedTypeNameId);
|
|
|
|
ObjectValue *objectValue = _interp->newObject(prototype);
|
|
|
|
if (def->initializer) {
|
|
|
|
for (AST::UiObjectMemberList *it = def->initializer->members; it; it = it->next) {
|
|
|
|
if (AST::UiPublicMember *prop = AST::cast<AST::UiPublicMember *>(it->member)) {
|
|
|
|
if (prop->name && prop->memberType) {
|
|
|
|
const QString propName = prop->name->asString();
|
|
|
|
const QString propType = prop->memberType->asString();
|
|
|
|
objectValue->setProperty(propName, _interp->defaultValueForBuiltinType(propType));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_typeEnvironment->setProperty(userComponent->componentName(), objectValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-01-26 14:50:52 +01:00
|
|
|
|
|
|
|
return false;
|
2010-01-18 16:15:23 +01:00
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(UiPublicMember *ast)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
2010-01-26 14:50:52 +01:00
|
|
|
if (! (ast->name && ast->memberType))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
const QString propName = ast->name->asString();
|
|
|
|
const QString propType = ast->memberType->asString();
|
|
|
|
|
|
|
|
// ### TODO: generalize
|
|
|
|
if (propType == QLatin1String("string"))
|
|
|
|
_currentObjectValue->setProperty(propName, _interp->stringValue());
|
|
|
|
else if (propType == QLatin1String("bool"))
|
|
|
|
_currentObjectValue->setProperty(propName, _interp->booleanValue());
|
|
|
|
else if (propType == QLatin1String("int") || propType == QLatin1String("real"))
|
|
|
|
_currentObjectValue->setProperty(propName, _interp->numberValue());
|
|
|
|
|
|
|
|
return false;
|
2010-01-18 16:15:23 +01:00
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(UiSourceElement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
const ObjectValue *Bind::lookupType(UiQualifiedId *qualifiedTypeNameId)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
2010-01-26 14:50:52 +01:00
|
|
|
const ObjectValue *objectValue = _typeEnvironment;
|
|
|
|
|
2010-01-26 17:23:18 +01:00
|
|
|
for (UiQualifiedId *iter = qualifiedTypeNameId; objectValue && iter; iter = iter->next) {
|
|
|
|
if (! iter->name)
|
2010-01-26 14:50:52 +01:00
|
|
|
return 0;
|
2010-01-26 17:23:18 +01:00
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
const Value *value = objectValue->property(iter->name->asString());
|
|
|
|
if (!value)
|
|
|
|
return 0;
|
2010-01-26 17:23:18 +01:00
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
objectValue = value->asObjectValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
return objectValue;
|
2010-01-18 16:15:23 +01:00
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
ObjectValue *Bind::bindObject(UiQualifiedId *qualifiedTypeNameId, UiObjectInitializer *initializer)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
2010-01-26 14:50:52 +01:00
|
|
|
const ObjectValue *prototype = lookupType(qualifiedTypeNameId);
|
|
|
|
ObjectValue *objectValue = _interp->newObject(prototype);
|
|
|
|
ObjectValue *oldObjectValue = switchObjectValue(objectValue);
|
|
|
|
if (oldObjectValue)
|
|
|
|
objectValue->setProperty("parent", oldObjectValue);
|
|
|
|
else
|
|
|
|
_rootObjectValue = objectValue;
|
|
|
|
|
|
|
|
accept(initializer);
|
|
|
|
|
|
|
|
return switchObjectValue(oldObjectValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Bind::visit(UiObjectDefinition *ast)
|
|
|
|
{
|
|
|
|
ObjectValue *value = bindObject(ast->qualifiedTypeNameId, ast->initializer);
|
|
|
|
|
|
|
|
if (_interestingMember == ast)
|
|
|
|
_interestingObjectValue = value;
|
|
|
|
return false;
|
2010-01-18 16:15:23 +01:00
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(UiObjectBinding *ast)
|
|
|
|
{
|
|
|
|
// const QString name = serialize(ast->qualifiedId);
|
|
|
|
ObjectValue *value = bindObject(ast->qualifiedTypeNameId, ast->initializer);
|
|
|
|
// ### FIXME: we don't handle dot-properties correctly (i.e. font.size)
|
|
|
|
// _currentObjectValue->setProperty(name, value);
|
|
|
|
|
|
|
|
if (_interestingMember == ast)
|
|
|
|
_interestingObjectValue = value;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Bind::visit(UiObjectInitializer *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(UiScriptBinding *ast)
|
|
|
|
{
|
|
|
|
if (!(ast->qualifiedId->next) && ast->qualifiedId->name->asString() == "id")
|
|
|
|
if (ExpressionStatement *e = cast<ExpressionStatement*>(ast->statement))
|
|
|
|
if (IdentifierExpression *i = cast<IdentifierExpression*>(e->expression))
|
|
|
|
if (i->name)
|
|
|
|
_idEnvironment->setProperty(i->name->asString(), _currentObjectValue);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Bind::visit(UiArrayBinding *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
2010-01-26 14:50:52 +01:00
|
|
|
// ### FIXME: do we need to store the members into the property? Or, maybe the property type is an JS Array?
|
|
|
|
|
2010-01-18 16:15:23 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(UiObjectMemberList *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(UiArrayMemberList *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(UiQualifiedId *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(UiSignature *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(UiFormalList *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(UiFormal *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(ThisExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(IdentifierExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(NullExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(TrueLiteral *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(FalseLiteral *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(StringLiteral *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(NumericLiteral *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(RegExpLiteral *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(ArrayLiteral *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(ObjectLiteral *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(ElementList *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(Elision *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(PropertyNameAndValueList *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(NestedExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(IdentifierPropertyName *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(StringLiteralPropertyName *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(NumericLiteralPropertyName *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(ArrayMemberExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(FieldMemberExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(NewMemberExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(NewExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(CallExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(ArgumentList *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(PostIncrementExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(PostDecrementExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(DeleteExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(VoidExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(TypeOfExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(PreIncrementExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(PreDecrementExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(UnaryPlusExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(UnaryMinusExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(TildeExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(NotExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(BinaryExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(ConditionalExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(Expression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(Block *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(StatementList *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(VariableStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(VariableDeclarationList *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(VariableDeclaration *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(EmptyStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(ExpressionStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(IfStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(DoWhileStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(WhileStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(ForStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(LocalForStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(ForEachStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(LocalForEachStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(ContinueStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(BreakStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(ReturnStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(WithStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(SwitchStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(CaseBlock *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(CaseClauses *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(CaseClause *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(DefaultClause *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(LabelledStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(ThrowStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(TryStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(Catch *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(Finally *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(FunctionDeclaration *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(FunctionExpression *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(FormalParameterList *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(FunctionBody *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(Program *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(SourceElements *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(FunctionSourceElement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(StatementSourceElement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-26 14:50:52 +01:00
|
|
|
bool Bind::visit(DebuggerStatement *)
|
2010-01-18 16:15:23 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2010-01-26 14:50:52 +01:00
|
|
|
|
|
|
|
ObjectValue *Bind::switchObjectValue(ObjectValue *newObjectValue)
|
|
|
|
{
|
|
|
|
ObjectValue *oldObjectValue = _currentObjectValue;
|
|
|
|
_currentObjectValue = newObjectValue;
|
|
|
|
return oldObjectValue;
|
|
|
|
}
|