Attributes on patterns tested
This commit is contained in:
@@ -4,7 +4,6 @@ when
|
|||||||
"}"
|
"}"
|
||||||
;
|
;
|
||||||
|
|
||||||
// TODO: attributes for when entries?
|
|
||||||
whenEntry
|
whenEntry
|
||||||
: whenConditionIf{","} (when | "=>" expression SEMI)
|
: whenConditionIf{","} (when | "=>" expression SEMI)
|
||||||
: "else" ("continue" | "=>" expression SEMI)
|
: "else" ("continue" | "=>" expression SEMI)
|
||||||
|
|||||||
@@ -444,7 +444,6 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: attributes for when entries?
|
|
||||||
* whenEntry
|
* whenEntry
|
||||||
* : whenConditionIf{","} (when | "=>" expression SEMI)
|
* : whenConditionIf{","} (when | "=>" expression SEMI)
|
||||||
* : "else" ("continue" | "=>" expression SEMI)
|
* : "else" ("continue" | "=>" expression SEMI)
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
fun foo() {
|
||||||
|
|
||||||
|
when (e) {
|
||||||
|
is [a] =2 => d
|
||||||
|
is [a] 2 => d
|
||||||
|
is [a] T => d
|
||||||
|
is [a] T() => d
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
JetFile: AttributesOnPatterns.jet
|
||||||
|
NAMESPACE
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
<empty list>
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
WHEN
|
||||||
|
PsiElement(when)('when')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('e')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
WHEN_ENTRY
|
||||||
|
WHEN_CONDITION
|
||||||
|
PsiElement(is)('is')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
EXPRESSION_PATTERN
|
||||||
|
ATTRIBUTE_ANNOTATION
|
||||||
|
PsiElement(LBRACKET)('[')
|
||||||
|
ATTRIBUTE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiElement(RBRACKET)(']')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(EQ)('=')
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('2')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('d')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
WHEN_ENTRY
|
||||||
|
WHEN_CONDITION
|
||||||
|
PsiElement(is)('is')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
EXPRESSION_PATTERN
|
||||||
|
ATTRIBUTE_ANNOTATION
|
||||||
|
PsiElement(LBRACKET)('[')
|
||||||
|
ATTRIBUTE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiElement(RBRACKET)(']')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('2')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('d')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
WHEN_ENTRY
|
||||||
|
WHEN_CONDITION
|
||||||
|
PsiElement(is)('is')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PATTERN
|
||||||
|
ATTRIBUTE_ANNOTATION
|
||||||
|
PsiElement(LBRACKET)('[')
|
||||||
|
ATTRIBUTE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiElement(RBRACKET)(']')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('d')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
WHEN_ENTRY
|
||||||
|
WHEN_CONDITION
|
||||||
|
PsiElement(is)('is')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
DECOMPOSER_PATTERN
|
||||||
|
ATTRIBUTE_ANNOTATION
|
||||||
|
PsiElement(LBRACKET)('[')
|
||||||
|
ATTRIBUTE
|
||||||
|
TYPE_REFERENCE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiElement(RBRACKET)(']')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('T')
|
||||||
|
DECOMPOSER_ARGUMENT_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('d')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
Reference in New Issue
Block a user