Skip to content

Instantly share code, notes, and snippets.

@suzukaze
Created May 15, 2014 12:53
Show Gist options
  • Save suzukaze/9cf9a96adf45e16dbebd to your computer and use it in GitHub Desktop.
Save suzukaze/9cf9a96adf45e16dbebd to your computer and use it in GitHub Desktop.

local_variables.rb

  a = "hello"
  p a
  p local_variables
$ mruby -v local_variables.rb
mruby 1.0.0 (2014-01-10) 
NODE_SCOPE:
  local variables:
    a
  NODE_BEGIN:
    NODE_ASGN:
      lhs:
        NODE_LVAR a
      rhs:
        NODE_STR "hello" len 5
    NODE_CALL:
      NODE_SELF
      method='p' (282)
      args:
        NODE_LVAR a
    NODE_CALL:
      NODE_SELF
      method='p' (282)
      args:
        NODE_CALL:
          NODE_SELF
          method='local_variables' (531)
irep 0x7fcbfad001b0 nregs=5 nlocals=2 pools=1 syms=2 reps=0
file: local_variables2.rb
    1 000 OP_STRING	R1	L(0)	; "hello"	; R1:a
    2 001 OP_LOADSELF	R2	
    2 002 OP_MOVE	R3	R1	; R1:a
    2 003 OP_SEND	R2	:p	1
    3 004 OP_LOADSELF	R2	
    3 005 OP_LOADSELF	R3	
    3 006 OP_SEND	R3	:local_variables	0
    3 007 OP_SEND	R2	:p	1
    3 008 OP_STOP

"hello"
[:a]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment