Commit 123607ad authored by Christian Kamm's avatar Christian Kamm
Browse files

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
parent 11a08a25
......@@ -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,9 +1426,7 @@ 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 member;
}
}
......
......@@ -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,9 +208,7 @@ 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);
_properties.insert(name, value);
}
virtual bool processProperty(const QString &name, const Interpreter::Value *value)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment