Skip to content

Commit 66a35b2

Browse files
authored
feat: add support for OrExpression in JMESPathVisitor.kt (#1012)
1 parent 5ac2679 commit 66a35b2

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/waiters

smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/waiters/JMESPathVisitor.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,12 @@ class JMESPathVisitor(
475475
}
476476
}
477477

478-
override fun visitOr(expression: OrExpression): JMESVariable = throw Exception("OrExpression is unsupported")
478+
override fun visitOr(expression: OrExpression): JMESVariable {
479+
val leftVar = expression.left!!.accept(this)
480+
val rightVar = expression.right!!.accept(this)
481+
val orResultVar = JMESVariable("orResult", false, boolShape)
482+
return addTempVar(orResultVar, "\$L || \$L", leftVar.name, rightVar.name)
483+
}
479484

480485
// Maps a collection into a collection of a different type.
481486
override fun visitProjection(expression: ProjectionExpression): JMESVariable {

0 commit comments

Comments
 (0)