typeprof 0.7.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -5
- data/lib/typeprof/analyzer.rb +211 -98
- data/lib/typeprof/arguments.rb +2 -0
- data/lib/typeprof/block.rb +40 -2
- data/lib/typeprof/builtin.rb +301 -99
- data/lib/typeprof/cli.rb +2 -0
- data/lib/typeprof/config.rb +14 -2
- data/lib/typeprof/container-type.rb +5 -4
- data/lib/typeprof/export.rb +116 -65
- data/lib/typeprof/import.rb +68 -41
- data/lib/typeprof/iseq.rb +46 -11
- data/lib/typeprof/method.rb +47 -23
- data/lib/typeprof/type.rb +96 -18
- data/lib/typeprof/version.rb +1 -1
- data/smoke/alias.rb +5 -4
- data/smoke/alias2.rb +6 -4
- data/smoke/any1.rb +2 -1
- data/smoke/any2.rb +3 -2
- data/smoke/arguments.rb +3 -2
- data/smoke/arguments2.rb +11 -10
- data/smoke/array-each.rb +2 -1
- data/smoke/array-each2.rb +2 -1
- data/smoke/array-each3.rb +2 -1
- data/smoke/array-ltlt.rb +2 -1
- data/smoke/array-ltlt2.rb +2 -1
- data/smoke/array-map.rb +2 -1
- data/smoke/array-map2.rb +2 -1
- data/smoke/array-map3.rb +4 -3
- data/smoke/array-mul.rb +3 -2
- data/smoke/array-plus1.rb +2 -1
- data/smoke/array-plus2.rb +3 -2
- data/smoke/array-pop.rb +2 -1
- data/smoke/array-range-aref.rb +12 -11
- data/smoke/array-replace.rb +2 -1
- data/smoke/array-s-aref.rb +2 -1
- data/smoke/array1.rb +6 -5
- data/smoke/array10.rb +2 -1
- data/smoke/array11.rb +2 -1
- data/smoke/array12.rb +4 -3
- data/smoke/array13.rb +5 -4
- data/smoke/array14.rb +2 -1
- data/smoke/array15.rb +16 -0
- data/smoke/array2.rb +4 -3
- data/smoke/array3.rb +5 -4
- data/smoke/array4.rb +2 -1
- data/smoke/array5.rb +2 -1
- data/smoke/array6.rb +4 -2
- data/smoke/array7.rb +2 -1
- data/smoke/array8.rb +1 -1
- data/smoke/array9.rb +2 -1
- data/smoke/attr-module.rb +27 -0
- data/smoke/attr-vis.rb +43 -0
- data/smoke/attr-vis.rbs +4 -0
- data/smoke/attr.rb +5 -5
- data/smoke/autoload.rb +2 -1
- data/smoke/backtrace.rb +4 -3
- data/smoke/block-ambiguous.rb +9 -8
- data/smoke/block-args1-rest.rb +13 -11
- data/smoke/block-args1.rb +11 -10
- data/smoke/block-args2-rest.rb +13 -11
- data/smoke/block-args2.rb +11 -10
- data/smoke/block-args3-rest.rb +15 -13
- data/smoke/block-args3.rb +13 -12
- data/smoke/block-blockarg.rb +5 -4
- data/smoke/block-kwarg.rb +11 -10
- data/smoke/block1.rb +2 -1
- data/smoke/block10.rb +2 -1
- data/smoke/block11.rb +6 -5
- data/smoke/block12.rb +3 -2
- data/smoke/block14.rb +3 -2
- data/smoke/block2.rb +2 -1
- data/smoke/block3.rb +3 -3
- data/smoke/block4.rb +3 -2
- data/smoke/block5.rb +4 -2
- data/smoke/block6.rb +3 -2
- data/smoke/block7.rb +2 -1
- data/smoke/block8.rb +4 -3
- data/smoke/block9.rb +2 -1
- data/smoke/block_given.rb +37 -0
- data/smoke/blown.rb +2 -1
- data/smoke/break1.rb +3 -2
- data/smoke/break2.rb +2 -1
- data/smoke/break3.rb +13 -0
- data/smoke/case.rb +2 -1
- data/smoke/case2.rb +2 -1
- data/smoke/case3.rb +17 -0
- data/smoke/class-hierarchy.rb +5 -5
- data/smoke/class-hierarchy2.rb +3 -3
- data/smoke/class-new.rb +15 -0
- data/smoke/class_instance_var.rb +1 -1
- data/smoke/class_method.rb +2 -2
- data/smoke/class_method2.rb +2 -2
- data/smoke/class_method3.rb +4 -2
- data/smoke/constant1.rb +6 -6
- data/smoke/constant2.rb +6 -4
- data/smoke/constant3.rb +2 -1
- data/smoke/constant4.rb +2 -1
- data/smoke/context-sensitive1.rb +2 -1
- data/smoke/cvar.rb +7 -5
- data/smoke/cvar2.rb +2 -2
- data/smoke/define_method.rb +2 -2
- data/smoke/define_method2.rb +2 -2
- data/smoke/define_method3.rb +14 -0
- data/smoke/define_method3.rbs +3 -0
- data/smoke/define_method4.rb +15 -0
- data/smoke/define_method4.rbs +3 -0
- data/smoke/define_method5.rb +12 -0
- data/smoke/define_method6.rb +19 -0
- data/smoke/demo.rb +7 -6
- data/smoke/demo1.rb +2 -1
- data/smoke/demo10.rb +3 -2
- data/smoke/demo11.rb +2 -1
- data/smoke/demo2.rb +2 -1
- data/smoke/demo3.rb +2 -1
- data/smoke/demo4.rb +3 -3
- data/smoke/demo5.rb +1 -1
- data/smoke/demo6.rb +4 -3
- data/smoke/demo7.rb +2 -1
- data/smoke/demo8.rb +3 -2
- data/smoke/demo9.rb +4 -2
- data/smoke/dummy-execution1.rb +3 -2
- data/smoke/dummy-execution2.rb +2 -2
- data/smoke/dummy_element.rb +14 -0
- data/smoke/ensure1.rb +3 -2
- data/smoke/enum_for.rb +15 -0
- data/smoke/enum_for2.rb +17 -0
- data/smoke/enumerator.rb +3 -2
- data/smoke/expandarray1.rb +2 -1
- data/smoke/expandarray2.rb +2 -1
- data/smoke/fib.rb +2 -2
- data/smoke/flip-flop.rb +28 -0
- data/smoke/flow1.rb +2 -1
- data/smoke/flow10.rb +17 -0
- data/smoke/flow2.rb +2 -1
- data/smoke/flow3.rb +2 -1
- data/smoke/flow5.rb +2 -1
- data/smoke/flow6.rb +2 -1
- data/smoke/flow7.rb +2 -1
- data/smoke/flow8.rb +2 -1
- data/smoke/flow9.rb +12 -0
- data/smoke/freeze.rb +2 -1
- data/smoke/function.rb +3 -2
- data/smoke/gvar.rb +3 -2
- data/smoke/gvar2.rb +4 -3
- data/smoke/hash-bot.rb +12 -0
- data/smoke/hash-fetch.rb +4 -3
- data/smoke/hash-merge-bang.rb +2 -1
- data/smoke/hash1.rb +3 -2
- data/smoke/hash2.rb +2 -1
- data/smoke/hash3.rb +2 -1
- data/smoke/hash4.rb +2 -1
- data/smoke/hash5.rb +1 -1
- data/smoke/inheritance.rb +4 -4
- data/smoke/inheritance2.rb +2 -2
- data/smoke/initialize.rb +7 -5
- data/smoke/instance_eval.rb +2 -2
- data/smoke/instance_eval2.rb +10 -0
- data/smoke/instance_eval3.rb +25 -0
- data/smoke/int_times.rb +2 -1
- data/smoke/integer.rb +2 -1
- data/smoke/ivar.rb +6 -4
- data/smoke/ivar2.rb +4 -4
- data/smoke/ivar3.rb +4 -3
- data/smoke/ivar4.rb +21 -0
- data/smoke/kernel-class.rb +2 -1
- data/smoke/keyword1.rb +2 -1
- data/smoke/keyword2.rb +2 -1
- data/smoke/keyword3.rb +2 -1
- data/smoke/keyword4.rb +2 -1
- data/smoke/keyword5.rb +2 -1
- data/smoke/kwrest.rb +3 -2
- data/smoke/kwsplat1.rb +5 -4
- data/smoke/kwsplat2.rb +2 -1
- data/smoke/lit-complex.rb +10 -0
- data/smoke/lit-encoding.rb +10 -0
- data/smoke/manual-rbs.rb +6 -4
- data/smoke/manual-rbs2.rb +2 -1
- data/smoke/manual-rbs3.rb +3 -2
- data/smoke/masgn1.rb +2 -1
- data/smoke/masgn2.rb +3 -2
- data/smoke/masgn3.rb +2 -1
- data/smoke/method_in_branch.rb +4 -3
- data/smoke/method_missing.rb +5 -4
- data/smoke/module1.rb +2 -2
- data/smoke/module2.rb +1 -1
- data/smoke/module3.rb +3 -3
- data/smoke/module4.rb +3 -2
- data/smoke/module5.rb +17 -0
- data/smoke/module6.rb +40 -0
- data/smoke/module_function1.rb +4 -3
- data/smoke/module_function2.rb +4 -3
- data/smoke/multiple-include.rb +2 -1
- data/smoke/multiple-superclass.rb +1 -1
- data/smoke/next1.rb +3 -2
- data/smoke/next2.rb +2 -1
- data/smoke/object-send1.rb +4 -3
- data/smoke/object-send2.rb +10 -0
- data/smoke/object-send3.rb +18 -0
- data/smoke/once.rb +2 -1
- data/smoke/optional1.rb +2 -1
- data/smoke/optional2.rb +2 -1
- data/smoke/optional3.rb +2 -1
- data/smoke/parameterizedd-self.rb +4 -2
- data/smoke/parameterizedd-self2.rb +1 -1
- data/smoke/pathname1.rb +2 -1
- data/smoke/pathname2.rb +2 -1
- data/smoke/pattern-match1.rb +2 -1
- data/smoke/pattern-match2.rb +2 -1
- data/smoke/prepend1.rb +33 -0
- data/smoke/prepend2.rb +10 -0
- data/smoke/prepend2.rbs +9 -0
- data/smoke/primitive_method.rb +19 -0
- data/smoke/printf.rb +2 -2
- data/smoke/proc.rb +3 -2
- data/smoke/proc2.rb +2 -1
- data/smoke/proc3.rb +2 -1
- data/smoke/proc4.rb +2 -1
- data/smoke/proc5.rb +19 -0
- data/smoke/public.rb +38 -0
- data/smoke/range.rb +2 -1
- data/smoke/rbs-alias.rb +2 -1
- data/smoke/rbs-attr.rb +6 -5
- data/smoke/rbs-attr2.rb +1 -1
- data/smoke/rbs-extend.rb +2 -1
- data/smoke/rbs-interface.rb +5 -4
- data/smoke/rbs-module.rb +26 -0
- data/smoke/rbs-module.rbs +4 -0
- data/smoke/rbs-opt-and-rest.rb +10 -0
- data/smoke/rbs-opt-and-rest.rbs +3 -0
- data/smoke/rbs-proc1.rb +2 -1
- data/smoke/rbs-proc2.rb +3 -2
- data/smoke/rbs-proc3.rb +2 -1
- data/smoke/rbs-record.rb +3 -2
- data/smoke/rbs-tyvar.rb +3 -2
- data/smoke/rbs-tyvar2.rb +3 -2
- data/smoke/rbs-tyvar3.rb +3 -2
- data/smoke/rbs-tyvar4.rb +4 -3
- data/smoke/rbs-tyvar5.rb +2 -1
- data/smoke/rbs-tyvar6.rb +4 -3
- data/smoke/rbs-tyvar7.rb +2 -1
- data/smoke/rbs-vars.rb +7 -6
- data/smoke/redo1.rb +3 -2
- data/smoke/redo2.rb +3 -2
- data/smoke/req-keyword.rb +2 -1
- data/smoke/rescue1.rb +3 -2
- data/smoke/rescue2.rb +3 -2
- data/smoke/rescue3.rb +20 -0
- data/smoke/rescue4.rb +17 -0
- data/smoke/respond_to.rb +2 -1
- data/smoke/rest-farg.rb +2 -1
- data/smoke/rest1.rb +3 -2
- data/smoke/rest2.rb +2 -1
- data/smoke/rest3.rb +7 -6
- data/smoke/rest4.rb +3 -2
- data/smoke/rest5.rb +2 -1
- data/smoke/rest6.rb +2 -1
- data/smoke/retry1.rb +3 -2
- data/smoke/return.rb +2 -1
- data/smoke/simple.rb +12 -0
- data/smoke/singleton_method.rb +1 -1
- data/smoke/step.rb +4 -3
- data/smoke/string-split.rb +2 -1
- data/smoke/struct-keyword_init.rb +10 -0
- data/smoke/struct.rb +1 -1
- data/smoke/struct2.rb +5 -4
- data/smoke/struct3.rb +2 -2
- data/smoke/struct4.rb +7 -0
- data/smoke/struct5.rb +16 -0
- data/smoke/struct6.rb +15 -0
- data/smoke/struct7.rb +17 -0
- data/smoke/stub-keyword.rb +10 -0
- data/smoke/super1.rb +5 -4
- data/smoke/super2.rb +1 -1
- data/smoke/super3.rb +4 -3
- data/smoke/super4.rb +7 -5
- data/smoke/super5.rb +6 -4
- data/smoke/svar1.rb +2 -1
- data/smoke/symbol-proc-attr.rb +22 -0
- data/smoke/symbol-proc-attr2.rb +15 -0
- data/smoke/symbol-proc-bot.rb +13 -0
- data/smoke/symbol-proc.rb +4 -3
- data/smoke/tap1.rb +3 -2
- data/smoke/toplevel.rb +2 -1
- data/smoke/two-map.rb +3 -2
- data/smoke/type_var.rb +4 -3
- data/smoke/typed_method.rb +2 -1
- data/smoke/uninitialize-var.rb +2 -1
- data/smoke/union-recv.rb +2 -2
- data/smoke/user-demo.rb +3 -3
- data/smoke/wrong-extend.rb +3 -2
- data/smoke/wrong-include.rb +3 -2
- data/smoke/wrong-include2.rb +17 -0
- data/typeprof.gemspec +1 -1
- metadata +57 -5
- data/tools/stackprof-wrapper.rb +0 -10
data/lib/typeprof/arguments.rb
CHANGED
@@ -3,6 +3,7 @@ module TypeProf
|
|
3
3
|
class ActualArguments
|
4
4
|
def initialize(lead_tys, rest_ty, kw_tys, blk_ty)
|
5
5
|
@lead_tys = lead_tys
|
6
|
+
raise unless lead_tys
|
6
7
|
@rest_ty = rest_ty
|
7
8
|
@kw_tys = kw_tys # kw_tys should be {:key1 => Type, :key2 => Type, ...} or {nil => Type}
|
8
9
|
raise if !kw_tys.is_a?(::Hash)
|
@@ -58,6 +59,7 @@ module TypeProf
|
|
58
59
|
subst = Type.merge_substitution(subst, subst2)
|
59
60
|
end
|
60
61
|
msig.opt_tys.each do |farg|
|
62
|
+
break if aargs.empty?
|
61
63
|
aarg = aargs.shift
|
62
64
|
return nil unless subst2 = Type.match?(aarg, farg)
|
63
65
|
subst = Type.merge_substitution(subst, subst2)
|
data/lib/typeprof/block.rb
CHANGED
@@ -29,7 +29,10 @@ module TypeProf
|
|
29
29
|
|
30
30
|
def do_call(aargs, caller_ep, caller_env, scratch, replace_recv_ty:, &ctn)
|
31
31
|
blk_env = scratch.return_envs[@outer_ep]
|
32
|
-
|
32
|
+
if replace_recv_ty
|
33
|
+
replace_recv_ty = scratch.globalize_type(replace_recv_ty, caller_env, caller_ep)
|
34
|
+
blk_env = blk_env.replace_recv_ty(replace_recv_ty)
|
35
|
+
end
|
33
36
|
aargs = scratch.globalize_type(aargs, caller_env, caller_ep)
|
34
37
|
|
35
38
|
scratch.add_block_signature!(self, aargs.to_block_signature)
|
@@ -119,11 +122,12 @@ module TypeProf
|
|
119
122
|
def do_call(aargs, caller_ep, caller_env, scratch, replace_recv_ty:, &ctn)
|
120
123
|
if aargs.lead_tys.size >= 1
|
121
124
|
recv = aargs.lead_tys[0]
|
125
|
+
recv = Type.any if recv == Type.bot
|
122
126
|
aargs = ActualArguments.new(aargs.lead_tys[1..], aargs.rest_ty, aargs.kw_tys, aargs.blk_ty)
|
123
127
|
elsif aargs.rest_ty
|
124
128
|
recv = aargs.rest_ty.elems.squash_or_any # XXX: need to shift
|
125
129
|
else
|
126
|
-
|
130
|
+
recv = Type.any
|
127
131
|
end
|
128
132
|
|
129
133
|
scratch.add_block_signature!(self, aargs.to_block_signature)
|
@@ -133,4 +137,38 @@ module TypeProf
|
|
133
137
|
end
|
134
138
|
end
|
135
139
|
end
|
140
|
+
|
141
|
+
class CustomBlock < Block
|
142
|
+
def initialize(caller_ep, mid, &blk)
|
143
|
+
@caller_ep = caller_ep
|
144
|
+
@mid = mid
|
145
|
+
@blk = blk
|
146
|
+
end
|
147
|
+
|
148
|
+
def inspect
|
149
|
+
"#<CustomBlock>"
|
150
|
+
end
|
151
|
+
|
152
|
+
def consistent?(other)
|
153
|
+
true # XXX
|
154
|
+
end
|
155
|
+
|
156
|
+
def substitute(_subst, _depth)
|
157
|
+
self
|
158
|
+
end
|
159
|
+
|
160
|
+
def do_call(aargs, caller_ep, caller_env, scratch, replace_recv_ty:, &ctn)
|
161
|
+
aargs = scratch.globalize_type(aargs, caller_env, caller_ep)
|
162
|
+
|
163
|
+
dummy_ctx = TypedContext.new(@caller_ep, @mid)
|
164
|
+
|
165
|
+
scratch.add_block_signature!(self, aargs.to_block_signature)
|
166
|
+
scratch.add_block_to_ctx!(self, dummy_ctx)
|
167
|
+
|
168
|
+
@blk.call(aargs, caller_ep, caller_env, scratch, replace_recv_ty: replace_recv_ty) do |ret_ty, ep, env|
|
169
|
+
scratch.add_return_value!(dummy_ctx, ret_ty)
|
170
|
+
ctn[ret_ty, ep, env]
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
136
174
|
end
|
data/lib/typeprof/builtin.rb
CHANGED
@@ -19,7 +19,7 @@ module TypeProf
|
|
19
19
|
klass, new_mid, old_mid = aargs.lead_tys
|
20
20
|
new_sym = get_sym("alias", new_mid, ep, scratch) or return
|
21
21
|
old_sym = get_sym("alias", old_mid, ep, scratch) or return
|
22
|
-
scratch.alias_method(klass, ep.ctx.cref.singleton, new_sym, old_sym)
|
22
|
+
scratch.alias_method(klass, ep.ctx.cref.singleton, new_sym, old_sym, ep)
|
23
23
|
ctn[Type.nil, ep, env]
|
24
24
|
end
|
25
25
|
|
@@ -82,14 +82,17 @@ module TypeProf
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def object_is_a?(recv, mid, aargs, ep, env, scratch, &ctn)
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
85
|
+
if aargs.lead_tys.size == 1
|
86
|
+
if recv.is_a?(Type::Instance)
|
87
|
+
if recv.klass == aargs.lead_tys[0] # XXX: inheritance
|
88
|
+
true_val = Type::Instance.new(Type::Builtin[:true])
|
89
|
+
ctn[true_val, ep, env]
|
90
|
+
else
|
91
|
+
false_val = Type::Instance.new(Type::Builtin[:false])
|
92
|
+
ctn[false_val, ep, env]
|
93
|
+
end
|
90
94
|
else
|
91
|
-
|
92
|
-
ctn[false_val, ep, env]
|
95
|
+
ctn[Type.bool, ep, env]
|
93
96
|
end
|
94
97
|
else
|
95
98
|
ctn[Type.bool, ep, env]
|
@@ -97,16 +100,19 @@ module TypeProf
|
|
97
100
|
end
|
98
101
|
|
99
102
|
def object_respond_to?(recv, mid, aargs, ep, env, scratch, &ctn)
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
103
|
+
if aargs.lead_tys.size == 1
|
104
|
+
sym = get_sym("respond_to?", aargs.lead_tys[0], ep, scratch)
|
105
|
+
if sym
|
106
|
+
klass, singleton = recv.method_dispatch_info
|
107
|
+
if scratch.get_method(klass, singleton, sym)
|
108
|
+
true_val = Type::Instance.new(Type::Builtin[:true])
|
109
|
+
ctn[true_val, ep, env]
|
110
|
+
else
|
111
|
+
false_val = Type::Instance.new(Type::Builtin[:false])
|
112
|
+
ctn[false_val, ep, env]
|
113
|
+
end
|
107
114
|
else
|
108
|
-
|
109
|
-
ctn[false_val, ep, env]
|
115
|
+
ctn[Type.bool, ep, env]
|
110
116
|
end
|
111
117
|
else
|
112
118
|
ctn[Type.bool, ep, env]
|
@@ -124,10 +130,12 @@ module TypeProf
|
|
124
130
|
def object_send(recv, mid, aargs, ep, env, scratch, &ctn)
|
125
131
|
if aargs.lead_tys.size >= 1
|
126
132
|
mid_ty, = aargs.lead_tys
|
127
|
-
|
133
|
+
elsif aargs.rest_ty
|
128
134
|
mid_ty = aargs.rest_ty
|
135
|
+
else
|
136
|
+
return ctn[Type.any, ep, env]
|
129
137
|
end
|
130
|
-
aargs = ActualArguments.new(aargs.lead_tys[1
|
138
|
+
aargs = ActualArguments.new(aargs.lead_tys[1..] || [], aargs.rest_ty, aargs.kw_tys, aargs.blk_ty)
|
131
139
|
found = false
|
132
140
|
mid_ty.each_child do |mid|
|
133
141
|
if mid.is_a?(Type::Symbol)
|
@@ -148,8 +156,70 @@ module TypeProf
|
|
148
156
|
return
|
149
157
|
end
|
150
158
|
naargs = ActualArguments.new([recv], nil, {}, Type.nil)
|
151
|
-
|
152
|
-
|
159
|
+
nrecv = recv
|
160
|
+
nrecv = nrecv.base_type if nrecv.is_a?(Type::ContainerType)
|
161
|
+
scratch.do_invoke_block(aargs.blk_ty, naargs, ep, env, replace_recv_ty: nrecv) do |_ret_ty, ep|
|
162
|
+
ctn[recv, ep, env]
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def object_enum_for(recv, mid, aargs, ep, env, scratch, &ctn)
|
167
|
+
if aargs.lead_tys.size >= 1
|
168
|
+
mid_ty, = aargs.lead_tys
|
169
|
+
naargs = ActualArguments.new(aargs.lead_tys[1..], aargs.rest_ty, aargs.kw_tys, aargs.blk_ty)
|
170
|
+
elsif aargs.rest_ty
|
171
|
+
mid_ty = aargs.rest_ty
|
172
|
+
naargs = aargs
|
173
|
+
else
|
174
|
+
mid_ty = Type::Symbol.new(:each, Type::Instance.new(Type::Builtin[:sym]))
|
175
|
+
naargs = aargs
|
176
|
+
end
|
177
|
+
|
178
|
+
elem_ty = Type.bot
|
179
|
+
enum_for_blk = CustomBlock.new(ep, mid) do |aargs, caller_ep, caller_env, scratch, replace_recv_ty:, &blk_ctn|
|
180
|
+
if aargs.lead_tys.size >= 1
|
181
|
+
elem_ty = elem_ty.union(aargs.lead_tys[0])
|
182
|
+
else
|
183
|
+
elem_ty = elem_ty.union(Type.any)
|
184
|
+
end
|
185
|
+
ctn[Type::Cell.new(Type::Cell::Elements.new([elem_ty, Type.any]), Type::Instance.new(Type::Builtin[:enumerator])), ep, env]
|
186
|
+
blk_ctn[Type.any, caller_ep, caller_env]
|
187
|
+
end
|
188
|
+
enum_for_blk_ty = Type::Proc.new(enum_for_blk, Type::Instance.new(Type::Builtin[:proc]))
|
189
|
+
|
190
|
+
naargs = ActualArguments.new(naargs.lead_tys, naargs.rest_ty, naargs.kw_tys, enum_for_blk_ty)
|
191
|
+
mid_ty.each_child do |mid|
|
192
|
+
if mid.is_a?(Type::Symbol)
|
193
|
+
mid = mid.sym
|
194
|
+
scratch.do_send(recv, mid, naargs, ep, env) do |_ret_ty, _ep|
|
195
|
+
ctn[Type::Cell.new(Type::Cell::Elements.new([elem_ty, Type.any]), Type::Instance.new(Type::Builtin[:enumerator])), ep, env]
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
def object_privitive_method(recv, mid, aargs, ep, env, scratch, &ctn)
|
202
|
+
ctn[Type::Symbol.new(ep.ctx.mid, Type::Instance.new(Type::Builtin[:sym])), ep, env]
|
203
|
+
end
|
204
|
+
|
205
|
+
def object_block_given?(recv, mid, aargs, ep, env, scratch, &ctn)
|
206
|
+
procs = Type.bot
|
207
|
+
no_proc = false
|
208
|
+
env.static_env.blk_ty.each_child do |blk_ty|
|
209
|
+
case blk_ty
|
210
|
+
when Type::Proc
|
211
|
+
procs = procs.union(blk_ty)
|
212
|
+
when Type.nil
|
213
|
+
no_proc = true
|
214
|
+
else
|
215
|
+
ctn[Type.bool, ep, env]
|
216
|
+
end
|
217
|
+
end
|
218
|
+
if procs != Type.bot
|
219
|
+
ctn[Type::Instance.new(Type::Builtin[:true]), ep, env.replace_blk_ty(procs)]
|
220
|
+
end
|
221
|
+
if no_proc
|
222
|
+
ctn[Type::Instance.new(Type::Builtin[:false]), ep, env.replace_blk_ty(Type.nil)]
|
153
223
|
end
|
154
224
|
end
|
155
225
|
|
@@ -159,10 +229,16 @@ module TypeProf
|
|
159
229
|
ctn[Type.any, ep, env]
|
160
230
|
return
|
161
231
|
end
|
232
|
+
|
233
|
+
unless recv.is_a?(Type::Class)
|
234
|
+
# XXX: warn?
|
235
|
+
return ctn[Type.any, ep, env]
|
236
|
+
end
|
237
|
+
|
162
238
|
arg = aargs.lead_tys[0]
|
163
239
|
arg.each_child do |arg|
|
164
240
|
if arg.is_a?(Type::Class)
|
165
|
-
scratch.
|
241
|
+
scratch.mix_module(:after, recv, arg, nil, ep.ctx.cref.singleton, ep)
|
166
242
|
end
|
167
243
|
end
|
168
244
|
ctn[recv, ep, env]
|
@@ -174,10 +250,38 @@ module TypeProf
|
|
174
250
|
ctn[Type.any, ep, env]
|
175
251
|
return
|
176
252
|
end
|
253
|
+
|
254
|
+
unless recv.is_a?(Type::Class)
|
255
|
+
# XXX: warn?
|
256
|
+
return ctn[Type.any, ep, env]
|
257
|
+
end
|
258
|
+
|
259
|
+
arg = aargs.lead_tys[0]
|
260
|
+
arg.each_child do |arg|
|
261
|
+
if arg.is_a?(Type::Class)
|
262
|
+
# if ep.ctx.cref.singleton is true, the meta-meta level is ignored. Should we warn?
|
263
|
+
scratch.mix_module(:after, recv, arg, nil, true, ep)
|
264
|
+
end
|
265
|
+
end
|
266
|
+
ctn[recv, ep, env]
|
267
|
+
end
|
268
|
+
|
269
|
+
def module_prepend(recv, mid, aargs, ep, env, scratch, &ctn)
|
270
|
+
if aargs.lead_tys.size != 1
|
271
|
+
scratch.warn(ep, "Module#prepend without an argument is ignored")
|
272
|
+
ctn[Type.any, ep, env]
|
273
|
+
return
|
274
|
+
end
|
275
|
+
|
276
|
+
unless recv.is_a?(Type::Class)
|
277
|
+
# XXX: warn?
|
278
|
+
return ctn[Type.any, ep, env]
|
279
|
+
end
|
280
|
+
|
177
281
|
arg = aargs.lead_tys[0]
|
178
282
|
arg.each_child do |arg|
|
179
283
|
if arg.is_a?(Type::Class)
|
180
|
-
scratch.
|
284
|
+
scratch.mix_module(:before, recv, arg, nil, ep.ctx.cref.singleton, ep)
|
181
285
|
end
|
182
286
|
end
|
183
287
|
ctn[recv, ep, env]
|
@@ -198,6 +302,46 @@ module TypeProf
|
|
198
302
|
end
|
199
303
|
end
|
200
304
|
|
305
|
+
def module_public(recv, mid, aargs, ep, env, scratch, &ctn)
|
306
|
+
if aargs.lead_tys.empty?
|
307
|
+
ctn[recv, ep, env.method_public_set(true)]
|
308
|
+
else
|
309
|
+
if recv.is_a?(Type::Class)
|
310
|
+
aargs.lead_tys.each do |aarg|
|
311
|
+
sym = get_sym("public", aarg, ep, scratch) or next
|
312
|
+
meths = scratch.get_method(recv, false, sym)
|
313
|
+
next unless meths
|
314
|
+
meths.each do |mdef|
|
315
|
+
mdef.pub_meth = true if mdef.respond_to?(:pub_meth=)
|
316
|
+
end
|
317
|
+
end
|
318
|
+
else
|
319
|
+
# XXX: warn?
|
320
|
+
end
|
321
|
+
ctn[recv, ep, env]
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
def module_private(recv, mid, aargs, ep, env, scratch, &ctn)
|
326
|
+
if aargs.lead_tys.empty?
|
327
|
+
ctn[recv, ep, env.method_public_set(false)]
|
328
|
+
else
|
329
|
+
if recv.is_a?(Type::Class)
|
330
|
+
aargs.lead_tys.each do |aarg|
|
331
|
+
sym = get_sym("private", aarg, ep, scratch) or next
|
332
|
+
meths = scratch.get_method(recv, false, sym)
|
333
|
+
next unless meths
|
334
|
+
meths.each do |mdef|
|
335
|
+
mdef.pub_meth = false if mdef.respond_to?(:pub_meth=)
|
336
|
+
end
|
337
|
+
end
|
338
|
+
else
|
339
|
+
# XXX: warn?
|
340
|
+
end
|
341
|
+
ctn[recv, ep, env]
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
201
345
|
def module_define_method(recv, mid, aargs, ep, env, scratch, &ctn)
|
202
346
|
if aargs.lead_tys.size != 1
|
203
347
|
scratch.warn(ep, "Module#define with #{ aargs.lead_tys.size } argument is ignored")
|
@@ -206,23 +350,25 @@ module TypeProf
|
|
206
350
|
end
|
207
351
|
|
208
352
|
mid, = aargs.lead_tys
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
353
|
+
mid.each_child do |mid|
|
354
|
+
if mid.is_a?(Type::Symbol)
|
355
|
+
mid = mid.sym
|
356
|
+
aargs.blk_ty.each_child do |blk_ty|
|
357
|
+
if blk_ty.is_a?(Type::Proc)
|
358
|
+
blk = blk_ty.block_body
|
359
|
+
case blk
|
360
|
+
when ISeqBlock
|
361
|
+
scratch.do_define_iseq_method(ep, env, mid, blk.iseq, blk.outer_ep)
|
362
|
+
else
|
363
|
+
# XXX: what to do?
|
364
|
+
end
|
217
365
|
else
|
218
366
|
# XXX: what to do?
|
219
367
|
end
|
220
|
-
else
|
221
|
-
# XXX: what to do?
|
222
368
|
end
|
369
|
+
else
|
370
|
+
# XXX: what to do?
|
223
371
|
end
|
224
|
-
else
|
225
|
-
# XXX: what to do?
|
226
372
|
end
|
227
373
|
ctn[Type.any, ep, env]
|
228
374
|
end
|
@@ -231,7 +377,7 @@ module TypeProf
|
|
231
377
|
aargs.lead_tys.each do |aarg|
|
232
378
|
sym = get_sym("attr_accessor", aarg, ep, scratch) or next
|
233
379
|
cref = ep.ctx.cref
|
234
|
-
scratch.add_attr_method(cref.klass,
|
380
|
+
scratch.add_attr_method(cref.klass, sym, :"@#{ sym }", :accessor, env.static_env.pub_meth, ep)
|
235
381
|
end
|
236
382
|
ctn[Type.nil, ep, env]
|
237
383
|
end
|
@@ -240,7 +386,7 @@ module TypeProf
|
|
240
386
|
aargs.lead_tys.each do |aarg|
|
241
387
|
sym = get_sym("attr_reader", aarg, ep, scratch) or next
|
242
388
|
cref = ep.ctx.cref
|
243
|
-
scratch.add_attr_method(cref.klass,
|
389
|
+
scratch.add_attr_method(cref.klass, sym, :"@#{ sym }", :reader, env.static_env.pub_meth, ep)
|
244
390
|
end
|
245
391
|
ctn[Type.nil, ep, env]
|
246
392
|
end
|
@@ -249,7 +395,7 @@ module TypeProf
|
|
249
395
|
aargs.lead_tys.each do |aarg|
|
250
396
|
sym = get_sym("attr_writer", aarg, ep, scratch) or next
|
251
397
|
cref = ep.ctx.cref
|
252
|
-
scratch.add_attr_method(cref.klass,
|
398
|
+
scratch.add_attr_method(cref.klass, sym, :"@#{ sym }", :writer, env.static_env.pub_meth, ep)
|
253
399
|
end
|
254
400
|
ctn[Type.nil, ep, env]
|
255
401
|
end
|
@@ -291,14 +437,19 @@ module TypeProf
|
|
291
437
|
return ctn[Type.any, ep, env] unless recv.is_a?(Type::Local) && recv.kind == Type::Array
|
292
438
|
|
293
439
|
if aargs.lead_tys.size != 2
|
440
|
+
# XXX: Support `ary[idx, len] = val`
|
294
441
|
#raise NotImplementedError # XXX
|
295
|
-
ctn[Type.any, ep, env]
|
442
|
+
return ctn[Type.any, ep, env]
|
296
443
|
end
|
297
444
|
|
298
445
|
idx = aargs.lead_tys.first
|
299
446
|
if idx.is_a?(Type::Literal)
|
300
447
|
idx = idx.lit
|
301
|
-
|
448
|
+
if !idx.is_a?(Integer)
|
449
|
+
# XXX: Support `ary[idx..end] = val`
|
450
|
+
#raise NotImplementedError # XXX
|
451
|
+
return ctn[Type.any, ep, env]
|
452
|
+
end
|
302
453
|
else
|
303
454
|
idx = nil
|
304
455
|
end
|
@@ -335,6 +486,7 @@ module TypeProf
|
|
335
486
|
recv.each_child do |recv|
|
336
487
|
if recv.is_a?(Type::Local) && recv.kind == Type::Hash
|
337
488
|
ty = scratch.get_hash_elem_type(env, ep, recv.id, idx)
|
489
|
+
ty = Type.nil if ty == Type.bot
|
338
490
|
else
|
339
491
|
ty = Type.any
|
340
492
|
end
|
@@ -345,7 +497,11 @@ module TypeProf
|
|
345
497
|
def hash_aset(recv, mid, aargs, ep, env, scratch, &ctn)
|
346
498
|
return ctn[Type.any, ep, env] unless recv.is_a?(Type::Local) && recv.kind == Type::Hash
|
347
499
|
|
348
|
-
|
500
|
+
if aargs.lead_tys.size != 2
|
501
|
+
# XXX: error?
|
502
|
+
ctn[Type.any, ep, env]
|
503
|
+
return
|
504
|
+
end
|
349
505
|
|
350
506
|
idx = aargs.lead_tys.first
|
351
507
|
idx = scratch.globalize_type(idx, env, ep)
|
@@ -364,18 +520,7 @@ module TypeProf
|
|
364
520
|
end
|
365
521
|
|
366
522
|
def struct_initialize(recv, mid, aargs, ep, env, scratch, &ctn)
|
367
|
-
|
368
|
-
scratch.add_ivar_read!(recv, :_members, ep) do |member_ary_ty, ep|
|
369
|
-
member_ary_ty.elems.lead_tys.zip(aargs.lead_tys) do |sym, ty|
|
370
|
-
ty ||= Type.nil
|
371
|
-
scratch.set_instance_variable(recv, sym.sym, ty, ep, env)
|
372
|
-
end
|
373
|
-
end
|
374
|
-
ctn[recv, ep, env]
|
375
|
-
end
|
376
|
-
|
377
|
-
def struct_i_new(recv, mid, aargs, ep, env, scratch, &ctn)
|
378
|
-
struct_klass = recv
|
523
|
+
struct_klass = recv.klass
|
379
524
|
while struct_klass.superclass != Type::Builtin[:struct]
|
380
525
|
struct_klass = struct_klass.superclass
|
381
526
|
end
|
@@ -383,34 +528,57 @@ module TypeProf
|
|
383
528
|
ctn[Type.any, ep, env]
|
384
529
|
return
|
385
530
|
end
|
386
|
-
|
387
|
-
scratch.add_ivar_read!(Type::Instance.new(struct_klass), :_members, ep) do |
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
531
|
+
scratch.add_ivar_read!(Type::Instance.new(struct_klass), :_keyword_init, ep) do |keyword_init, ep|
|
532
|
+
scratch.add_ivar_read!(Type::Instance.new(struct_klass), :_members, ep) do |member_ary_ty, ep|
|
533
|
+
next if member_ary_ty == Type.nil
|
534
|
+
if keyword_init == Type::Instance.new(Type::Builtin[:true])
|
535
|
+
# TODO: support kw_rest_ty
|
536
|
+
aargs.kw_tys.each do |key, val_ty|
|
537
|
+
found = false
|
538
|
+
member_ary_ty.elems.lead_tys.each do |sym|
|
539
|
+
if sym.sym == key
|
540
|
+
found = true
|
541
|
+
scratch.set_instance_variable(recv, sym.sym, val_ty, ep, env)
|
542
|
+
end
|
543
|
+
end
|
544
|
+
unless found
|
545
|
+
# TODO: what to do when not found?
|
546
|
+
end
|
547
|
+
end
|
548
|
+
else
|
549
|
+
member_ary_ty.elems.lead_tys.zip(aargs.lead_tys) do |sym, ty|
|
550
|
+
ty ||= Type.nil
|
551
|
+
scratch.set_instance_variable(recv, sym.sym, ty, ep, env)
|
552
|
+
end
|
553
|
+
end
|
395
554
|
end
|
396
555
|
end
|
556
|
+
ctn[recv, ep, env]
|
397
557
|
end
|
398
558
|
|
399
559
|
def struct_s_new(recv, mid, aargs, ep, env, scratch, &ctn)
|
400
560
|
# TODO: keyword_init
|
401
561
|
|
562
|
+
keyword_init = false
|
563
|
+
if aargs.kw_tys && aargs.kw_tys[:keyword_init] # XXX: more canonical way to extract keyword...
|
564
|
+
if aargs.kw_tys[:keyword_init] == Type::Instance.new(Type::Builtin[:true])
|
565
|
+
keyword_init = true
|
566
|
+
end
|
567
|
+
end
|
568
|
+
|
402
569
|
fields = aargs.lead_tys.map {|ty| get_sym("Struct.new", ty, ep, scratch) }.compact
|
403
570
|
struct_klass = scratch.new_struct(ep)
|
404
571
|
|
405
|
-
scratch.set_singleton_custom_method(struct_klass, :new, Builtin.method(:
|
406
|
-
scratch.set_singleton_custom_method(struct_klass, :[], Builtin.method(:
|
572
|
+
scratch.set_singleton_custom_method(struct_klass, :new, Builtin.method(:object_s_new))
|
573
|
+
scratch.set_singleton_custom_method(struct_klass, :[], Builtin.method(:object_s_new))
|
407
574
|
fields.each do |field|
|
408
|
-
scratch.add_attr_method(struct_klass,
|
575
|
+
scratch.add_attr_method(struct_klass, field, field, :accessor, true, ep)
|
409
576
|
end
|
410
577
|
fields = fields.map {|field| Type::Symbol.new(field, Type::Instance.new(Type::Builtin[:sym])) }
|
411
578
|
base_ty = Type::Instance.new(Type::Builtin[:ary])
|
412
579
|
fields = Type::Array.new(Type::Array::Elements.new(fields), base_ty)
|
413
580
|
scratch.add_ivar_write!(Type::Instance.new(struct_klass), :_members, fields, ep)
|
581
|
+
scratch.add_ivar_write!(Type::Instance.new(struct_klass), :_keyword_init, Type::Instance.new(Type::Builtin[:true]), ep) if keyword_init
|
414
582
|
#set_singleton_custom_method(struct_klass, :members, Builtin.method(:...))
|
415
583
|
|
416
584
|
ctn[struct_klass, ep, env]
|
@@ -459,11 +627,20 @@ module TypeProf
|
|
459
627
|
end
|
460
628
|
|
461
629
|
def kernel_require(recv, mid, aargs, ep, env, scratch, &ctn)
|
462
|
-
|
630
|
+
if aargs.lead_tys.size != 1
|
631
|
+
# XXX: handle correctly
|
632
|
+
ctn[Type.any, ep, env]
|
633
|
+
return
|
634
|
+
end
|
635
|
+
|
463
636
|
feature = aargs.lead_tys.first
|
464
637
|
if feature.is_a?(Type::Literal)
|
465
638
|
feature = feature.lit
|
466
639
|
|
640
|
+
unless feature.is_a?(String)
|
641
|
+
return ctn[Type.any, ep, env]
|
642
|
+
end
|
643
|
+
|
467
644
|
action, arg = Builtin.file_require(feature, scratch)
|
468
645
|
case action
|
469
646
|
when :do
|
@@ -473,22 +650,31 @@ module TypeProf
|
|
473
650
|
ctn[result, ep, env]
|
474
651
|
when :error
|
475
652
|
scratch.warn(ep, arg)
|
476
|
-
result = Type
|
653
|
+
result = Type.bool
|
477
654
|
ctn[result, ep, env]
|
478
655
|
end
|
479
656
|
else
|
480
657
|
scratch.warn(ep, "require target cannot be identified statically")
|
481
|
-
result = Type
|
658
|
+
result = Type.bool
|
482
659
|
ctn[result, ep, env]
|
483
660
|
end
|
484
661
|
end
|
485
662
|
|
486
663
|
def kernel_require_relative(recv, mid, aargs, ep, env, scratch, &ctn)
|
487
|
-
|
664
|
+
if aargs.lead_tys.size != 1
|
665
|
+
# XXX: handle correctly
|
666
|
+
ctn[Type.any, ep, env]
|
667
|
+
return
|
668
|
+
end
|
669
|
+
|
488
670
|
feature = aargs.lead_tys.first
|
489
671
|
if feature.is_a?(Type::Literal)
|
490
672
|
feature = feature.lit
|
491
673
|
|
674
|
+
unless feature.is_a?(String)
|
675
|
+
return ctn[Type.any, ep, env]
|
676
|
+
end
|
677
|
+
|
492
678
|
if scratch.loaded_features[feature]
|
493
679
|
result = Type::Instance.new(Type::Builtin[:false])
|
494
680
|
return ctn[result, ep, env]
|
@@ -509,7 +695,12 @@ module TypeProf
|
|
509
695
|
end
|
510
696
|
|
511
697
|
def kernel_autoload(recv, mid, aargs, ep, env, scratch, &ctn)
|
512
|
-
|
698
|
+
if aargs.lead_tys.size != 2
|
699
|
+
# XXX: handle correctly
|
700
|
+
ctn[Type.any, ep, env]
|
701
|
+
return
|
702
|
+
end
|
703
|
+
|
513
704
|
feature = aargs.lead_tys[1]
|
514
705
|
if feature.is_a?(Type::Literal)
|
515
706
|
feature = feature.lit
|
@@ -551,8 +742,8 @@ module TypeProf
|
|
551
742
|
end
|
552
743
|
|
553
744
|
def self.setup_initial_global_env(scratch)
|
554
|
-
klass_basic_obj = scratch.new_class(nil, :BasicObject, [], :__root__, nil
|
555
|
-
klass_obj = scratch.new_class(nil, :Object, [], klass_basic_obj,
|
745
|
+
klass_basic_obj = scratch.new_class(nil, :BasicObject, [], :__root__, nil) # cbase, name, superclass
|
746
|
+
klass_obj = scratch.new_class(nil, :Object, [], klass_basic_obj, nil)
|
556
747
|
scratch.add_constant(klass_obj, :Object, klass_obj, nil)
|
557
748
|
scratch.add_constant(klass_obj, :BasicObject, klass_basic_obj, nil)
|
558
749
|
|
@@ -561,23 +752,26 @@ module TypeProf
|
|
561
752
|
|
562
753
|
Import.import_builtin(scratch)
|
563
754
|
|
564
|
-
Type::Builtin[:vmcore]
|
565
|
-
Type::Builtin[:int]
|
566
|
-
Type::Builtin[:float]
|
567
|
-
Type::Builtin[:rational]
|
568
|
-
Type::Builtin[:
|
569
|
-
Type::Builtin[:
|
570
|
-
Type::Builtin[:
|
571
|
-
Type::Builtin[:
|
572
|
-
Type::Builtin[:
|
573
|
-
Type::Builtin[:
|
574
|
-
Type::Builtin[:
|
575
|
-
Type::Builtin[:
|
576
|
-
Type::Builtin[:
|
577
|
-
Type::Builtin[:
|
578
|
-
Type::Builtin[:
|
579
|
-
Type::Builtin[:
|
580
|
-
Type::Builtin[:
|
755
|
+
Type::Builtin[:vmcore] = scratch.new_class(klass_obj, :VMCore, [], klass_obj, nil)
|
756
|
+
Type::Builtin[:int] = scratch.get_constant(klass_obj, :Integer)
|
757
|
+
Type::Builtin[:float] = scratch.get_constant(klass_obj, :Float)
|
758
|
+
Type::Builtin[:rational] = scratch.get_constant(klass_obj, :Rational)
|
759
|
+
Type::Builtin[:complex] = scratch.get_constant(klass_obj, :Complex)
|
760
|
+
Type::Builtin[:sym] = scratch.get_constant(klass_obj, :Symbol)
|
761
|
+
Type::Builtin[:str] = scratch.get_constant(klass_obj, :String)
|
762
|
+
Type::Builtin[:struct] = scratch.get_constant(klass_obj, :Struct)
|
763
|
+
Type::Builtin[:ary] = scratch.get_constant(klass_obj, :Array)
|
764
|
+
Type::Builtin[:hash] = scratch.get_constant(klass_obj, :Hash)
|
765
|
+
Type::Builtin[:io] = scratch.get_constant(klass_obj, :IO)
|
766
|
+
Type::Builtin[:proc] = scratch.get_constant(klass_obj, :Proc)
|
767
|
+
Type::Builtin[:range] = scratch.get_constant(klass_obj, :Range)
|
768
|
+
Type::Builtin[:regexp] = scratch.get_constant(klass_obj, :Regexp)
|
769
|
+
Type::Builtin[:matchdata] = scratch.get_constant(klass_obj, :MatchData)
|
770
|
+
Type::Builtin[:class] = scratch.get_constant(klass_obj, :Class)
|
771
|
+
Type::Builtin[:module] = scratch.get_constant(klass_obj, :Module)
|
772
|
+
Type::Builtin[:exc] = scratch.get_constant(klass_obj, :Exception)
|
773
|
+
Type::Builtin[:encoding] = scratch.get_constant(klass_obj, :Encoding)
|
774
|
+
Type::Builtin[:enumerator] = scratch.get_constant(klass_obj, :Enumerator)
|
581
775
|
|
582
776
|
klass_vmcore = Type::Builtin[:vmcore]
|
583
777
|
klass_ary = Type::Builtin[:ary]
|
@@ -592,21 +786,29 @@ module TypeProf
|
|
592
786
|
scratch.set_custom_method(klass_vmcore, :"core#raise", Builtin.method(:vmcore_raise))
|
593
787
|
scratch.set_custom_method(klass_vmcore, :lambda, Builtin.method(:lambda))
|
594
788
|
scratch.set_singleton_custom_method(klass_obj, :"new", Builtin.method(:object_s_new))
|
595
|
-
scratch.
|
596
|
-
scratch.set_singleton_custom_method(klass_obj, :"attr_reader", Builtin.method(:module_attr_reader))
|
597
|
-
scratch.set_singleton_custom_method(klass_obj, :"attr_writer", Builtin.method(:module_attr_writer))
|
598
|
-
scratch.set_custom_method(klass_obj, :p, Builtin.method(:kernel_p))
|
789
|
+
scratch.set_custom_method(klass_obj, :p, Builtin.method(:kernel_p), false)
|
599
790
|
scratch.set_custom_method(klass_obj, :is_a?, Builtin.method(:object_is_a?))
|
600
791
|
scratch.set_custom_method(klass_obj, :respond_to?, Builtin.method(:object_respond_to?))
|
601
792
|
scratch.set_custom_method(klass_obj, :class, Builtin.method(:object_class))
|
602
793
|
scratch.set_custom_method(klass_obj, :send, Builtin.method(:object_send))
|
603
794
|
scratch.set_custom_method(klass_obj, :instance_eval, Builtin.method(:object_instance_eval))
|
604
|
-
scratch.set_custom_method(klass_obj, :proc, Builtin.method(:lambda))
|
795
|
+
scratch.set_custom_method(klass_obj, :proc, Builtin.method(:lambda), false)
|
796
|
+
scratch.set_custom_method(klass_obj, :__method__, Builtin.method(:object_privitive_method), false)
|
797
|
+
scratch.set_custom_method(klass_obj, :block_given?, Builtin.method(:object_block_given?), false)
|
798
|
+
|
799
|
+
scratch.set_custom_method(klass_obj, :enum_for, Builtin.method(:object_enum_for))
|
800
|
+
scratch.set_custom_method(klass_obj, :to_enum, Builtin.method(:object_enum_for))
|
605
801
|
|
606
802
|
scratch.set_custom_method(klass_module, :include, Builtin.method(:module_include))
|
607
803
|
scratch.set_custom_method(klass_module, :extend, Builtin.method(:module_extend))
|
608
|
-
scratch.set_custom_method(klass_module, :
|
804
|
+
scratch.set_custom_method(klass_module, :prepend, Builtin.method(:module_prepend))
|
805
|
+
scratch.set_custom_method(klass_module, :module_function, Builtin.method(:module_module_function), false)
|
806
|
+
scratch.set_custom_method(klass_module, :public, Builtin.method(:module_public), false)
|
807
|
+
scratch.set_custom_method(klass_module, :private, Builtin.method(:module_private), false)
|
609
808
|
scratch.set_custom_method(klass_module, :define_method, Builtin.method(:module_define_method))
|
809
|
+
scratch.set_custom_method(klass_module, :"attr_accessor", Builtin.method(:module_attr_accessor))
|
810
|
+
scratch.set_custom_method(klass_module, :"attr_reader", Builtin.method(:module_attr_reader))
|
811
|
+
scratch.set_custom_method(klass_module, :"attr_writer", Builtin.method(:module_attr_writer))
|
610
812
|
|
611
813
|
scratch.set_custom_method(klass_proc, :[], Builtin.method(:proc_call))
|
612
814
|
scratch.set_custom_method(klass_proc, :call, Builtin.method(:proc_call))
|
@@ -621,10 +823,10 @@ module TypeProf
|
|
621
823
|
scratch.set_custom_method(klass_struct, :initialize, Builtin.method(:struct_initialize))
|
622
824
|
scratch.set_singleton_custom_method(klass_struct, :new, Builtin.method(:struct_s_new))
|
623
825
|
|
624
|
-
scratch.set_custom_method(klass_obj, :require, Builtin.method(:kernel_require))
|
625
|
-
scratch.set_custom_method(klass_obj, :require_relative, Builtin.method(:kernel_require_relative))
|
626
|
-
scratch.set_custom_method(klass_obj, :Array, Builtin.method(:kernel_Array))
|
627
|
-
scratch.set_custom_method(klass_obj, :autoload, Builtin.method(:kernel_autoload))
|
826
|
+
scratch.set_custom_method(klass_obj, :require, Builtin.method(:kernel_require), false)
|
827
|
+
scratch.set_custom_method(klass_obj, :require_relative, Builtin.method(:kernel_require_relative), false)
|
828
|
+
scratch.set_custom_method(klass_obj, :Array, Builtin.method(:kernel_Array), false)
|
829
|
+
scratch.set_custom_method(klass_obj, :autoload, Builtin.method(:kernel_autoload), false)
|
628
830
|
scratch.set_custom_method(klass_module, :autoload, Builtin.method(:module_autoload))
|
629
831
|
|
630
832
|
# remove BasicObject#method_missing
|