qmljs: exposing a bit more the existence of private value types

Change-Id: I85e29b0d60234407561ecbeb2883d68c1acb71d6
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
Fawzi Mohamed
2014-05-21 16:13:09 +02:00
parent 56080c4df2
commit 35128701cd
3 changed files with 148 additions and 10 deletions

View File

@@ -133,6 +133,10 @@ public:
}
};
} // end of anonymous namespace
namespace QmlJS {
namespace Internal {
class MetaFunction: public FunctionValue
{
FakeMetaMethod _method;
@@ -160,9 +164,13 @@ public:
{
return false;
}
const MetaFunction *asMetaFunction() const
{
return this;
}
};
} // end of anonymous namespace
} // namespace Internal
} // namespace QmlJS
CppComponentValue::CppComponentValue(FakeMetaObject::ConstPtr metaObject, const QString &className,
const QString &packageName, const ComponentVersion &componentVersion,
@@ -238,7 +246,7 @@ void CppComponentValue::processMembers(MemberProcessor *processor) const
signatures = new QList<const Value *>;
signatures->reserve(_metaObject->methodCount());
for (int index = 0; index < _metaObject->methodCount(); ++index)
signatures->append(new MetaFunction(_metaObject->method(index), valueOwner()));
signatures->append(new Internal::MetaFunction(_metaObject->method(index), valueOwner()));
if (!_metaSignatures.testAndSetOrdered(0, signatures)) {
delete signatures;
#if QT_VERSION >= 0x050000
@@ -752,11 +760,46 @@ const ASTPropertyReference *Value::asAstPropertyReference() const
return 0;
}
const ASTVariableReference *Value::asAstVariableReference() const
{
return 0;
}
const Internal::QtObjectPrototypeReference *Value::asQtObjectPrototypeReference() const
{
return 0;
}
const ASTSignal *Value::asAstSignal() const
{
return 0;
}
const ASTFunctionValue *Value::asAstFunctionValue() const
{
return 0;
}
const Function *Value::asFunction() const
{
return 0;
}
const Internal::MetaFunction *Value::asMetaFunction() const
{
return 0;
}
const JSImportScope *Value::asJSImportScope() const
{
return 0;
}
const TypeScope *Value::asTypeScope() const
{
return 0;
}
////////////////////////////////////////////////////////////////////////////////
// Values
////////////////////////////////////////////////////////////////////////////////
@@ -1246,6 +1289,11 @@ bool Function::isVariadic() const
return _isVariadic;
}
const Function *Function::asFunction() const
{
return this;
}
////////////////////////////////////////////////////////////////////////////////
// typing environment
////////////////////////////////////////////////////////////////////////////////
@@ -1827,6 +1875,16 @@ ASTVariableReference::~ASTVariableReference()
{
}
const ASTVariableReference *ASTVariableReference::asAstVariableReference() const
{
return this;
}
const VariableDeclaration *ASTVariableReference::ast() const
{
return _ast;
}
const Value *ASTVariableReference::value(ReferenceContext *referenceContext) const
{
// may be assigned to later
@@ -1923,6 +1981,11 @@ bool ASTFunctionValue::isVariadic() const
return _isVariadic;
}
const ASTFunctionValue *ASTFunctionValue::asAstFunctionValue() const
{
return this;
}
bool ASTFunctionValue::getSourceLocation(QString *fileName, int *line, int *column) const
{
*fileName = _doc->fileName();
@@ -2254,6 +2317,11 @@ void TypeScope::processMembers(MemberProcessor *processor) const
}
}
const TypeScope *TypeScope::asTypeScope() const
{
return this;
}
JSImportScope::JSImportScope(const Imports *imports, ValueOwner *valueOwner)
: ObjectValue(valueOwner)
, _imports(imports)
@@ -2300,6 +2368,11 @@ void JSImportScope::processMembers(MemberProcessor *processor) const
}
}
const JSImportScope *JSImportScope::asJSImportScope() const
{
return this;
}
Imports::Imports(ValueOwner *valueOwner)
: _typeScope(new TypeScope(this, valueOwner))
, _jsImportScope(new JSImportScope(this, valueOwner))