Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-Andre Laperle2018-09-22 03:04:30 +0000
committerMarc-André Laperle2018-10-03 00:55:48 +0000
commit0b73bea05a4c477bc6bde78f7f23ac2a8c693a20 (patch)
tree44c14a52b22085c5daf02407cff0a2d14af925c7
parent467dd174c3697021f102cdd7bb24a9b459869792 (diff)
downloadorg.eclipse.cdt-0b73bea05a4c477bc6bde78f7f23ac2a8c693a20.tar.gz
org.eclipse.cdt-0b73bea05a4c477bc6bde78f7f23ac2a8c693a20.tar.xz
org.eclipse.cdt-0b73bea05a4c477bc6bde78f7f23ac2a8c693a20.zip
Bug 518271 - NPE when using Toggle function on a function containing a lambda expression
Change-Id: I441a627b0759655e865724bf5110fdb7dd8d5a50 Signed-off-by: Marc-Andre Laperle <malaperle@gmail.com>
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/togglefunction/ToggleRefactoringTest.java21
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/InsertionPointFinder.java4
2 files changed, 25 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/togglefunction/ToggleRefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/togglefunction/ToggleRefactoringTest.java
index 4f6774f9617..d41289a42ef 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/togglefunction/ToggleRefactoringTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/togglefunction/ToggleRefactoringTest.java
@@ -3627,4 +3627,25 @@ public class ToggleRefactoringTest extends RefactoringTestBase {
public void testToggleWithVirtSpecifiersImplementationToClass_518273() throws Exception {
assertRefactoringSuccess();
}
+
+ //Test.h
+ //class Foo {
+ // void /*$*/foo/*$$*/() {
+ // []() {
+ //
+ // };
+ // }
+ //};
+ //====================
+ //class Foo {
+ // void foo();
+ //};
+ //
+ //inline void Foo::foo() {
+ // []() {
+ // };
+ //}
+ public void testToggleWithLambdaExpression_518271() throws Exception {
+ assertRefactoringSuccess();
+ }
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/InsertionPointFinder.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/InsertionPointFinder.java
index f3396ef650e..5d45275ae10 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/InsertionPointFinder.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/togglefunction/InsertionPointFinder.java
@@ -48,6 +48,10 @@ public class InsertionPointFinder {
if (allafterdeclarations == null || alldefinitionsoutside == null)
return;
for(ICPPASTFunctionDeclarator decl: allafterdeclarations) {
+ if (decl.getName() == null) {
+ // Could be a lambda expression
+ continue;
+ }
String decl_name = decl.getName().toString();
for(ICPPASTFunctionDefinition def: alldefinitionsoutside) {
String def_name = null;

Back to the top