New syntax for patterns
This commit is contained in:
@@ -99,10 +99,10 @@ class BinaryTree<T> : IMutableSet<T> {
|
||||
|
||||
private fun remove(node : TreeNode) {
|
||||
when (node) {
|
||||
is TreeNode(null, null) => replace(node, null)
|
||||
is TreeNode(null, right) => replace(node, right)
|
||||
is TreeNode(left, null) => replace(node, left)
|
||||
is TreeNode(left, right) => {
|
||||
is TreeNode @ (null, null) => replace(node, null)
|
||||
is TreeNode @ (null, right) => replace(node, right)
|
||||
is TreeNode @ (left, null) => replace(node, left)
|
||||
is TreeNode @ (left, right) => {
|
||||
val min = min(node.right)
|
||||
node.value = min.value
|
||||
remove(min)
|
||||
|
||||
@@ -1347,6 +1347,9 @@ JetFile: BinaryTree.jet
|
||||
DECOMPOSER_PATTERN
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('TreeNode')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
DECOMPOSER_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
DECOMPOSER_ARGUMENT
|
||||
@@ -1385,6 +1388,9 @@ JetFile: BinaryTree.jet
|
||||
DECOMPOSER_PATTERN
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('TreeNode')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
DECOMPOSER_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
DECOMPOSER_ARGUMENT
|
||||
@@ -1395,8 +1401,10 @@ JetFile: BinaryTree.jet
|
||||
PsiWhiteSpace(' ')
|
||||
DECOMPOSER_ARGUMENT
|
||||
TYPE_PATTERN
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('right')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('right')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
@@ -1423,12 +1431,17 @@ JetFile: BinaryTree.jet
|
||||
DECOMPOSER_PATTERN
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('TreeNode')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
DECOMPOSER_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
DECOMPOSER_ARGUMENT
|
||||
TYPE_PATTERN
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('left')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('left')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
DECOMPOSER_ARGUMENT
|
||||
@@ -1461,18 +1474,25 @@ JetFile: BinaryTree.jet
|
||||
DECOMPOSER_PATTERN
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('TreeNode')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
DECOMPOSER_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
DECOMPOSER_ARGUMENT
|
||||
TYPE_PATTERN
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('left')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('left')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
DECOMPOSER_ARGUMENT
|
||||
TYPE_PATTERN
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('right')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('right')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
|
||||
@@ -318,16 +318,18 @@ JetFile: BinaryHeap.jet
|
||||
PsiElement(is)('is')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_PATTERN
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('IComparable')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('IComparable')
|
||||
TYPE_ARGUMENT_LIST
|
||||
PsiElement(LT)('<')
|
||||
TYPE_PROJECTION
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n ')
|
||||
BINARY_EXPRESSION
|
||||
|
||||
Reference in New Issue
Block a user