Support identity equals in contracts
This commit is contained in:
committed by
Ilya Gorbunov
parent
cf033fa78a
commit
a6bb7d1e89
@@ -103,6 +103,7 @@ internal class PsiConditionParser(
|
||||
when (expression.operationToken) {
|
||||
KtTokens.ANDAND -> operationConstructor = ::LogicalAnd
|
||||
KtTokens.OROR -> operationConstructor = ::LogicalOr
|
||||
KtTokens.EXCLEQEQEQ, KtTokens.EQEQEQ -> return parseIdentityEquals(expression)
|
||||
else -> return super.visitBinaryExpression(expression, data) // pass binary expression further
|
||||
}
|
||||
|
||||
@@ -111,6 +112,13 @@ internal class PsiConditionParser(
|
||||
return operationConstructor(left, right)
|
||||
}
|
||||
|
||||
private fun parseIdentityEquals(expression: KtBinaryExpression): BooleanExpression? {
|
||||
val lhs = dispatcher.parseValue(expression.left) ?: return null
|
||||
val rhs = dispatcher.parseValue(expression.right) ?: return null
|
||||
|
||||
return processEquals(lhs, rhs, expression.operationToken == KtTokens.EXCLEQEQEQ, expression)
|
||||
}
|
||||
|
||||
private fun processEquals(
|
||||
left: ContractDescriptionValue,
|
||||
right: ContractDescriptionValue,
|
||||
|
||||
Reference in New Issue
Block a user