[FIR JS] Support smart casts for dynamic

This commit is contained in:
Nikolay Lunyak
2021-12-30 18:12:45 +03:00
committed by teamcity
parent bdc3b5fe6f
commit 611691ec70
24 changed files with 152 additions and 139 deletions
@@ -121,9 +121,9 @@ object FirTreeBuilder : AbstractFirTreeBuilder() {
val callableReferenceAccess by element(Expression, qualifiedAccessExpression)
val thisReceiverExpression by element(Expression, qualifiedAccessExpression)
val wrappedExpressionWithSmartcast by element(Expression)
val wrappedExpressionWithSmartcastToNull by element(Expression, wrappedExpressionWithSmartcast)
val wrappedExpressionWithSmartcastToNothing by element(Expression, wrappedExpressionWithSmartcast)
val expressionWithSmartcast by element(Expression, qualifiedAccessExpression, wrappedExpressionWithSmartcast)
val expressionWithSmartcastToNull by element(Expression, expressionWithSmartcast, wrappedExpressionWithSmartcastToNull)
val expressionWithSmartcastToNothing by element(Expression, expressionWithSmartcast, wrappedExpressionWithSmartcastToNothing)
val safeCallExpression by element(Expression, expression)
val checkedSafeCallSubject by element(Expression, expression)
val getClassCall by element(Expression, expression, call)
@@ -143,7 +143,7 @@ object FirTreeBuilder : AbstractFirTreeBuilder() {
val variableAssignment by element(Expression, qualifiedAccess)
val whenSubjectExpression by element(Expression, expression)
val whenSubjectExpressionWithSmartcast by element(Expression, whenSubjectExpression, wrappedExpressionWithSmartcast)
val whenSubjectExpressionWithSmartcastToNull by element(Expression, whenSubjectExpression, wrappedExpressionWithSmartcastToNull)
val whenSubjectExpressionWithSmartcastToNothing by element(Expression, whenSubjectExpression, wrappedExpressionWithSmartcastToNothing)
val wrappedDelegateExpression by element(Expression, wrappedExpression)
@@ -190,10 +190,10 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
}
noImpl(expressionWithSmartcast)
noImpl(expressionWithSmartcastToNull)
noImpl(expressionWithSmartcastToNothing)
noImpl(whenSubjectExpressionWithSmartcast)
noImpl(whenSubjectExpressionWithSmartcastToNull)
noImpl(whenSubjectExpressionWithSmartcastToNothing)
impl(getClassCall) {
default("argument") {
@@ -501,7 +501,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
+smartcastStability
}
wrappedExpressionWithSmartcastToNull.configure {
wrappedExpressionWithSmartcastToNothing.configure {
withArg("E", expression)
parentArg(wrappedExpressionWithSmartcast, "E", "E")
+field("smartcastTypeWithoutNullableNothing", typeRef)
@@ -511,8 +511,8 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
parentArg(wrappedExpressionWithSmartcast, "E", qualifiedAccessExpression)
}
expressionWithSmartcastToNull.configure {
parentArg(wrappedExpressionWithSmartcastToNull, "E", qualifiedAccessExpression)
expressionWithSmartcastToNothing.configure {
parentArg(wrappedExpressionWithSmartcastToNothing, "E", qualifiedAccessExpression)
}
safeCallExpression.configure {
@@ -585,8 +585,8 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
parentArg(wrappedExpressionWithSmartcast, "E", whenSubjectExpression)
}
whenSubjectExpressionWithSmartcastToNull.configure {
parentArg(wrappedExpressionWithSmartcastToNull, "E", whenSubjectExpression)
whenSubjectExpressionWithSmartcastToNothing.configure {
parentArg(wrappedExpressionWithSmartcastToNothing, "E", whenSubjectExpression)
}
wrappedExpression.configure {