QmlJS: Add variables and functions in a JS function to code model.

Allows completion of local variable and function names.

Task-number: QTCREATORBUG-942
Reviewed-by: Roberto Raggi
This commit is contained in:
Christian Kamm
2010-04-20 15:19:37 +02:00
parent f71049bee4
commit ce99372c63
3 changed files with 41 additions and 9 deletions

View File

@@ -32,12 +32,8 @@ void ScopeBuilder::push(AST::Node *node)
// JS scopes
if (FunctionDeclaration *fun = cast<FunctionDeclaration *>(node)) {
ObjectValue *activation = _context->engine()->newObject(/*prototype = */ 0);
for (FormalParameterList *it = fun->formals; it; it = it->next) {
if (it->name)
activation->setProperty(it->name->asString(), _context->engine()->undefinedValue());
}
_context->scopeChain().jsScopes += activation;
ObjectValue *functionScope = _doc->bind()->findFunctionScope(fun);
_context->scopeChain().jsScopes += functionScope;
}
_context->scopeChain().update();