Commit 0fc595cf authored by Denis Steckelmacher's avatar Denis Steckelmacher

Make visible in a slot the parameters of its corresponding signal

parent 316c3e47
......@@ -861,6 +861,22 @@ bool DeclarationBuilder::visit(QmlJS::AST::UiScriptBinding* node)
m_session->locationsToInnerRange(block->lbraceToken, block->rbraceToken),
DUContext::Other
);
// If this script binding is a slot, import the parameters of its signal
DeclarationPointer bindingDecl = QmlJS::getDeclarationOrSignal(
QualifiedIdentifier(bindingName),
currentContext()
);
if (bindingDecl) {
auto signal = bindingDecl.dynamicCast<ClassFunctionDeclaration>();
if (signal && signal->isSignal() && signal->internalFunctionContext()) {
DUChainWriteLocker lock;
currentContext()->addImportedParentContext(signal->internalFunctionContext());
}
}
}
return DeclarationBuilderBase::visit(node);
......
......@@ -50,7 +50,19 @@ Text {
* "toString" : "void test (int, int)",
* "useCount" : 1
*/
signal test(int a, int b)
signal test(
/**
* "toString" : "int a",
* "useCount" : 1
*/
int a,
/**
* "toString" : "int b",
* "useCount" : 0
*/
int b
)
signal test2
/**
......@@ -91,5 +103,6 @@ Text {
}
onTest: {
a = 3;
}
}
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