Stop parsing lambdas with deprecated syntax

This commit is contained in:
Denis Zharkov
2015-09-23 12:48:30 +03:00
parent 79ac436b9f
commit 5f69789636
15 changed files with 628 additions and 1629 deletions
+1 -3
View File
@@ -22,11 +22,9 @@ typealias Function1<in T, out R> = (input : T) -> R
//type Function1<in T, out R> = {(input : T) => R}
val f1 = {(t : T) : X -> something(t)}
fun f1(t : T) : X = something(t)
val f1 = {(t : T) -> something(t)}
val f1 = {(T) : X -> something(it)}
val f1 = {t : T -> something(t)}
val f1 = {t -> something(t)}
val f1 = {something(it)}
-83
View File
@@ -407,50 +407,6 @@ JetFile: FunctionsAndTypes.kt
PsiWhiteSpace('\n')
PsiComment(EOL_COMMENT)('//type Function1<in T, out R> = {(input : T) => R}')
PsiWhiteSpace('\n\n\n')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('f1')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
FUNCTION_LITERAL_EXPRESSION
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('t')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('X')
PsiWhiteSpace(' ')
PsiElement(ARROW)('->')
PsiWhiteSpace(' ')
BLOCK
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('something')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('t')
PsiElement(RPAR)(')')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
@@ -498,7 +454,6 @@ JetFile: FunctionsAndTypes.kt
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('t')
PsiWhiteSpace(' ')
@@ -508,7 +463,6 @@ JetFile: FunctionsAndTypes.kt
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('T')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(ARROW)('->')
PsiWhiteSpace(' ')
@@ -524,43 +478,6 @@ JetFile: FunctionsAndTypes.kt
PsiElement(RPAR)(')')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('f1')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
FUNCTION_LITERAL_EXPRESSION
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('T')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('X')
PsiWhiteSpace(' ')
PsiElement(ARROW)('->')
PsiWhiteSpace(' ')
BLOCK
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('something')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('it')
PsiElement(RPAR)(')')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
+1 -1
View File
@@ -1,3 +1,3 @@
fun foo() {
l filter {it.x} map {it.foo} aggregate {(a, b) -> a + b}
l filter {it.x} map {it.foo} aggregate {a, b -> a + b}
}
-2
View File
@@ -57,14 +57,12 @@ JetFile: LINQ.kt
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('a')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('b')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(ARROW)('->')
PsiWhiteSpace(' ')
+1 -1
View File
@@ -10,7 +10,7 @@ enum class ComparisonResult {
typealias MatchableComparison<in T> = (T, T) -> ComparisonResult
fun asMatchableComparison<T>(cmp : Comparison<T>) : MatchableComparison<T> = {(a, b) ->
fun asMatchableComparison<T>(cmp : Comparison<T>) : MatchableComparison<T> = {a, b ->
val res = cmp(a, b)
if (res == 0) return ComparisonResult.EQ
if (res < 0) return ComparisonResult.LS
-2
View File
@@ -324,14 +324,12 @@ JetFile: Comparison.kt
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('a')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('b')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(ARROW)('->')
PsiWhiteSpace('\n ')