Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
KDevelop PHP Support
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KDevelop
KDevelop PHP Support
Commits
893d7c8d
Commit
893d7c8d
authored
Jan 03, 2020
by
Heinz Wiesinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix uses of function call parameters after closures
parent
54964af0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
1 deletion
+33
-1
duchain/builders/contextbuilder.cpp
duchain/builders/contextbuilder.cpp
+7
-0
duchain/builders/contextbuilder.h
duchain/builders/contextbuilder.h
+2
-0
duchain/expressionvisitor.cpp
duchain/expressionvisitor.cpp
+0
-1
duchain/tests/uses.cpp
duchain/tests/uses.cpp
+23
-0
duchain/tests/uses.h
duchain/tests/uses.h
+1
-0
No files found.
duchain/builders/contextbuilder.cpp
View file @
893d7c8d
...
...
@@ -492,6 +492,13 @@ void ContextBuilder::visitUnaryExpression(UnaryExpressionAst* node)
}
}
void
ContextBuilder
::
visitFunctionCallParameterListElement
(
FunctionCallParameterListElementAst
*
node
)
{
DefaultVisitor
::
visitFunctionCallParameterListElement
(
node
);
setContextOnNode
(
node
,
currentContext
());
}
void
ContextBuilder
::
reportError
(
const
QString
&
errorMsg
,
AstNode
*
node
,
IProblem
::
Severity
severity
)
{
reportError
(
errorMsg
,
m_editor
->
findRange
(
node
),
severity
);
...
...
duchain/builders/contextbuilder.h
View file @
893d7c8d
...
...
@@ -84,6 +84,8 @@ protected:
void
visitFunctionDeclarationStatement
(
FunctionDeclarationStatementAst
*
node
)
override
;
void
visitClosure
(
ClosureAst
*
node
)
override
;
void
visitUnaryExpression
(
UnaryExpressionAst
*
node
)
override
;
void
visitFunctionCallParameterListElement
(
FunctionCallParameterListElementAst
*
node
)
override
;
/**
* don't overload in other builders, use @c openNamespace and @c closeNamespace instead.
*/
...
...
duchain/expressionvisitor.cpp
View file @
893d7c8d
...
...
@@ -826,7 +826,6 @@ void ExpressionVisitor::visitClassNameReference(ClassNameReferenceAst* node)
}
while
(
it
->
hasNext
()
&&
(
it
=
it
->
next
));
}
}
}
void
ExpressionVisitor
::
visitClassNameReferenceDimListItems
(
ClassPropertyAst
*
node
)
...
...
duchain/tests/uses.cpp
View file @
893d7c8d
...
...
@@ -88,6 +88,29 @@ void TestUses::functionCall()
QCOMPARE
(
fun
->
uses
().
keys
().
first
(),
IndexedString
(
QUrl
(
"file:///internal/usestest/functionCall.php"
)));
}
void
TestUses
::
functionCallWithClosureArgs
()
{
// 0 1 2 3 4 5 6 7 8 9
// 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
QByteArray
method
(
"<? function foo($a, $b) {} $c = []; $d = []; foo(function ($x) use ($c) { return $c[$x]; }, $d); "
);
TopDUContext
*
top
=
parse
(
method
,
DumpNone
);
DUChainReleaser
releaseTop
(
top
);
DUChainWriteLocker
lock
(
DUChain
::
lock
());
// foo
Declaration
*
fun
=
top
->
localDeclarations
().
first
();
compareUses
(
fun
,
RangeInRevision
(
0
,
45
,
0
,
48
));
// $c
Declaration
*
c
=
top
->
localDeclarations
().
at
(
1
);
compareUses
(
c
,
QList
<
RangeInRevision
>
()
<<
RangeInRevision
(
0
,
68
,
0
,
70
)
<<
RangeInRevision
(
0
,
81
,
0
,
83
));
// $d
Declaration
*
d
=
top
->
localDeclarations
().
at
(
2
);
compareUses
(
d
,
RangeInRevision
(
0
,
92
,
0
,
94
));
}
void
TestUses
::
memberFunctionCall
()
{
...
...
duchain/tests/uses.h
View file @
893d7c8d
...
...
@@ -33,6 +33,7 @@ public:
private
slots
:
void
newObject
();
void
functionCall
();
void
functionCallWithClosureArgs
();
void
memberFunctionCall
();
void
unsureMemberFunctionCall
();
void
memberVariable
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment