-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathscope.rb
More file actions
72 lines (54 loc) · 1.05 KB
/
scope.rb
File metadata and controls
72 lines (54 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
class Scope
attr_reader :next
def initialize n=nil
@next = n
end
def method
@next.method if @next
end
def get_arg(a, save = false)
@next ? @next.get_arg(a, save) : nil
end
def add_global(c)
@next.add_global(c) if @next
end
def add_constant(c)
@next.add_constant(c) if @next
end
def find_constant(c)
@next ? @next.find_constant(c) : nil
end
def name
""
end
def class_scope
self
end
def lvaroffset
0
end
def set_vtable_entry(name,realname,f)
@next.set_vtable_entry(name,realname,f) if @next
end
def vtable
@next ? @next.vtable : {}
end
def break_label
@next ? @next.break_label : nil
end
def loop_label
@next ? @next.loop_label : nil
end
# Defer to parents class variable.
# FIXME: This might need to actually dynamically
# look up the superclass?
def get_class_var(var)
@next.get_class_var(var)
end
end
require 'globalscope'
require 'funcscope'
require 'sexpscope'
require 'localvarscope'
require 'classcope'
require 'controlscope'