Sha256: 676a07982f323a6b4cc3c8b004ab7215f26d8ff1c520e7df75c7e2b03409e07f

Contents?: true

Size: 877 Bytes

Versions: 3

Compression:

Stored size: 877 Bytes

Contents

class Fancy AST {
  class AsyncSend : Node {
    def initialize: @line message_send: @message_send {
    }

    def bytecode: g {
      pos(g)

      body = ExpressionList new: @line list: [@message_send]
      block = BlockLiteral new: @line args: (BlockArgs new: @line) body: body

      fiber = MessageSend new: @line \
                          message: (Identifier from: "new:" line: @line) \
                          to: (Identifier from: "Fiber" line: @line) \
                          args: (MessageArgs new: @line args: [block])

      schedule_send = MessageSend new: @line \
                                  message: (Identifier from: "add:" line: @line) \
                                  to: (Identifier from: "Scheduler" line: @line) \
                                  args: (MessageArgs new: @line args: [fiber])

      schedule_send bytecode: g
    }
  }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fancy-0.3.3 lib/compiler/ast/async_send.fy
fancy-0.3.2 lib/compiler/ast/async_send.fy
fancy-0.3.1 lib/compiler/ast/async_send.fy