Sha256: 4785793b4a937386d04cc930ade90e3f2e3aabc03f3c2bb42306a24091fa3d78

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

class Fancy AST {
  class TupleLiteral : Node {
    def initialize: @line entries: @elements

    def bytecode: g {
      pos(g)
      ary = ArrayLiteral new: @line array: [FixnumLiteral new: @line value: (@elements size)]

      args = RubyArgs new: @line args: ary

      msg_ident = Identifier from: "new" line: @line
      msg_ident ruby_ident: true
      ms = MessageSend new:     @line                                            \
                       message: (msg_ident)                                      \
                       to:      (Identifier from: "Rubinius::Tuple" line: @line) \
                       args:    args

      ms bytecode: g

      @elements each_with_index() |e i| {
        g dup()
        ary = [FixnumLiteral new: @line value: i, e]

        ms = MessageSend new:  @line                                       \
                         message: (Identifier from: "[]:" line: @line) \
                         to:   (Nothing new: @line)                        \
                         args: (MessageArgs new: @line args: ary)

        ms bytecode: g
        g pop()
      }
    }
  }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fancy-0.8.0 lib/compiler/ast/tuple_literal.fy