Last active
July 14, 2020 20:40
-
-
Save aleksandr-lavrinenko/5977308e2843aab3879eebf6dc66c253 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| precedencegroup ChainOperatorPrecedence { | |
| associativity: left | |
| } | |
| infix operator >>>: ChainOperatorPrecedence | |
| @discardableResult | |
| public func >>> (left: Operation, right: Operation) -> Operation { | |
| right.addDependency(left) | |
| return right | |
| } | |
| @discardableResult | |
| public func >>> (left: Operation, right: [Operation]) -> [Operation] { | |
| for operation in right { | |
| operation.addDependency(left) | |
| } | |
| return right | |
| } | |
| @discardableResult | |
| public func >>> (left: [Operation], right: Operation) -> Operation { | |
| for operation in left { | |
| right.addDependency(operation) | |
| } | |
| return right | |
| } | |
| @discardableResult | |
| public func >>> (left: [Operation], right: [Operation]) -> [Operation] { | |
| assert(!right.isEmpty) | |
| for operationLeft in left { | |
| for operationRight in right { | |
| operationRight.addDependency(operationLeft) | |
| } | |
| } | |
| return right | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment