enhancement: Support lambda expression without a parameter list.
This commit is contained in:
parent
f59462025f
commit
3887b9387d
|
@ -2905,14 +2905,18 @@ void CppParser::handleLambda(int index, int maxIndex)
|
||||||
QSet<QString> captures = parseLambdaCaptures(index);
|
QSet<QString> captures = parseLambdaCaptures(index);
|
||||||
int startLine=mTokenizer[index]->line;
|
int startLine=mTokenizer[index]->line;
|
||||||
int argStart=index+1;
|
int argStart=index+1;
|
||||||
if (mTokenizer[argStart]->text!='(')
|
int argEnd, bodyStart;
|
||||||
return;
|
if (mTokenizer[argStart]->text == '(' ) {
|
||||||
int argEnd= mTokenizer[argStart]->matchIndex;
|
argEnd = mTokenizer[argStart]->matchIndex;
|
||||||
//TODO: parse captures
|
bodyStart=indexOfNextLeftBrace(argEnd+1, maxIndex);
|
||||||
int bodyStart=indexOfNextLeftBrace(argEnd+1, maxIndex);
|
|
||||||
if (bodyStart>=maxIndex) {
|
if (bodyStart>=maxIndex) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else if (mTokenizer[argStart]->text == '{') {
|
||||||
|
argEnd = argStart;
|
||||||
|
bodyStart = argStart;
|
||||||
|
} else
|
||||||
|
return;
|
||||||
int bodyEnd = mTokenizer[bodyStart]->matchIndex;
|
int bodyEnd = mTokenizer[bodyStart]->matchIndex;
|
||||||
if (bodyEnd>maxIndex) {
|
if (bodyEnd>maxIndex) {
|
||||||
return;
|
return;
|
||||||
|
@ -2931,6 +2935,7 @@ void CppParser::handleLambda(int index, int maxIndex)
|
||||||
StatementAccessibility::None,
|
StatementAccessibility::None,
|
||||||
StatementProperty::HasDefinition);
|
StatementProperty::HasDefinition);
|
||||||
lambdaBlock->lambdaCaptures = captures;
|
lambdaBlock->lambdaCaptures = captures;
|
||||||
|
if (argEnd > argStart)
|
||||||
scanMethodArgs(lambdaBlock,argStart);
|
scanMethodArgs(lambdaBlock,argStart);
|
||||||
addSoloScopeLevel(lambdaBlock,mTokenizer[bodyStart]->line);
|
addSoloScopeLevel(lambdaBlock,mTokenizer[bodyStart]->line);
|
||||||
int oldIndex = mIndex;
|
int oldIndex = mIndex;
|
||||||
|
|
Loading…
Reference in New Issue