Class: YTLJit::VM::YARVContext

Inherits:
Object
  • Object
show all
Includes:
Node
Defined in:
lib/ytljit/vm_trans.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeYARVContext

Returns a new instance of YARVContext.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ytljit/vm_trans.rb', line 6

def initialize
  @the_top = TopTopNode.new(nil, Object)
  @top_nodes = [@the_top]
  @current_file_name = nil
  @current_class_node = the_top
  @current_method_name = nil

  @enc_label = ""
  @enc_pos_in_source = ""
  @current_line_no = 0
  @current_local_label = nil

  @current_node = @the_top
  @vmtab = []

  @expstack = []
  @local_label_tab = {}

  @not_reached_pos = false
end

Instance Attribute Details

#current_class_nodeObject

Returns the value of attribute current_class_node.



31
32
33
# File 'lib/ytljit/vm_trans.rb', line 31

def current_class_node
  @current_class_node
end

#current_file_nameObject

Returns the value of attribute current_file_name.



30
31
32
# File 'lib/ytljit/vm_trans.rb', line 30

def current_file_name
  @current_file_name
end

#current_line_noObject

Returns the value of attribute current_line_no.



36
37
38
# File 'lib/ytljit/vm_trans.rb', line 36

def current_line_no
  @current_line_no
end

#current_local_labelObject

Returns the value of attribute current_local_label.



37
38
39
# File 'lib/ytljit/vm_trans.rb', line 37

def current_local_label
  @current_local_label
end

#current_method_nameObject

Returns the value of attribute current_method_name.



32
33
34
# File 'lib/ytljit/vm_trans.rb', line 32

def current_method_name
  @current_method_name
end

#current_nodeObject

Returns the value of attribute current_node.



39
40
41
# File 'lib/ytljit/vm_trans.rb', line 39

def current_node
  @current_node
end

#enc_labelObject

Returns the value of attribute enc_label.



34
35
36
# File 'lib/ytljit/vm_trans.rb', line 34

def enc_label
  @enc_label
end

#enc_pos_in_sourceObject

Returns the value of attribute enc_pos_in_source.



35
36
37
# File 'lib/ytljit/vm_trans.rb', line 35

def enc_pos_in_source
  @enc_pos_in_source
end

#expstackObject (readonly)

Returns the value of attribute expstack.



42
43
44
# File 'lib/ytljit/vm_trans.rb', line 42

def expstack
  @expstack
end

#local_label_tabObject (readonly)

Returns the value of attribute local_label_tab.



43
44
45
# File 'lib/ytljit/vm_trans.rb', line 43

def local_label_tab
  @local_label_tab
end

#not_reached_posObject

Returns the value of attribute not_reached_pos.



45
46
47
# File 'lib/ytljit/vm_trans.rb', line 45

def not_reached_pos
  @not_reached_pos
end

#the_topObject

Returns the value of attribute the_top.



27
28
29
# File 'lib/ytljit/vm_trans.rb', line 27

def the_top
  @the_top
end

#top_nodesObject (readonly)

Returns the value of attribute top_nodes.



28
29
30
# File 'lib/ytljit/vm_trans.rb', line 28

def top_nodes
  @top_nodes
end

#vmtabObject (readonly)

Returns the value of attribute vmtab.



40
41
42
# File 'lib/ytljit/vm_trans.rb', line 40

def vmtab
  @vmtab
end

Instance Method Details

#import_object(klass, name, value) ⇒ Object



47
48
49
50
51
52
53
54
# File 'lib/ytljit/vm_trans.rb', line 47

def import_object(klass, name, value)
  ctn = ClassTopNode.get_class_top_node(klass)
  if ctn == nil then
    ctn = ClassTopNode.new(@the_top, klass, klass.name)
  end
  valnode = LiteralNode.new(ctn, value)
  ctn.get_constant_tab[name] = valnode
end