JET-174 Make continue work the same way in all contexts inside when

Guards are removed. Continue is not supported yet.
This commit is contained in:
Andrey Breslav
2011-07-07 17:18:29 +04:00
parent 026eadda7a
commit 704f153a31
9 changed files with 45 additions and 139 deletions
+1 -4
View File
@@ -10,14 +10,13 @@ fun foo() {
fun foo() {
when (e) {
}
when (e) {
is a => foo
}
when (e) {
is Tree @ (a, b) => foo
is Tree @ (a, b) if (a > 5) => foo
is null => foo
is 1 => foo
is A.b => foo
@@ -58,7 +57,6 @@ fun foo() {
is (Int, Int) => 2
is val a : Foo => 2
else => foo
else continue
}
}
@@ -72,4 +70,3 @@ fun foo() {
is a.a @ (val b, b) if (b == a + 3) => c
}
}
+23 -68
View File
@@ -94,7 +94,7 @@ JetFile: When.jet
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n\n ')
PsiWhiteSpace('\n \n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
WHEN
@@ -167,53 +167,6 @@ JetFile: When.jet
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiWhiteSpace('\n ')
WHEN_ENTRY
WHEN_CONDITION_IS_PATTERN
PsiElement(is)('is')
PsiWhiteSpace(' ')
DECOMPOSER_PATTERN
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Tree')
PsiWhiteSpace(' ')
PsiElement(AT)('@')
PsiWhiteSpace(' ')
DECOMPOSER_ARGUMENT_LIST
PsiElement(LPAR)('(')
TUPLE_PATTERN_ENTRY
TYPE_PATTERN
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
TUPLE_PATTERN_ENTRY
TYPE_PATTERN
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('b')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(if)('if')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
BINARY_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(GT)('>')
PsiWhiteSpace(' ')
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('5')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(DOUBLE_ARROW)('=>')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiWhiteSpace('\n ')
WHEN_ENTRY
WHEN_CONDITION_IS_PATTERN
PsiElement(is)('is')
@@ -1039,11 +992,6 @@ JetFile: When.jet
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiWhiteSpace('\n ')
WHEN_ENTRY
PsiElement(else)('else')
PsiWhiteSpace(' ')
PsiElement(continue)('continue')
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
@@ -1245,27 +1193,34 @@ JetFile: When.jet
PsiElement(IDENTIFIER)('b')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(if)('if')
PsiErrorElement:Expecting '=>' or 'when'
PsiElement(if)('if')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
BINARY_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('b')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(EQEQ)('==')
PsiWhiteSpace(' ')
PARENTHESIZED
PsiElement(LPAR)('(')
BINARY_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a')
PsiElement(IDENTIFIER)('b')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(PLUS)('+')
PsiElement(EQEQ)('==')
PsiWhiteSpace(' ')
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('3')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BINARY_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(PLUS)('+')
PsiWhiteSpace(' ')
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('3')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
WHEN_ENTRY
WHEN_CONDITION_IS_PATTERN
EXPRESSION_PATTERN
PsiErrorElement:Expecting an element, is-condition or in-condition
<empty list>
PsiElement(DOUBLE_ARROW)('=>')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
+2 -2
View File
@@ -91,7 +91,7 @@ JetFile: When_ERR.jet
PsiWhiteSpace('\n ')
WHEN_ENTRY
PsiElement(else)('else')
PsiErrorElement:Expecting 'continue' or '=> element'
PsiErrorElement:Expecting '=>'
<empty list>
PsiWhiteSpace('\n ')
PsiElement(RBRACE)('}')
@@ -172,7 +172,7 @@ JetFile: When_ERR.jet
PsiWhiteSpace('\n ')
WHEN_ENTRY
PsiElement(else)('else')
PsiErrorElement:Expecting 'continue' or '=> element'
PsiErrorElement:Expecting '=>'
<empty list>
PsiWhiteSpace('\n ')
WHEN_ENTRY