mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
Bug 486679 - Syntax coloring for local variable in lambda capture
Change-Id: Ia7aeae84210d0ce56f28d224099e6bc5f5dbf1a2
This commit is contained in:
parent
eb54f64445
commit
f9375840ed
3 changed files with 20 additions and 1 deletions
|
@ -12,6 +12,7 @@ package org.eclipse.cdt.core.dom.ast.cpp;
|
|||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
|
||||
/**
|
||||
|
@ -21,7 +22,7 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
|||
* @noextend This interface is not intended to be extended by clients.
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface ICPPASTCapture extends IASTNode, ICPPASTPackExpandable {
|
||||
public interface ICPPASTCapture extends IASTNode, ICPPASTPackExpandable, IASTNameOwner {
|
||||
ASTNodeProperty IDENTIFIER = new ASTNodeProperty("ICPPASTCapture - IDENTIFIER [IASTName]"); //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
|
|
|
@ -101,4 +101,14 @@ public class CPPASTCapture extends ASTNode implements ICPPASTCapture {
|
|||
assertNotFrozen();
|
||||
fPackExpansion= val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRoleForName(IASTName name) {
|
||||
if (name == fIdentifier) {
|
||||
// Treat the capture as a reference to the captured variable.
|
||||
// This choice may be revisited when C++14 init-captures are implemented.
|
||||
return r_reference;
|
||||
}
|
||||
return r_unclear;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -483,4 +483,12 @@ public class SemanticHighlightingTest extends TestCase {
|
|||
public void testInheritingConstructor_484898() throws Exception {
|
||||
makeAssertions();
|
||||
}
|
||||
|
||||
// void foo(int param) { //$functionDeclaration,parameterVariable
|
||||
// int local; //$localVariableDeclaration
|
||||
// [local, param](){}; //$class,localVariable,parameterVariable
|
||||
// }
|
||||
public void testLocalVariableInLambdaCapture_486679() throws Exception {
|
||||
makeAssertions();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue