File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -4,22 +4,32 @@ def initialize
4
4
@global_functions = { }
5
5
end
6
6
7
+ def keys
8
+ @global_functions . keys
9
+ end
10
+
7
11
# Returns the actual name
8
12
def set ( fname , function )
9
13
suffix = ""
10
14
i = 0
11
- while @global_functions [ fname + suffix ]
12
- i += 1
13
- suffix = "__#{ i } "
15
+ if @global_functions [ fname ]
16
+ while @global_functions [ fname + suffix ]
17
+ i += 1
18
+ suffix = "__#{ i } "
19
+ end
20
+ fname = fname + suffix
14
21
end
15
- fname = fname + suffix
16
22
17
23
# add the method to the global list of functions defined so far
18
24
# with its "munged" name.
19
25
@global_functions [ fname ] = function
20
26
fname
21
27
end
22
28
29
+ def [] name
30
+ @global_functions [ name ]
31
+ end
32
+
23
33
# We on purpose provide this instead of "each"
24
34
# as the use-case we need is function/method
25
35
# compilation where additional synthesized methods
You can’t perform that action at this time.
0 commit comments