Skip to content

Commit bc805e1

Browse files
committed
Updated tests/syntax_callref.nit
Signed-off-by: Louis-Vincent Boudreault <[email protected]>
1 parent 1ff59e4 commit bc805e1

9 files changed

+606
-500
lines changed

src/compiler/abstract_compiler.nit

+225-236
Large diffs are not rendered by default.

src/compiler/global_compiler.nit

+9-15
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,7 @@ class GlobalCompilerVisitor
472472
my_recv = autobox(recv, object_type)
473473
end
474474
var thunk = new CustomizedThunkFunction(mmethoddef, my_recv.mtype.as(MClassType))
475-
thunk.polymorph_call_flag = not my_recv.is_exact #true
476-
#thunk.force_polymorphism = not my_recv.is_exact
475+
thunk.polymorph_call_flag = not my_recv.is_exact
477476
compiler.todo(method)
478477
compiler.todo(thunk)
479478

@@ -499,12 +498,7 @@ class GlobalCompilerVisitor
499498
var ret_mtype = mmethoddef.msignature.return_mtype
500499

501500
if ret_mtype != null then
502-
# TODO check for separate compiler
503501
ret_mtype = resolve_for(ret_mtype, routine)
504-
# var temp = ret_mtype
505-
# If mmethoddef has a return type, use the type defined
506-
# in the routine instance instead.
507-
#ret_mtype = routine_type.arguments.last
508502
end
509503
var callsite = "{underlying_method}({ss})"
510504
if ret_mtype != null then
@@ -1122,17 +1116,17 @@ private class CustomizedRuntimeFunction
11221116
# class A[E]
11231117
# fun toto(x: E)
11241118
# do
1125-
# ...do something with x...
1119+
# # ...do something with x...
11261120
# end
11271121
# end
11281122
# end
11291123
# var a = new A[nullable Int]
11301124
# var f = &a.toto
1131-
# f.call(null) <-- Will produce a proper C callsite, but it will
1132-
# -- produce unreachable (dead code) for type checking
1133-
# -- and covariance. Thus, creating warnings when
1134-
# -- compiling in global. However, if you ignore
1135-
# -- those warnings, the binary works perfectly fine.
1125+
# f.call(null) # Will produce a proper C callsite, but it will
1126+
# # produce unreachable (dead code) for type checking
1127+
# # and covariance. Thus, creating warnings when
1128+
# # compiling in global. However, if you ignore
1129+
# # those warnings, the binary works perfectly fine.
11361130
# ~~~~
11371131
var intromclassdef = self.mmethoddef.mproperty.intro_mclassdef
11381132
var is_callref = v.compiler.all_routine_types_name.has(intromclassdef.name)
@@ -1165,12 +1159,12 @@ private class CustomizedRuntimeFunction
11651159
end
11661160
end
11671161

1162+
# Thunk implementation for global compiler.
1163+
# For more detail see `abstract_compiler::ThunkFunction` documentation.
11681164
class CustomizedThunkFunction
11691165
super ThunkFunction
11701166
super CustomizedRuntimeFunction
11711167

1172-
#var force_polymorphism = false
1173-
11741168
redef fun c_name
11751169
do
11761170
return "THUNK_" + super

0 commit comments

Comments
 (0)