Skip to content

Unexpected rest argument #3597

@ksss

Description

@ksss

from 5c114c9

build_config.rb

MRuby::Build.new do |conf|
  toolchain :gcc
  enable_debug
  conf.gembox 'default'
end
HEAD[5c114c91] ~/src/github.com/ksss/mruby
$ cat t.rb
#! /usr/bin/env ruby

def a(*args)
  p args
end

a :a, :b, :c, :d, :e, :f


HEAD[5c114c91] ~/src/github.com/ksss/mruby
$ ./build/host/bin/mruby -v t.rb
mruby 1.2.0 (2015-11-17)
00003 NODE_SCOPE:
00003   NODE_BEGIN:
00003     NODE_DEF:
00005       a
00003       local variables:
00003         args
00003       rest=*args
00004       NODE_BEGIN:
00004         NODE_FCALL:
00004           NODE_SELF
00004           method='p' (390)
00004           args:
00004             NODE_LVAR args
00007     NODE_FCALL:
00007       NODE_SELF
00007       method='a' (359)
00007       args:
00007         NODE_SYM :a (359)
00007         NODE_SYM :b (357)
00007         NODE_SYM :c (674)
00007         NODE_SYM :d (675)
00007         NODE_SYM :e (353)
00007         NODE_SYM :f (676)
irep 0x60c0000133c0 nregs=9 nlocals=1 pools=0 syms=6 reps=1
file: t.rb
    3 000 OP_TCLASS	R1
    3 001 OP_LAMBDA	R2	I(+1)	1
    3 002 OP_METHOD	R1	:a
    7 003 OP_LOADSELF	R1
    7 004 OP_LOADSYM	R2	:a
    7 005 OP_LOADSYM	R3	:b
    7 006 OP_LOADSYM	R4	:c
    7 007 OP_LOADSYM	R5	:d
    7 008 OP_LOADSYM	R6	:e
    7 009 OP_LOADSYM	R7	:f
    7 010 OP_SEND	R1	:a	6
    7 011 OP_STOP

irep 0x60c000013300 nregs=6 nlocals=3 pools=0 syms=1 reps=0
file: t.rb
    3 000 OP_ENTER	0:0:1:0:0:0:0
    4 001 OP_LOADSELF	R3
    4 002 OP_MOVE	R4	R1		; R1:args
    4 003 OP_SEND	R3	:p	1
    4 004 OP_RETURN	R3	return

[:a, :b, :c, :d, :e, nil]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions