forked from qt-creator/qt-creator
QmlJS: Make variables in imported JS documents show up in completion.
Filtering them out has long since become unnecessary. It was used back when JS files were sourced from Script elements - there they'd only make the functions available. Now functions and variables are imported. Task-number: QTCREATORBUG-1735 Reviewed-by: Erik Verbruggen
This commit is contained in:
@@ -1385,7 +1385,6 @@ QList<const ObjectValue *> ScopeChain::all() const
|
||||
|
||||
Context::Context(Engine *engine)
|
||||
: _engine(engine),
|
||||
_lookupMode(JSLookup),
|
||||
_qmlScopeObjectIndex(-1),
|
||||
_qmlScopeObjectSet(false)
|
||||
{
|
||||
@@ -1410,16 +1409,6 @@ ScopeChain &Context::scopeChain()
|
||||
return _scopeChain;
|
||||
}
|
||||
|
||||
Context::LookupMode Context::lookupMode() const
|
||||
{
|
||||
return _lookupMode;
|
||||
}
|
||||
|
||||
void Context::setLookupMode(LookupMode lookupMode)
|
||||
{
|
||||
_lookupMode = lookupMode;
|
||||
}
|
||||
|
||||
const ObjectValue *Context::typeEnvironment(const QmlJS::Document *doc) const
|
||||
{
|
||||
return _typeEnvironments.value(doc->fileName(), 0);
|
||||
@@ -1437,11 +1426,9 @@ const Value *Context::lookup(const QString &name)
|
||||
const ObjectValue *scope = scopes.at(index);
|
||||
|
||||
if (const Value *member = scope->lookupMember(name, this)) {
|
||||
if (_lookupMode == JSLookup || ! dynamic_cast<const ASTVariableReference *>(member)) {
|
||||
return member;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _engine->undefinedValue();
|
||||
}
|
||||
|
||||
@@ -270,12 +270,6 @@ private:
|
||||
|
||||
class QMLJS_EXPORT Context
|
||||
{
|
||||
public:
|
||||
enum LookupMode {
|
||||
JSLookup,
|
||||
QmlLookup
|
||||
};
|
||||
|
||||
public:
|
||||
Context(Engine *engine);
|
||||
~Context();
|
||||
@@ -284,9 +278,6 @@ public:
|
||||
const ScopeChain &scopeChain() const;
|
||||
ScopeChain &scopeChain();
|
||||
|
||||
LookupMode lookupMode() const;
|
||||
void setLookupMode(LookupMode lookupMode);
|
||||
|
||||
const ObjectValue *typeEnvironment(const Document *doc) const;
|
||||
void setTypeEnvironment(const Document *doc, const ObjectValue *typeEnvironment);
|
||||
|
||||
@@ -307,7 +298,6 @@ private:
|
||||
typedef QHash<QString, const Value *> Properties;
|
||||
|
||||
Engine *_engine;
|
||||
LookupMode _lookupMode;
|
||||
QHash<const ObjectValue *, Properties> _properties;
|
||||
QHash<QString, const ObjectValue *> _typeEnvironments;
|
||||
QSet<QString> _documentsImportingPlugins;
|
||||
|
||||
@@ -54,8 +54,6 @@ void Link::initializeScopeChain()
|
||||
QHash<Document *, ScopeChain::QmlComponentChain *> componentScopes;
|
||||
|
||||
if (_doc->qmlProgram()) {
|
||||
_context->setLookupMode(Context::QmlLookup);
|
||||
|
||||
scopeChain.qmlComponentScope.clear();
|
||||
componentScopes.insert(_doc.data(), &scopeChain.qmlComponentScope);
|
||||
makeComponentChain(_doc, &scopeChain.qmlComponentScope, &componentScopes);
|
||||
|
||||
@@ -208,8 +208,6 @@ public:
|
||||
private:
|
||||
void insertProperty(const QString &name, const Interpreter::Value *value)
|
||||
{
|
||||
if (_context->lookupMode() == Interpreter::Context::JSLookup ||
|
||||
! dynamic_cast<const Interpreter::ASTVariableReference *>(value))
|
||||
_properties.insert(name, value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user