From 6172f23d9be5d69c0d64e40d632e5738d15a54a2 Mon Sep 17 00:00:00 2001 From: Yan Zhulanow Date: Tue, 22 Mar 2016 20:06:20 +0300 Subject: [PATCH] Uast: support new elements in UastVisitor --- .../src/org/jetbrains/uast/UastVisitor.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/uast-common/src/org/jetbrains/uast/UastVisitor.kt b/plugins/uast-common/src/org/jetbrains/uast/UastVisitor.kt index 319ec19ac18..5de0dc84327 100644 --- a/plugins/uast-common/src/org/jetbrains/uast/UastVisitor.kt +++ b/plugins/uast-common/src/org/jetbrains/uast/UastVisitor.kt @@ -53,8 +53,14 @@ abstract class UastVisitor { open fun visitLiteralExpression(node: ULiteralExpression): Boolean = false open fun visitThisExpression(node: UThisExpression): Boolean = false open fun visitSuperExpression(node: USuperExpression): Boolean = false + open fun visitArrayAccessExpression(node: UArrayAccessExpression): Boolean = false + open fun visitCallableReferenceExpression(node: UCallableReferenceExpression): Boolean = false + open fun visitClassLiteralExpression(node: UClassLiteralExpression): Boolean = false + open fun visitLambdaExpression(node: ULambdaExpression): Boolean = false + open fun visitObjectLiteralExpression(node: UObjectLiteralExpression): Boolean = false open fun beforeVisit(node: UElement) {} + open fun visitOther(node: UElement): Boolean = true open fun afterVisit(node: UElement) {} fun handle(node: UElement): Boolean { @@ -93,7 +99,13 @@ abstract class UastVisitor { is ULiteralExpression -> visitLiteralExpression(node) is UThisExpression -> visitThisExpression(node) is USuperExpression -> visitSuperExpression(node) - else -> true + is UArrayAccessExpression -> visitArrayAccessExpression(node) + is UCallableReferenceExpression -> visitCallableReferenceExpression(node) + is UClassLiteralExpression -> visitClassLiteralExpression(node) + is ULambdaExpression -> visitLambdaExpression(node) + is UObjectLiteralExpression -> visitObjectLiteralExpression(node) + + else -> visitOther(node) } afterVisit(node) return result