evanphx (owner)

Revisions

gist: 209593 Download_button fork
public
Public Clone URL: git://gist.github.com/209593.git
Embed All Files: show embed
Text only #
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
ok
 
37:04
so, this:
 
37:07
class A; end
 
37:11
eval "public"
 
37:14
def o; end
 
37:15
A.new.o
 
37:23
is this case in irb
 
37:37
in MRI, that public is manipulating the calling env.
 
37:49
thats how irb manages it.
 
38:39
so, when private / public / protected is called, and the VariableScope.of_sender is for an eval
 
38:52
then we need to go up another level and set that visibility
 
39:18
a quick kludge for detecting that a VS is for an eval is by looking at the CompiledMethod it's for
 
39:26
vs = VariableScope.of_sender
 
39:33
if vs.method.name == :__eval__
 
39:36
  vs = vs.parent
 
39:37
end
 
39:42
vs.method_visibility = :whatever
 
39:57
that should work