Advertisement
Guest User

Function Statement Swift (Swizzle)

a guest
Jan 14th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.80 KB | None | 0 0
  1. public final class FunctionStatement: Statement, CustomStringConvertible {
  2.     public let name: Token
  3.     public let args: [ParameterStatement]
  4.     public let body: [Statement]
  5.     public let returnType: Token
  6.     public init(name: Token, args: [ParameterStatement], body: [Statement], returnType: Token = Token(type: .identifier, lexme: "Void", literal: nil, line: nil)) {
  7.         self.name = name
  8.         self.args = args
  9.         self.body = body
  10.         self.returnType = returnType
  11.     }
  12.     public var description: String {
  13.         return "\(name.lexme)(\(args.joined()) -> \(returnType.lexme)"
  14.     }
  15.     public override func accept<V, R>(_ visitor: V) throws -> R where V : Visitor, R == V.Result {
  16.         return try visitor.visit(self)
  17.     }
  18. }
  19.  
  20. Made for https://github.com/SafelySwift/Swizzle
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement