| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | /**************************************************************************
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** This file is part of Qt Creator | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-01-11 16:28:15 +01:00
										 |  |  | ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** Contact: Nokia Corporation (info@qt.nokia.com) | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | ** | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** GNU Lesser General Public License Usage | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** 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.
 | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2010-12-17 16:01:08 +01:00
										 |  |  | ** In addition, as a special exception, Nokia gives you certain additional | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** rights. These rights are described in the Nokia Qt LGPL Exception | 
					
						
							| 
									
										
										
										
											2010-12-17 16:01:08 +01:00
										 |  |  | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2011-04-13 08:42:33 +02:00
										 |  |  | ** Other Usage | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** Alternatively, this file may be used in accordance with the terms and | 
					
						
							|  |  |  | ** conditions contained in a signed written agreement between you and Nokia. | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2010-12-17 16:01:08 +01:00
										 |  |  | ** If you have questions regarding the use of this file, please contact | 
					
						
							| 
									
										
										
										
											2011-05-06 15:05:37 +02:00
										 |  |  | ** Nokia at info@qt.nokia.com. | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | ** | 
					
						
							|  |  |  | **************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef QMLJS_INTERPRETER_H
 | 
					
						
							|  |  |  | #define QMLJS_INTERPRETER_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-03 11:17:25 +01:00
										 |  |  | #include <languageutils/componentversion.h>
 | 
					
						
							| 
									
										
										
										
											2011-01-04 17:04:44 +01:00
										 |  |  | #include <languageutils/fakemetaobject.h>
 | 
					
						
							| 
									
										
										
										
											2010-02-04 10:19:37 +01:00
										 |  |  | #include <qmljs/qmljsdocument.h>
 | 
					
						
							| 
									
										
										
										
											2010-01-26 14:50:52 +01:00
										 |  |  | #include <qmljs/qmljs_global.h>
 | 
					
						
							| 
									
										
										
										
											2010-02-03 14:31:03 +01:00
										 |  |  | #include <qmljs/parser/qmljsastfwd_p.h>
 | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-01 13:01:05 +01:00
										 |  |  | #include <QtCore/QFileInfoList>
 | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | #include <QtCore/QList>
 | 
					
						
							|  |  |  | #include <QtCore/QString>
 | 
					
						
							|  |  |  | #include <QtCore/QHash>
 | 
					
						
							|  |  |  | #include <QtCore/QSet>
 | 
					
						
							| 
									
										
										
										
											2010-09-24 13:54:28 +02:00
										 |  |  | #include <QtCore/QMutex>
 | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace QmlJS { | 
					
						
							| 
									
										
										
										
											2010-02-03 14:31:03 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | class NameId; | 
					
						
							| 
									
										
										
										
											2010-02-04 09:44:43 +01:00
										 |  |  | class Document; | 
					
						
							| 
									
										
										
										
											2010-02-03 14:31:03 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | ////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Forward declarations
 | 
					
						
							|  |  |  | ////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  | class ValueOwner; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | class Value; | 
					
						
							|  |  |  | class NullValue; | 
					
						
							|  |  |  | class UndefinedValue; | 
					
						
							|  |  |  | class NumberValue; | 
					
						
							| 
									
										
										
										
											2010-11-10 16:31:20 +01:00
										 |  |  | class IntValue; | 
					
						
							|  |  |  | class RealValue; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | class BooleanValue; | 
					
						
							|  |  |  | class StringValue; | 
					
						
							| 
									
										
										
										
											2010-11-11 16:04:55 +01:00
										 |  |  | class UrlValue; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | class ObjectValue; | 
					
						
							|  |  |  | class FunctionValue; | 
					
						
							| 
									
										
										
										
											2010-02-03 10:24:25 +01:00
										 |  |  | class Reference; | 
					
						
							| 
									
										
										
										
											2010-02-23 14:36:38 +01:00
										 |  |  | class ColorValue; | 
					
						
							| 
									
										
										
										
											2010-02-23 17:02:50 +01:00
										 |  |  | class AnchorLineValue; | 
					
						
							| 
									
										
										
										
											2011-05-27 10:43:06 +02:00
										 |  |  | class Imports; | 
					
						
							|  |  |  | class TypeScope; | 
					
						
							|  |  |  | class JSImportScope; | 
					
						
							| 
									
										
										
										
											2011-07-01 13:51:53 +02:00
										 |  |  | class Context; | 
					
						
							| 
									
										
										
										
											2011-07-13 15:04:27 +02:00
										 |  |  | typedef QSharedPointer<const Context> ContextPtr; | 
					
						
							| 
									
										
										
										
											2011-07-12 14:55:27 +02:00
										 |  |  | class ReferenceContext; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-24 11:10:01 +01:00
										 |  |  | typedef QList<const Value *> ValueList; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | ////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Value visitor
 | 
					
						
							|  |  |  | ////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | class QMLJS_EXPORT ValueVisitor | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     ValueVisitor(); | 
					
						
							|  |  |  |     virtual ~ValueVisitor(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual void visit(const NullValue *); | 
					
						
							|  |  |  |     virtual void visit(const UndefinedValue *); | 
					
						
							|  |  |  |     virtual void visit(const NumberValue *); | 
					
						
							|  |  |  |     virtual void visit(const BooleanValue *); | 
					
						
							|  |  |  |     virtual void visit(const StringValue *); | 
					
						
							|  |  |  |     virtual void visit(const ObjectValue *); | 
					
						
							|  |  |  |     virtual void visit(const FunctionValue *); | 
					
						
							| 
									
										
										
										
											2010-02-03 10:24:25 +01:00
										 |  |  |     virtual void visit(const Reference *); | 
					
						
							| 
									
										
										
										
											2010-02-23 14:36:38 +01:00
										 |  |  |     virtual void visit(const ColorValue *); | 
					
						
							| 
									
										
										
										
											2010-02-23 17:02:50 +01:00
										 |  |  |     virtual void visit(const AnchorLineValue *); | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // QML/JS value
 | 
					
						
							|  |  |  | ////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | class QMLJS_EXPORT Value | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Value(const Value &other); | 
					
						
							|  |  |  |     void operator = (const Value &other); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     Value(); | 
					
						
							|  |  |  |     virtual ~Value(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual const NullValue *asNullValue() const; | 
					
						
							|  |  |  |     virtual const UndefinedValue *asUndefinedValue() const; | 
					
						
							|  |  |  |     virtual const NumberValue *asNumberValue() const; | 
					
						
							| 
									
										
										
										
											2010-11-10 16:31:20 +01:00
										 |  |  |     virtual const IntValue *asIntValue() const; | 
					
						
							|  |  |  |     virtual const RealValue *asRealValue() const; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  |     virtual const BooleanValue *asBooleanValue() const; | 
					
						
							|  |  |  |     virtual const StringValue *asStringValue() const; | 
					
						
							| 
									
										
										
										
											2010-11-11 16:04:55 +01:00
										 |  |  |     virtual const UrlValue *asUrlValue() const; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  |     virtual const ObjectValue *asObjectValue() const; | 
					
						
							|  |  |  |     virtual const FunctionValue *asFunctionValue() const; | 
					
						
							| 
									
										
										
										
											2010-02-03 10:24:25 +01:00
										 |  |  |     virtual const Reference *asReference() const; | 
					
						
							| 
									
										
										
										
											2010-02-23 14:36:38 +01:00
										 |  |  |     virtual const ColorValue *asColorValue() const; | 
					
						
							| 
									
										
										
										
											2010-02-23 17:02:50 +01:00
										 |  |  |     virtual const AnchorLineValue *asAnchorLineValue() const; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     virtual void accept(ValueVisitor *) const = 0; | 
					
						
							| 
									
										
										
										
											2010-02-08 12:50:10 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     virtual bool getSourceLocation(QString *fileName, int *line, int *column) const; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template <typename _RetTy> _RetTy value_cast(const Value *v); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template <> Q_INLINE_TEMPLATE const NullValue *value_cast(const Value *v) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (v) return v->asNullValue(); | 
					
						
							|  |  |  |     else   return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template <> Q_INLINE_TEMPLATE const UndefinedValue *value_cast(const Value *v) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (v) return v->asUndefinedValue(); | 
					
						
							|  |  |  |     else   return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template <> Q_INLINE_TEMPLATE const NumberValue *value_cast(const Value *v) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (v) return v->asNumberValue(); | 
					
						
							|  |  |  |     else   return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-10 16:31:20 +01:00
										 |  |  | template <> Q_INLINE_TEMPLATE const IntValue *value_cast(const Value *v) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (v) return v->asIntValue(); | 
					
						
							|  |  |  |     else   return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template <> Q_INLINE_TEMPLATE const RealValue *value_cast(const Value *v) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (v) return v->asRealValue(); | 
					
						
							|  |  |  |     else   return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | template <> Q_INLINE_TEMPLATE const BooleanValue *value_cast(const Value *v) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (v) return v->asBooleanValue(); | 
					
						
							|  |  |  |     else   return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template <> Q_INLINE_TEMPLATE const StringValue *value_cast(const Value *v) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (v) return v->asStringValue(); | 
					
						
							|  |  |  |     else   return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-11 16:04:55 +01:00
										 |  |  | template <> Q_INLINE_TEMPLATE const UrlValue *value_cast(const Value *v) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (v) return v->asUrlValue(); | 
					
						
							|  |  |  |     else   return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | template <> Q_INLINE_TEMPLATE const ObjectValue *value_cast(const Value *v) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (v) return v->asObjectValue(); | 
					
						
							|  |  |  |     else   return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | template <> Q_INLINE_TEMPLATE const FunctionValue *value_cast(const Value *v) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (v) return v->asFunctionValue(); | 
					
						
							|  |  |  |     else   return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-03 10:24:25 +01:00
										 |  |  | template <> Q_INLINE_TEMPLATE const Reference *value_cast(const Value *v) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (v) return v->asReference(); | 
					
						
							|  |  |  |     else   return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-23 14:36:38 +01:00
										 |  |  | template <> Q_INLINE_TEMPLATE const ColorValue *value_cast(const Value *v) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (v) return v->asColorValue(); | 
					
						
							|  |  |  |     else   return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-23 17:02:50 +01:00
										 |  |  | template <> Q_INLINE_TEMPLATE const AnchorLineValue *value_cast(const Value *v) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (v) return v->asAnchorLineValue(); | 
					
						
							|  |  |  |     else   return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | ////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Value nodes
 | 
					
						
							|  |  |  | ////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | class QMLJS_EXPORT NullValue: public Value | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     virtual const NullValue *asNullValue() const; | 
					
						
							|  |  |  |     virtual void accept(ValueVisitor *visitor) const; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class QMLJS_EXPORT UndefinedValue: public Value | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     virtual const UndefinedValue *asUndefinedValue() const; | 
					
						
							|  |  |  |     virtual void accept(ValueVisitor *visitor) const; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class QMLJS_EXPORT NumberValue: public Value | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     virtual const NumberValue *asNumberValue() const; | 
					
						
							|  |  |  |     virtual void accept(ValueVisitor *visitor) const; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-10 16:31:20 +01:00
										 |  |  | class QMLJS_EXPORT RealValue: public NumberValue | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     virtual const RealValue *asRealValue() const; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class QMLJS_EXPORT IntValue: public NumberValue | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     virtual const IntValue *asIntValue() const; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | class QMLJS_EXPORT BooleanValue: public Value | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     virtual const BooleanValue *asBooleanValue() const; | 
					
						
							|  |  |  |     virtual void accept(ValueVisitor *visitor) const; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class QMLJS_EXPORT StringValue: public Value | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     virtual const StringValue *asStringValue() const; | 
					
						
							|  |  |  |     virtual void accept(ValueVisitor *visitor) const; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-11 16:04:55 +01:00
										 |  |  | class QMLJS_EXPORT UrlValue: public StringValue | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     virtual const UrlValue *asUrlValue() const; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-24 11:10:01 +01:00
										 |  |  | class QMLJS_EXPORT MemberProcessor | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     MemberProcessor(const MemberProcessor &other); | 
					
						
							|  |  |  |     void operator = (const MemberProcessor &other); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2010-01-26 10:10:11 +01:00
										 |  |  |     MemberProcessor(); | 
					
						
							|  |  |  |     virtual ~MemberProcessor(); | 
					
						
							| 
									
										
										
										
											2010-01-24 11:10:01 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // Returns false to stop the processor.
 | 
					
						
							| 
									
										
										
										
											2010-01-26 10:10:11 +01:00
										 |  |  |     virtual bool processProperty(const QString &name, const Value *value); | 
					
						
							| 
									
										
										
										
											2010-01-28 15:50:58 +01:00
										 |  |  |     virtual bool processEnumerator(const QString &name, const Value *value); | 
					
						
							| 
									
										
										
										
											2010-01-26 10:10:11 +01:00
										 |  |  |     virtual bool processSignal(const QString &name, const Value *value); | 
					
						
							|  |  |  |     virtual bool processSlot(const QString &name, const Value *value); | 
					
						
							| 
									
										
										
										
											2010-01-26 10:19:42 +01:00
										 |  |  |     virtual bool processGeneratedSlot(const QString &name, const Value *value); | 
					
						
							| 
									
										
										
										
											2010-01-24 11:10:01 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-03 10:24:25 +01:00
										 |  |  | class QMLJS_EXPORT Reference: public Value | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     Reference(ValueOwner *valueOwner); | 
					
						
							| 
									
										
										
										
											2010-02-03 10:24:25 +01:00
										 |  |  |     virtual ~Reference(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     ValueOwner *valueOwner() const; | 
					
						
							| 
									
										
										
										
											2010-02-03 10:24:25 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // Value interface
 | 
					
						
							|  |  |  |     virtual const Reference *asReference() const; | 
					
						
							|  |  |  |     virtual void accept(ValueVisitor *) const; | 
					
						
							| 
									
										
										
										
											2010-02-03 14:31:03 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2011-09-12 11:48:33 +02:00
										 |  |  |     virtual const Value *value(ReferenceContext *referenceContext) const; | 
					
						
							| 
									
										
										
										
											2010-06-08 15:36:06 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     ValueOwner *_valueOwner; | 
					
						
							| 
									
										
										
										
											2011-07-12 14:55:27 +02:00
										 |  |  |     friend class ReferenceContext; | 
					
						
							| 
									
										
										
										
											2010-02-03 10:24:25 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-23 14:36:38 +01:00
										 |  |  | class QMLJS_EXPORT ColorValue: public Value | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     // Value interface
 | 
					
						
							|  |  |  |     virtual const ColorValue *asColorValue() const; | 
					
						
							|  |  |  |     virtual void accept(ValueVisitor *) const; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-23 17:02:50 +01:00
										 |  |  | class QMLJS_EXPORT AnchorLineValue: public Value | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     // Value interface
 | 
					
						
							|  |  |  |     virtual const AnchorLineValue *asAnchorLineValue() const; | 
					
						
							|  |  |  |     virtual void accept(ValueVisitor *) const; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-03 10:59:52 +01:00
										 |  |  | class QMLJS_EXPORT ObjectValue: public Value | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     ObjectValue(ValueOwner *valueOwner); | 
					
						
							| 
									
										
										
										
											2010-01-24 11:10:01 +01:00
										 |  |  |     virtual ~ObjectValue(); | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     ValueOwner *valueOwner() const; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QString className() const; | 
					
						
							|  |  |  |     void setClassName(const QString &className); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-20 13:19:16 +02:00
										 |  |  |     // may return a reference, prototypes may form a cycle: use PrototypeIterator!
 | 
					
						
							|  |  |  |     const Value *prototype() const; | 
					
						
							|  |  |  |     // prototypes may form a cycle: use PrototypeIterator!
 | 
					
						
							| 
									
										
										
										
											2010-08-25 11:51:34 +02:00
										 |  |  |     const ObjectValue *prototype(const Context *context) const; | 
					
						
							| 
									
										
										
										
											2011-07-13 15:04:27 +02:00
										 |  |  |     const ObjectValue *prototype(const ContextPtr &context) const | 
					
						
							|  |  |  |     { return prototype(context.data()); } | 
					
						
							| 
									
										
										
										
											2010-02-03 15:39:57 +01:00
										 |  |  |     void setPrototype(const Value *prototype); | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-24 11:10:01 +01:00
										 |  |  |     virtual void processMembers(MemberProcessor *processor) const; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-24 11:50:10 +02:00
										 |  |  |     virtual void setMember(const QString &name, const Value *value); | 
					
						
							|  |  |  |     virtual void removeMember(const QString &name); | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-17 14:20:06 +01:00
										 |  |  |     virtual const Value *lookupMember(const QString &name, const Context *context, | 
					
						
							|  |  |  |                                       const ObjectValue **foundInObject = 0, | 
					
						
							|  |  |  |                                       bool examinePrototypes = true) const; | 
					
						
							| 
									
										
										
										
											2011-07-13 15:04:27 +02:00
										 |  |  |     const Value *lookupMember(const QString &name, const ContextPtr &context, | 
					
						
							|  |  |  |                               const ObjectValue **foundInObject = 0, | 
					
						
							|  |  |  |                               bool examinePrototypes = true) const | 
					
						
							|  |  |  |     { return lookupMember(name, context.data(), foundInObject, examinePrototypes); } | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // Value interface
 | 
					
						
							|  |  |  |     virtual const ObjectValue *asObjectValue() const; | 
					
						
							|  |  |  |     virtual void accept(ValueVisitor *visitor) const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2010-01-24 11:10:01 +01:00
										 |  |  |     bool checkPrototype(const ObjectValue *prototype, QSet<const ObjectValue *> *processed) const; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     ValueOwner *_valueOwner; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  |     QHash<QString, const Value *> _members; | 
					
						
							|  |  |  |     QString _className; | 
					
						
							| 
									
										
										
										
											2011-02-10 14:53:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  |     const Value *_prototype; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-12 14:53:00 +01:00
										 |  |  | class QMLJS_EXPORT PrototypeIterator | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-05-20 13:19:16 +02:00
										 |  |  |     enum Error | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         NoError, | 
					
						
							|  |  |  |         ReferenceResolutionError, | 
					
						
							|  |  |  |         CycleError | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-12 14:53:00 +01:00
										 |  |  |     PrototypeIterator(const ObjectValue *start, const Context *context); | 
					
						
							| 
									
										
										
										
											2011-07-13 15:04:27 +02:00
										 |  |  |     PrototypeIterator(const ObjectValue *start, const ContextPtr &context); | 
					
						
							| 
									
										
										
										
											2010-11-12 14:53:00 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool hasNext(); | 
					
						
							|  |  |  |     const ObjectValue *peekNext(); | 
					
						
							|  |  |  |     const ObjectValue *next(); | 
					
						
							| 
									
										
										
										
											2011-05-20 13:19:16 +02:00
										 |  |  |     Error error() const; | 
					
						
							| 
									
										
										
										
											2010-11-12 14:53:00 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QList<const ObjectValue *> all(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     const ObjectValue *m_current; | 
					
						
							|  |  |  |     const ObjectValue *m_next; | 
					
						
							|  |  |  |     QList<const ObjectValue *> m_prototypes; | 
					
						
							|  |  |  |     const Context *m_context; | 
					
						
							| 
									
										
										
										
											2011-05-20 13:19:16 +02:00
										 |  |  |     Error m_error; | 
					
						
							| 
									
										
										
										
											2010-11-12 14:53:00 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-10 10:32:33 +02:00
										 |  |  | class CppComponentValue; | 
					
						
							| 
									
										
										
										
											2011-09-15 13:43:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-13 14:52:41 +02:00
										 |  |  | class QMLJS_EXPORT QmlEnumValue: public NumberValue | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-10-10 10:32:33 +02:00
										 |  |  |     QmlEnumValue(const CppComponentValue *owner, int index); | 
					
						
							| 
									
										
										
										
											2011-07-13 14:52:41 +02:00
										 |  |  |     virtual ~QmlEnumValue(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QString name() const; | 
					
						
							|  |  |  |     QStringList keys() const; | 
					
						
							| 
									
										
										
										
											2011-10-10 10:32:33 +02:00
										 |  |  |     const CppComponentValue *owner() const; | 
					
						
							| 
									
										
										
										
											2011-07-13 14:52:41 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2011-10-10 10:32:33 +02:00
										 |  |  |     const CppComponentValue *_owner; | 
					
						
							| 
									
										
										
										
											2011-09-15 13:43:34 +02:00
										 |  |  |     int _enumIndex; | 
					
						
							| 
									
										
										
										
											2011-07-13 14:52:41 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-10 14:53:57 +01:00
										 |  |  | // A ObjectValue based on a FakeMetaObject.
 | 
					
						
							| 
									
										
										
										
											2011-10-10 10:32:33 +02:00
										 |  |  | // May only have other CppComponentValue as ancestors.
 | 
					
						
							|  |  |  | class QMLJS_EXPORT CppComponentValue: public ObjectValue | 
					
						
							| 
									
										
										
										
											2010-01-26 14:50:52 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-03-01 13:01:05 +01:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-10-10 10:32:33 +02:00
										 |  |  |     CppComponentValue(LanguageUtils::FakeMetaObject::ConstPtr metaObject, const QString &className, | 
					
						
							| 
									
										
										
										
											2011-09-16 13:55:10 +02:00
										 |  |  |                    const QString &moduleName, const LanguageUtils::ComponentVersion &componentVersion, | 
					
						
							| 
									
										
										
										
											2011-09-21 12:42:27 +02:00
										 |  |  |                    const LanguageUtils::ComponentVersion &importVersion, int metaObjectRevision, | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |                    ValueOwner *valueOwner); | 
					
						
							| 
									
										
										
										
											2011-10-10 10:32:33 +02:00
										 |  |  |     virtual ~CppComponentValue(); | 
					
						
							| 
									
										
										
										
											2010-01-26 14:50:52 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     virtual void processMembers(MemberProcessor *processor) const; | 
					
						
							| 
									
										
										
										
											2011-10-05 14:14:35 +02:00
										 |  |  |     const Value *valueForCppName(const QString &typeName) const; | 
					
						
							| 
									
										
										
										
											2010-01-26 14:50:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-10 14:53:57 +01:00
										 |  |  |     using ObjectValue::prototype; | 
					
						
							| 
									
										
										
										
											2011-10-10 10:32:33 +02:00
										 |  |  |     const CppComponentValue *prototype() const; | 
					
						
							| 
									
										
										
										
											2011-02-10 14:53:57 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-10 10:32:33 +02:00
										 |  |  |     const CppComponentValue *attachedType() const; | 
					
						
							|  |  |  |     void setAttachedType(CppComponentValue *value); | 
					
						
							| 
									
										
										
										
											2011-02-10 17:03:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-10 14:53:57 +01:00
										 |  |  |     LanguageUtils::FakeMetaObject::ConstPtr metaObject() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 13:55:10 +02:00
										 |  |  |     QString moduleName() const; | 
					
						
							|  |  |  |     LanguageUtils::ComponentVersion componentVersion() const; | 
					
						
							|  |  |  |     LanguageUtils::ComponentVersion importVersion() const; | 
					
						
							| 
									
										
										
										
											2011-02-10 14:53:57 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-31 14:18:57 +02:00
										 |  |  |     QString defaultPropertyName() const; | 
					
						
							| 
									
										
										
										
											2010-04-06 11:44:55 +02:00
										 |  |  |     QString propertyType(const QString &propertyName) const; | 
					
						
							| 
									
										
										
										
											2010-04-06 12:56:53 +02:00
										 |  |  |     bool isListProperty(const QString &name) const; | 
					
						
							| 
									
										
										
										
											2010-11-11 10:29:32 +01:00
										 |  |  |     bool isWritable(const QString &propertyName) const; | 
					
						
							|  |  |  |     bool isPointer(const QString &propertyName) const; | 
					
						
							| 
									
										
										
										
											2010-11-11 10:46:19 +01:00
										 |  |  |     bool hasLocalProperty(const QString &typeName) const; | 
					
						
							|  |  |  |     bool hasProperty(const QString &typeName) const; | 
					
						
							| 
									
										
										
										
											2010-01-26 14:50:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-10 10:32:33 +02:00
										 |  |  |     LanguageUtils::FakeMetaEnum getEnum(const QString &typeName, const CppComponentValue **foundInScope = 0) const; | 
					
						
							|  |  |  |     const QmlEnumValue *getEnumValue(const QString &typeName, const CppComponentValue **foundInScope = 0) const; | 
					
						
							| 
									
										
										
										
											2011-10-05 14:14:35 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     const ObjectValue *signalScope(const QString &signalName) const; | 
					
						
							| 
									
										
										
										
											2010-02-01 13:54:44 +01:00
										 |  |  | protected: | 
					
						
							| 
									
										
										
										
											2011-01-04 17:04:44 +01:00
										 |  |  |     bool isDerivedFrom(LanguageUtils::FakeMetaObject::ConstPtr base) const; | 
					
						
							| 
									
										
										
										
											2010-02-01 13:54:44 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-26 14:50:52 +01:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2011-10-10 10:32:33 +02:00
										 |  |  |     CppComponentValue *_attachedType; | 
					
						
							| 
									
										
										
										
											2011-01-04 17:04:44 +01:00
										 |  |  |     LanguageUtils::FakeMetaObject::ConstPtr _metaObject; | 
					
						
							| 
									
										
										
										
											2011-09-16 13:55:10 +02:00
										 |  |  |     const QString _moduleName; | 
					
						
							|  |  |  |     // _componentVersion is the version of the export
 | 
					
						
							|  |  |  |     // _importVersion is the version it's imported as, used to find correct prototypes
 | 
					
						
							|  |  |  |     // needed in cases when B 1.0 has A 1.1 as prototype when imported as 1.1
 | 
					
						
							| 
									
										
										
										
											2010-12-03 11:17:25 +01:00
										 |  |  |     const LanguageUtils::ComponentVersion _componentVersion; | 
					
						
							| 
									
										
										
										
											2011-09-16 13:55:10 +02:00
										 |  |  |     const LanguageUtils::ComponentVersion _importVersion; | 
					
						
							| 
									
										
										
										
											2011-09-26 15:07:12 +02:00
										 |  |  |     mutable QAtomicPointer< QList<const Value *> > _metaSignatures; | 
					
						
							| 
									
										
										
										
											2011-10-05 14:14:35 +02:00
										 |  |  |     mutable QAtomicPointer< QHash<QString, const ObjectValue *> > _signalScopes; | 
					
						
							| 
									
										
										
										
											2011-07-13 14:52:41 +02:00
										 |  |  |     QHash<QString, const QmlEnumValue * > _enums; | 
					
						
							| 
									
										
										
										
											2011-09-21 12:42:27 +02:00
										 |  |  |     int _metaObjectRevision; | 
					
						
							| 
									
										
										
										
											2010-04-29 15:52:17 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-28 14:11:56 +01:00
										 |  |  | class QMLJS_EXPORT Activation | 
					
						
							| 
									
										
										
										
											2010-01-24 11:35:11 +01:00
										 |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2010-02-03 15:39:57 +01:00
										 |  |  |     explicit Activation(Context *parentContext = 0); | 
					
						
							| 
									
										
										
										
											2010-01-24 11:35:11 +01:00
										 |  |  |     virtual ~Activation(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-03 15:39:57 +01:00
										 |  |  |     Context *context() const; | 
					
						
							|  |  |  |     Context *parentContext() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-24 11:35:11 +01:00
										 |  |  |     bool calledAsConstructor() const; | 
					
						
							|  |  |  |     void setCalledAsConstructor(bool calledAsConstructor); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bool calledAsFunction() const; | 
					
						
							|  |  |  |     void setCalledAsFunction(bool calledAsFunction); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ObjectValue *thisObject() const; | 
					
						
							|  |  |  |     void setThisObject(ObjectValue *thisObject); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ValueList arguments() const; | 
					
						
							|  |  |  |     void setArguments(const ValueList &arguments); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     ObjectValue *_thisObject; | 
					
						
							|  |  |  |     ValueList _arguments; | 
					
						
							|  |  |  |     bool _calledAsFunction; | 
					
						
							| 
									
										
										
										
											2010-02-03 15:39:57 +01:00
										 |  |  |     Context *_parentContext; | 
					
						
							| 
									
										
										
										
											2010-01-24 11:35:11 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | class QMLJS_EXPORT FunctionValue: public ObjectValue | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     FunctionValue(ValueOwner *valueOwner); | 
					
						
							| 
									
										
										
										
											2010-01-24 11:10:01 +01:00
										 |  |  |     virtual ~FunctionValue(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // [[construct]]
 | 
					
						
							|  |  |  |     const Value *construct(const ValueList &actuals = ValueList()) const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // [[call]]
 | 
					
						
							|  |  |  |     const Value *call(const ValueList &actuals = ValueList()) const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const Value *call(const ObjectValue *thisObject, | 
					
						
							|  |  |  |                       const ValueList &actuals = ValueList()) const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     virtual const Value *returnValue() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual int argumentCount() const; | 
					
						
							| 
									
										
										
										
											2010-01-24 11:10:01 +01:00
										 |  |  |     virtual const Value *argument(int index) const; | 
					
						
							| 
									
										
										
										
											2010-01-26 10:50:30 +01:00
										 |  |  |     virtual QString argumentName(int index) const; | 
					
						
							|  |  |  |     virtual bool isVariadic() const; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-24 11:35:11 +01:00
										 |  |  |     virtual const Value *invoke(const Activation *activation) const; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // Value interface
 | 
					
						
							|  |  |  |     virtual const FunctionValue *asFunctionValue() const; | 
					
						
							|  |  |  |     virtual void accept(ValueVisitor *visitor) const; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class QMLJS_EXPORT Function: public FunctionValue | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     Function(ValueOwner *valueOwner); | 
					
						
							| 
									
										
										
										
											2010-01-24 11:35:11 +01:00
										 |  |  |     virtual ~Function(); | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-08 14:22:22 +02:00
										 |  |  |     void addArgument(const Value *argument, const QString &name = QString()); | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  |     void setReturnValue(const Value *returnValue); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // FunctionValue interface
 | 
					
						
							|  |  |  |     virtual const Value *returnValue() const; | 
					
						
							|  |  |  |     virtual int argumentCount() const; | 
					
						
							|  |  |  |     virtual const Value *argument(int index) const; | 
					
						
							| 
									
										
										
										
											2011-08-08 14:22:22 +02:00
										 |  |  |     virtual QString argumentName(int index) const; | 
					
						
							| 
									
										
										
										
											2010-01-24 11:35:11 +01:00
										 |  |  |     virtual const Value *invoke(const Activation *activation) const; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2010-01-24 11:10:01 +01:00
										 |  |  |     ValueList _arguments; | 
					
						
							| 
									
										
										
										
											2011-08-08 14:22:22 +02:00
										 |  |  |     QStringList _argumentNames; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  |     const Value *_returnValue; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // typing environment
 | 
					
						
							|  |  |  | ////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-09 14:27:30 +02:00
										 |  |  | class QMLJS_EXPORT CppQmlTypesLoader | 
					
						
							| 
									
										
										
										
											2010-03-01 13:01:05 +01:00
										 |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-06-28 12:01:56 +02:00
										 |  |  |     typedef QHash<QString, LanguageUtils::FakeMetaObject::ConstPtr> BuiltinObjects; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-30 11:10:06 +02:00
										 |  |  |     /** Loads a set of qmltypes files into the builtin objects list
 | 
					
						
							| 
									
										
										
										
											2011-05-30 12:56:24 +02:00
										 |  |  |         and returns errors and warnings | 
					
						
							| 
									
										
										
										
											2011-05-30 11:10:06 +02:00
										 |  |  |     */ | 
					
						
							| 
									
										
										
										
											2011-06-28 12:01:56 +02:00
										 |  |  |     static BuiltinObjects loadQmlTypes(const QFileInfoList &qmltypesFiles, | 
					
						
							| 
									
										
										
										
											2011-05-30 12:56:24 +02:00
										 |  |  |                              QStringList *errors, QStringList *warnings); | 
					
						
							| 
									
										
										
										
											2011-04-12 09:14:31 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-28 12:01:56 +02:00
										 |  |  |     static BuiltinObjects defaultQtObjects; | 
					
						
							|  |  |  |     static BuiltinObjects defaultLibraryObjects; | 
					
						
							| 
									
										
										
										
											2010-06-01 15:10:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-30 11:10:06 +02:00
										 |  |  |     // parses the contents of a qmltypes file and fills the newObjects map
 | 
					
						
							|  |  |  |     static void parseQmlTypeDescriptions( | 
					
						
							|  |  |  |         const QByteArray &qmlTypes, | 
					
						
							| 
									
										
										
										
											2011-06-28 12:01:56 +02:00
										 |  |  |         BuiltinObjects *newObjects, | 
					
						
							| 
									
										
										
										
											2011-05-30 11:10:06 +02:00
										 |  |  |         QString *errorMessage, QString *warningMessage); | 
					
						
							| 
									
										
										
										
											2010-06-01 15:10:20 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class QMLJS_EXPORT CppQmlTypes | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-09-16 13:55:10 +02:00
										 |  |  |     CppQmlTypes(ValueOwner *valueOwner); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-08 16:18:34 +01:00
										 |  |  |     // package name for objects that should be always available
 | 
					
						
							|  |  |  |     static const QLatin1String defaultPackage; | 
					
						
							|  |  |  |     // package name for objects with their raw cpp name
 | 
					
						
							|  |  |  |     static const QLatin1String cppPackage; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-08 13:22:34 +01:00
										 |  |  |     template <typename T> | 
					
						
							| 
									
										
										
										
											2011-09-16 13:55:10 +02:00
										 |  |  |     void load(const T &fakeMetaObjects, const QString &overridePackage = QString()); | 
					
						
							| 
									
										
										
										
											2010-03-16 16:34:33 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-10 10:32:33 +02:00
										 |  |  |     QList<const CppComponentValue *> createObjectsForImport(const QString &package, LanguageUtils::ComponentVersion version); | 
					
						
							| 
									
										
										
										
											2011-09-16 13:55:10 +02:00
										 |  |  |     bool hasModule(const QString &module) const; | 
					
						
							| 
									
										
										
										
											2010-06-09 14:27:30 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-16 13:55:10 +02:00
										 |  |  |     static QString qualifiedName(const QString &module, const QString &type, | 
					
						
							|  |  |  |                                  LanguageUtils::ComponentVersion version); | 
					
						
							| 
									
										
										
										
											2011-10-10 10:32:33 +02:00
										 |  |  |     const CppComponentValue *objectByQualifiedName(const QString &fullyQualifiedName) const; | 
					
						
							|  |  |  |     const CppComponentValue *objectByQualifiedName( | 
					
						
							| 
									
										
										
										
											2011-09-16 13:55:10 +02:00
										 |  |  |             const QString &package, const QString &type, | 
					
						
							|  |  |  |             LanguageUtils::ComponentVersion version) const; | 
					
						
							| 
									
										
										
										
											2011-10-10 10:32:33 +02:00
										 |  |  |     const CppComponentValue *objectByCppName(const QString &cppName) const; | 
					
						
							| 
									
										
										
										
											2010-10-19 16:15:32 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-01 13:01:05 +01:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2011-10-10 10:32:33 +02:00
										 |  |  |     // "Package.CppName ImportVersion" ->  CppComponentValue
 | 
					
						
							|  |  |  |     QHash<QString, const CppComponentValue *> _objectsByQualifiedName; | 
					
						
							| 
									
										
										
										
											2011-09-16 13:55:10 +02:00
										 |  |  |     QHash<QString, QSet<LanguageUtils::FakeMetaObject::ConstPtr> > _fakeMetaObjectsByPackage; | 
					
						
							|  |  |  |     ValueOwner *_valueOwner; | 
					
						
							| 
									
										
										
										
											2010-03-01 13:01:05 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | class ConvertToNumber: protected ValueVisitor // ECMAScript ToInt()
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     ConvertToNumber(ValueOwner *valueOwner); | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     const Value *operator()(const Value *value); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  |     const Value *switchResult(const Value *value); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual void visit(const NullValue *); | 
					
						
							|  |  |  |     virtual void visit(const UndefinedValue *); | 
					
						
							|  |  |  |     virtual void visit(const NumberValue *); | 
					
						
							|  |  |  |     virtual void visit(const BooleanValue *); | 
					
						
							|  |  |  |     virtual void visit(const StringValue *); | 
					
						
							|  |  |  |     virtual void visit(const ObjectValue *); | 
					
						
							|  |  |  |     virtual void visit(const FunctionValue *); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     ValueOwner *_valueOwner; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  |     const Value *_result; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ConvertToString: protected ValueVisitor // ECMAScript ToString
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     ConvertToString(ValueOwner *valueOwner); | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     const Value *operator()(const Value *value); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  |     const Value *switchResult(const Value *value); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual void visit(const NullValue *); | 
					
						
							|  |  |  |     virtual void visit(const UndefinedValue *); | 
					
						
							|  |  |  |     virtual void visit(const NumberValue *); | 
					
						
							|  |  |  |     virtual void visit(const BooleanValue *); | 
					
						
							|  |  |  |     virtual void visit(const StringValue *); | 
					
						
							|  |  |  |     virtual void visit(const ObjectValue *); | 
					
						
							|  |  |  |     virtual void visit(const FunctionValue *); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     ValueOwner *_valueOwner; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  |     const Value *_result; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ConvertToObject: protected ValueVisitor // ECMAScript ToObject
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     ConvertToObject(ValueOwner *valueOwner); | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     const Value *operator()(const Value *value); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  |     const Value *switchResult(const Value *value); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual void visit(const NullValue *); | 
					
						
							|  |  |  |     virtual void visit(const UndefinedValue *); | 
					
						
							|  |  |  |     virtual void visit(const NumberValue *); | 
					
						
							|  |  |  |     virtual void visit(const BooleanValue *); | 
					
						
							|  |  |  |     virtual void visit(const StringValue *); | 
					
						
							|  |  |  |     virtual void visit(const ObjectValue *); | 
					
						
							|  |  |  |     virtual void visit(const FunctionValue *); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     ValueOwner *_valueOwner; | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  |     const Value *_result; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-11 11:27:56 +01:00
										 |  |  | class QMLJS_EXPORT TypeId: protected ValueVisitor | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     QString _result; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     QString operator()(const Value *value); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  |     virtual void visit(const NullValue *); | 
					
						
							|  |  |  |     virtual void visit(const UndefinedValue *); | 
					
						
							|  |  |  |     virtual void visit(const NumberValue *); | 
					
						
							|  |  |  |     virtual void visit(const BooleanValue *); | 
					
						
							|  |  |  |     virtual void visit(const StringValue *); | 
					
						
							|  |  |  |     virtual void visit(const ObjectValue *object); | 
					
						
							|  |  |  |     virtual void visit(const FunctionValue *object); | 
					
						
							| 
									
										
										
										
											2010-02-23 17:02:50 +01:00
										 |  |  |     virtual void visit(const ColorValue *); | 
					
						
							|  |  |  |     virtual void visit(const AnchorLineValue *); | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-03 14:31:03 +01:00
										 |  |  | // internal
 | 
					
						
							| 
									
										
										
										
											2010-02-03 15:39:57 +01:00
										 |  |  | class QMLJS_EXPORT QmlPrototypeReference: public Reference | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     QmlPrototypeReference(AST::UiQualifiedId *qmlTypeName, const Document *doc, ValueOwner *valueOwner); | 
					
						
							| 
									
										
										
										
											2010-02-03 15:39:57 +01:00
										 |  |  |     virtual ~QmlPrototypeReference(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     AST::UiQualifiedId *qmlTypeName() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-08 15:36:06 +02:00
										 |  |  | private:     | 
					
						
							| 
									
										
										
										
											2011-09-12 11:48:33 +02:00
										 |  |  |     virtual const Value *value(ReferenceContext *referenceContext) const; | 
					
						
							| 
									
										
										
										
											2010-02-03 15:39:57 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     AST::UiQualifiedId *_qmlTypeName; | 
					
						
							| 
									
										
										
										
											2010-02-04 09:44:43 +01:00
										 |  |  |     const Document *_doc; | 
					
						
							| 
									
										
										
										
											2010-02-03 15:39:57 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-03 14:31:03 +01:00
										 |  |  | class QMLJS_EXPORT ASTVariableReference: public Reference | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     AST::VariableDeclaration *_ast; | 
					
						
							| 
									
										
										
										
											2011-07-12 14:55:27 +02:00
										 |  |  |     const Document *_doc; | 
					
						
							| 
									
										
										
										
											2010-02-03 14:31:03 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-07-12 14:55:27 +02:00
										 |  |  |     ASTVariableReference(AST::VariableDeclaration *ast, const Document *doc, ValueOwner *valueOwner); | 
					
						
							| 
									
										
										
										
											2010-02-03 14:31:03 +01:00
										 |  |  |     virtual ~ASTVariableReference(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-08 15:36:06 +02:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2011-09-12 11:48:33 +02:00
										 |  |  |     virtual const Value *value(ReferenceContext *referenceContext) const; | 
					
						
							| 
									
										
										
										
											2011-09-14 09:28:49 +02:00
										 |  |  |     virtual bool getSourceLocation(QString *fileName, int *line, int *column) const; | 
					
						
							| 
									
										
										
										
											2010-02-03 14:31:03 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class QMLJS_EXPORT ASTFunctionValue: public FunctionValue | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-11-16 13:53:39 +01:00
										 |  |  |     AST::FunctionExpression *_ast; | 
					
						
							| 
									
										
										
										
											2010-07-16 10:50:28 +02:00
										 |  |  |     const Document *_doc; | 
					
						
							| 
									
										
										
										
											2011-09-13 09:57:24 +02:00
										 |  |  |     QList<QString> _argumentNames; | 
					
						
							| 
									
										
										
										
											2010-02-03 14:31:03 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     ASTFunctionValue(AST::FunctionExpression *ast, const Document *doc, ValueOwner *valueOwner); | 
					
						
							| 
									
										
										
										
											2010-02-03 14:31:03 +01:00
										 |  |  |     virtual ~ASTFunctionValue(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-16 13:53:39 +01:00
										 |  |  |     AST::FunctionExpression *ast() const; | 
					
						
							| 
									
										
										
										
											2010-02-03 14:31:03 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     virtual const Value *returnValue() const; | 
					
						
							|  |  |  |     virtual int argumentCount() const; | 
					
						
							|  |  |  |     virtual const Value *argument(int) const; | 
					
						
							|  |  |  |     virtual QString argumentName(int index) const; | 
					
						
							|  |  |  |     virtual bool isVariadic() const; | 
					
						
							| 
									
										
										
										
											2010-07-16 10:50:28 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     virtual bool getSourceLocation(QString *fileName, int *line, int *column) const; | 
					
						
							| 
									
										
										
										
											2010-02-03 14:31:03 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-08 12:50:10 +01:00
										 |  |  | class QMLJS_EXPORT ASTPropertyReference: public Reference | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     AST::UiPublicMember *_ast; | 
					
						
							|  |  |  |     const Document *_doc; | 
					
						
							| 
									
										
										
										
											2010-02-17 09:16:28 +01:00
										 |  |  |     QString _onChangedSlotName; | 
					
						
							| 
									
										
										
										
											2010-02-08 12:50:10 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     ASTPropertyReference(AST::UiPublicMember *ast, const Document *doc, ValueOwner *valueOwner); | 
					
						
							| 
									
										
										
										
											2010-02-08 12:50:10 +01:00
										 |  |  |     virtual ~ASTPropertyReference(); | 
					
						
							| 
									
										
										
										
											2010-02-03 14:31:03 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-08 12:50:10 +01:00
										 |  |  |     AST::UiPublicMember *ast() const { return _ast; } | 
					
						
							| 
									
										
										
										
											2010-02-17 09:16:28 +01:00
										 |  |  |     QString onChangedSlotName() const { return _onChangedSlotName; } | 
					
						
							| 
									
										
										
										
											2010-02-08 12:50:10 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     virtual bool getSourceLocation(QString *fileName, int *line, int *column) const; | 
					
						
							| 
									
										
										
										
											2010-06-08 15:36:06 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2011-09-12 11:48:33 +02:00
										 |  |  |     virtual const Value *value(ReferenceContext *referenceContext) const; | 
					
						
							| 
									
										
										
										
											2010-02-08 12:50:10 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-13 14:29:47 +02:00
										 |  |  | class QMLJS_EXPORT ASTSignal: public FunctionValue | 
					
						
							| 
									
										
										
										
											2010-02-17 08:44:17 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     AST::UiPublicMember *_ast; | 
					
						
							|  |  |  |     const Document *_doc; | 
					
						
							|  |  |  |     QString _slotName; | 
					
						
							| 
									
										
										
										
											2011-10-05 14:14:35 +02:00
										 |  |  |     const ObjectValue *_bodyScope; | 
					
						
							| 
									
										
										
										
											2010-02-17 08:44:17 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-09-13 14:29:47 +02:00
										 |  |  |     ASTSignal(AST::UiPublicMember *ast, const Document *doc, ValueOwner *valueOwner); | 
					
						
							|  |  |  |     virtual ~ASTSignal(); | 
					
						
							| 
									
										
										
										
											2010-02-17 08:44:17 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     AST::UiPublicMember *ast() const { return _ast; } | 
					
						
							|  |  |  |     QString slotName() const { return _slotName; } | 
					
						
							| 
									
										
										
										
											2011-10-05 14:14:35 +02:00
										 |  |  |     const ObjectValue *bodyScope() const { return _bodyScope; } | 
					
						
							| 
									
										
										
										
											2010-02-17 08:44:17 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-13 14:29:47 +02:00
										 |  |  |     // FunctionValue interface
 | 
					
						
							|  |  |  |     virtual int argumentCount() const; | 
					
						
							|  |  |  |     virtual const Value *argument(int index) const; | 
					
						
							|  |  |  |     virtual QString argumentName(int index) const; | 
					
						
							| 
									
										
										
										
											2010-06-08 15:36:06 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-13 14:29:47 +02:00
										 |  |  |     // Value interface
 | 
					
						
							|  |  |  |     virtual bool getSourceLocation(QString *fileName, int *line, int *column) const; | 
					
						
							| 
									
										
										
										
											2010-02-17 08:44:17 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-08 12:50:10 +01:00
										 |  |  | class QMLJS_EXPORT ASTObjectValue: public ObjectValue | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     AST::UiQualifiedId *_typeName; | 
					
						
							|  |  |  |     AST::UiObjectInitializer *_initializer; | 
					
						
							|  |  |  |     const Document *_doc; | 
					
						
							|  |  |  |     QList<ASTPropertyReference *> _properties; | 
					
						
							| 
									
										
										
										
											2011-09-13 14:29:47 +02:00
										 |  |  |     QList<ASTSignal *> _signals; | 
					
						
							| 
									
										
										
										
											2010-05-31 12:21:12 +02:00
										 |  |  |     ASTPropertyReference *_defaultPropertyRef; | 
					
						
							| 
									
										
										
										
											2010-02-08 12:50:10 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     ASTObjectValue(AST::UiQualifiedId *typeName, | 
					
						
							|  |  |  |                    AST::UiObjectInitializer *initializer, | 
					
						
							|  |  |  |                    const Document *doc, | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |                    ValueOwner *valueOwner); | 
					
						
							| 
									
										
										
										
											2010-02-08 12:50:10 +01:00
										 |  |  |     virtual ~ASTObjectValue(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bool getSourceLocation(QString *fileName, int *line, int *column) const; | 
					
						
							|  |  |  |     virtual void processMembers(MemberProcessor *processor) const; | 
					
						
							| 
									
										
										
										
											2010-05-31 12:21:12 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     QString defaultPropertyName() const; | 
					
						
							| 
									
										
										
										
											2010-12-01 11:11:37 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     AST::UiObjectInitializer *initializer() const; | 
					
						
							|  |  |  |     AST::UiQualifiedId *typeName() const; | 
					
						
							|  |  |  |     const Document *document() const; | 
					
						
							| 
									
										
										
										
											2010-02-08 12:50:10 +01:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2010-02-03 14:31:03 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-16 15:29:37 +02:00
										 |  |  | class QMLJS_EXPORT ImportInfo | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     enum Type { | 
					
						
							|  |  |  |         InvalidImport, | 
					
						
							|  |  |  |         ImplicitDirectoryImport, | 
					
						
							|  |  |  |         LibraryImport, | 
					
						
							|  |  |  |         FileImport, | 
					
						
							|  |  |  |         DirectoryImport, | 
					
						
							| 
									
										
										
										
											2010-10-30 21:54:23 +02:00
										 |  |  |         UnknownFileImport // refers a file/directory that wasn't found
 | 
					
						
							| 
									
										
										
										
											2010-09-16 15:29:37 +02:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ImportInfo(); | 
					
						
							| 
									
										
										
										
											2011-09-27 15:12:22 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     static ImportInfo moduleImport(QString uri, LanguageUtils::ComponentVersion version, | 
					
						
							|  |  |  |                                    const QString &as, AST::UiImport *ast = 0); | 
					
						
							|  |  |  |     static ImportInfo pathImport(const QString &docPath, const QString &path, | 
					
						
							|  |  |  |                                  LanguageUtils::ComponentVersion version, | 
					
						
							|  |  |  |                                  const QString &as, AST::UiImport *ast = 0); | 
					
						
							|  |  |  |     static ImportInfo invalidImport(AST::UiImport *ast = 0); | 
					
						
							|  |  |  |     static ImportInfo implicitDirectoryImport(const QString &directory); | 
					
						
							| 
									
										
										
										
											2010-09-16 15:29:37 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool isValid() const; | 
					
						
							|  |  |  |     Type type() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-21 12:42:27 +02:00
										 |  |  |     // LibraryImport: uri with ',' separator
 | 
					
						
							|  |  |  |     // Other: non-absolute path
 | 
					
						
							| 
									
										
										
										
											2010-09-16 15:29:37 +02:00
										 |  |  |     QString name() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-21 12:42:27 +02:00
										 |  |  |     // LibraryImport: uri with QDir::separator separator
 | 
					
						
							|  |  |  |     // Other: absoluteFilePath
 | 
					
						
							|  |  |  |     QString path() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-16 15:29:37 +02:00
										 |  |  |     // null if the import has no 'as', otherwise the target id
 | 
					
						
							| 
									
										
										
										
											2011-09-27 15:12:22 +02:00
										 |  |  |     QString as() const; | 
					
						
							| 
									
										
										
										
											2010-09-16 15:29:37 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-03 11:17:25 +01:00
										 |  |  |     LanguageUtils::ComponentVersion version() const; | 
					
						
							| 
									
										
										
										
											2010-09-16 15:29:37 +02:00
										 |  |  |     AST::UiImport *ast() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     Type _type; | 
					
						
							|  |  |  |     QString _name; | 
					
						
							| 
									
										
										
										
											2011-09-21 12:42:27 +02:00
										 |  |  |     QString _path; | 
					
						
							| 
									
										
										
										
											2010-12-03 11:17:25 +01:00
										 |  |  |     LanguageUtils::ComponentVersion _version; | 
					
						
							| 
									
										
										
										
											2011-09-27 15:12:22 +02:00
										 |  |  |     QString _as; | 
					
						
							| 
									
										
										
										
											2010-09-16 15:29:37 +02:00
										 |  |  |     AST::UiImport *_ast; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-27 10:43:06 +02:00
										 |  |  | class QMLJS_EXPORT Import { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     Import(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // const!
 | 
					
						
							|  |  |  |     ObjectValue *object; | 
					
						
							|  |  |  |     ImportInfo info; | 
					
						
							|  |  |  |     // uri imports: path to library, else empty
 | 
					
						
							|  |  |  |     QString libraryPath; | 
					
						
							| 
									
										
										
										
											2011-09-29 11:48:13 +02:00
										 |  |  |     // whether the import succeeded
 | 
					
						
							|  |  |  |     bool valid; | 
					
						
							| 
									
										
										
										
											2011-05-27 10:43:06 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Imports; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class QMLJS_EXPORT TypeScope: public ObjectValue | 
					
						
							| 
									
										
										
										
											2010-09-16 15:29:37 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-05-12 15:29:00 +02:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     TypeScope(const Imports *imports, ValueOwner *valueOwner); | 
					
						
							| 
									
										
										
										
											2011-05-12 15:29:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-27 10:43:06 +02:00
										 |  |  |     virtual const Value *lookupMember(const QString &name, const Context *context, | 
					
						
							|  |  |  |                                       const ObjectValue **foundInObject = 0, | 
					
						
							|  |  |  |                                       bool examinePrototypes = true) const; | 
					
						
							|  |  |  |     virtual void processMembers(MemberProcessor *processor) const; | 
					
						
							| 
									
										
										
										
											2011-01-10 14:39:12 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-27 10:43:06 +02:00
										 |  |  | private: | 
					
						
							|  |  |  |     const Imports *_imports; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class QMLJS_EXPORT JSImportScope: public ObjectValue | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-09-16 15:29:37 +02:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     JSImportScope(const Imports *imports, ValueOwner *valueOwner); | 
					
						
							| 
									
										
										
										
											2010-09-16 15:29:37 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-17 14:20:06 +01:00
										 |  |  |     virtual const Value *lookupMember(const QString &name, const Context *context, | 
					
						
							|  |  |  |                                       const ObjectValue **foundInObject = 0, | 
					
						
							|  |  |  |                                       bool examinePrototypes = true) const; | 
					
						
							| 
									
										
										
										
											2010-09-16 15:29:37 +02:00
										 |  |  |     virtual void processMembers(MemberProcessor *processor) const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-27 10:43:06 +02:00
										 |  |  | private: | 
					
						
							|  |  |  |     const Imports *_imports; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class QMLJS_EXPORT Imports | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2011-07-01 12:11:02 +02:00
										 |  |  |     Imports(ValueOwner *valueOwner); | 
					
						
							| 
									
										
										
										
											2011-05-27 10:43:06 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     void append(const Import &import); | 
					
						
							| 
									
										
										
										
											2011-09-29 11:48:13 +02:00
										 |  |  |     void setImportFailed(); | 
					
						
							| 
									
										
										
										
											2011-05-27 10:43:06 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ImportInfo info(const QString &name, const Context *context) const; | 
					
						
							| 
									
										
										
										
											2011-09-19 13:04:59 +02:00
										 |  |  |     QString nameForImportedObject(const ObjectValue *value, const Context *context) const; | 
					
						
							| 
									
										
										
										
											2011-09-29 11:48:13 +02:00
										 |  |  |     bool importFailed() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-27 10:43:06 +02:00
										 |  |  |     QList<Import> all() const; | 
					
						
							| 
									
										
										
										
											2011-05-12 15:29:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-27 10:43:06 +02:00
										 |  |  |     const TypeScope *typeScope() const; | 
					
						
							|  |  |  |     const JSImportScope *jsImportScope() const; | 
					
						
							| 
									
										
										
										
											2011-04-20 10:46:04 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifdef QT_DEBUG
 | 
					
						
							|  |  |  |     void dump() const; | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2011-05-12 15:29:00 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     // holds imports in the order they appeared,
 | 
					
						
							|  |  |  |     // lookup order is back to front
 | 
					
						
							|  |  |  |     QList<Import> _imports; | 
					
						
							| 
									
										
										
										
											2011-05-27 10:43:06 +02:00
										 |  |  |     TypeScope *_typeScope; | 
					
						
							|  |  |  |     JSImportScope *_jsImportScope; | 
					
						
							| 
									
										
										
										
											2011-09-29 11:48:13 +02:00
										 |  |  |     bool _importFailed; | 
					
						
							| 
									
										
										
										
											2010-09-16 15:29:37 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-08 12:47:49 +02:00
										 |  |  | } // namespace QmlJS
 | 
					
						
							| 
									
										
										
										
											2010-01-21 15:54:19 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #endif // QMLJS_INTERPRETER_H
 |