Calls with closures parsed to a single node
This commit is contained in:
@@ -299,11 +299,11 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
advance(); // operation
|
advance(); // operation
|
||||||
expression.done(POSTFIX_EXPRESSION);
|
expression.done(POSTFIX_EXPRESSION);
|
||||||
} else if (parseCallWithClosure()) {
|
} else if (parseCallWithClosure()) {
|
||||||
while (parseCallWithClosure());
|
parseCallWithClosure();
|
||||||
expression.done(CALL_EXPRESSION);
|
expression.done(CALL_EXPRESSION);
|
||||||
} else if (at(LPAR)) {
|
} else if (at(LPAR)) {
|
||||||
parseValueArgumentList();
|
parseValueArgumentList();
|
||||||
while (parseCallWithClosure());
|
parseCallWithClosure();
|
||||||
expression.done(CALL_EXPRESSION);
|
expression.done(CALL_EXPRESSION);
|
||||||
} else if (at(LT)) {
|
} else if (at(LT)) {
|
||||||
// TODO: be (even) more clever
|
// TODO: be (even) more clever
|
||||||
@@ -357,11 +357,12 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
* expression functionLiteral?
|
* expression functionLiteral?
|
||||||
*/
|
*/
|
||||||
protected boolean parseCallWithClosure() {
|
protected boolean parseCallWithClosure() {
|
||||||
if (!myBuilder.newlineBeforeCurrentToken() && at(LBRACE)) {
|
boolean success = false;
|
||||||
|
while (!myBuilder.newlineBeforeCurrentToken() && at(LBRACE)) {
|
||||||
parseFunctionLiteral();
|
parseFunctionLiteral();
|
||||||
return true;
|
success = true;
|
||||||
}
|
}
|
||||||
return false;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -3,4 +3,5 @@ val a = f {} {} {}
|
|||||||
val a = f {}
|
val a = f {}
|
||||||
val a = f() {}
|
val a = f() {}
|
||||||
val a = (f) {} {} {}
|
val a = (f) {} {} {}
|
||||||
val a = (f)() {} {} {}
|
val a = (f)() {} {} {}
|
||||||
|
val a = (f)<A>() {} {} {}
|
||||||
@@ -159,6 +159,49 @@ JetFile: CallWithManyClosures.jet
|
|||||||
<empty list>
|
<empty list>
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
BODY
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
PROPERTY
|
||||||
|
PsiElement(val)('val')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(EQ)('=')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
CALL_EXPRESSION
|
||||||
|
PARENTHESIZED
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('f')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
TYPE_ARGUMENT_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
TYPE_PROJECTION
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('A')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
VALUE_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
BODY
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
BODY
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
FUNCTION_LITERAL
|
FUNCTION_LITERAL
|
||||||
PsiElement(LBRACE)('{')
|
PsiElement(LBRACE)('{')
|
||||||
BODY
|
BODY
|
||||||
|
|||||||
Reference in New Issue
Block a user